mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
More robust setuid, setgid, etc detection
* configure.ac: Check for getuid, getgid, setuid, and setgid. * libguile/posix.c (scm_getuid, scm_getgid, scm_setuid, scm_setgid): Only provide Scheme functions if the OS provides these facilities. (scm_geteuid, scm_getegid, scm_seteuid, scm_setegid): Provide if the host has getuid, getgid, etc, instead of being in a MinGW guard.
This commit is contained in:
parent
b505ad9ad3
commit
a9e726eda7
2 changed files with 18 additions and 16 deletions
|
@ -759,9 +759,9 @@ AC_CHECK_HEADERS([assert.h crt_externs.h])
|
||||||
#
|
#
|
||||||
AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid \
|
AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid \
|
||||||
fesetround ftime ftruncate fchown fchmod getcwd geteuid getsid \
|
fesetround ftime ftruncate fchown fchmod getcwd geteuid getsid \
|
||||||
gettimeofday gmtime_r ioctl lstat mkdir mknod nice \
|
gettimeofday getuid getgid gmtime_r ioctl lstat mkdir mknod nice \
|
||||||
readdir_r readdir64_r readlink rename rmdir setegid seteuid \
|
readdir_r readdir64_r readlink rename rmdir setegid seteuid \
|
||||||
setlocale setpgid setsid sigaction siginterrupt stat64 \
|
setlocale setuid setgid setpgid setsid sigaction siginterrupt stat64 \
|
||||||
strptime symlink sync sysconf tcgetpgrp tcsetpgrp uname waitpid \
|
strptime symlink sync sysconf tcgetpgrp tcsetpgrp uname waitpid \
|
||||||
strdup system usleep atexit on_exit chown link fcntl ttyname getpwent \
|
strdup system usleep atexit on_exit chown link fcntl ttyname getpwent \
|
||||||
getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp \
|
getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp \
|
||||||
|
|
|
@ -800,8 +800,7 @@ SCM_DEFINE (scm_getppid, "getppid", 0, 0, 0,
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
#endif /* HAVE_GETPPID */
|
#endif /* HAVE_GETPPID */
|
||||||
|
|
||||||
|
#ifdef HAVE_GETUID
|
||||||
#ifndef __MINGW32__
|
|
||||||
SCM_DEFINE (scm_getuid, "getuid", 0, 0, 0,
|
SCM_DEFINE (scm_getuid, "getuid", 0, 0, 0,
|
||||||
(),
|
(),
|
||||||
"Return an integer representing the current real user ID.")
|
"Return an integer representing the current real user ID.")
|
||||||
|
@ -810,9 +809,9 @@ SCM_DEFINE (scm_getuid, "getuid", 0, 0, 0,
|
||||||
return scm_from_int (getuid ());
|
return scm_from_int (getuid ());
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
#endif /* HAVE_GETUID */
|
||||||
|
|
||||||
|
#ifdef HAVE_GETGID
|
||||||
|
|
||||||
SCM_DEFINE (scm_getgid, "getgid", 0, 0, 0,
|
SCM_DEFINE (scm_getgid, "getgid", 0, 0, 0,
|
||||||
(),
|
(),
|
||||||
"Return an integer representing the current real group ID.")
|
"Return an integer representing the current real group ID.")
|
||||||
|
@ -821,9 +820,9 @@ SCM_DEFINE (scm_getgid, "getgid", 0, 0, 0,
|
||||||
return scm_from_int (getgid ());
|
return scm_from_int (getgid ());
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
#endif /* HAVE_GETGID */
|
||||||
|
|
||||||
|
#ifdef HAVE_GETUID
|
||||||
|
|
||||||
SCM_DEFINE (scm_geteuid, "geteuid", 0, 0, 0,
|
SCM_DEFINE (scm_geteuid, "geteuid", 0, 0, 0,
|
||||||
(),
|
(),
|
||||||
"Return an integer representing the current effective user ID.\n"
|
"Return an integer representing the current effective user ID.\n"
|
||||||
|
@ -839,8 +838,9 @@ SCM_DEFINE (scm_geteuid, "geteuid", 0, 0, 0,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
#endif /* HAVE_GETUID */
|
||||||
|
|
||||||
|
#ifdef HAVE_GETGID
|
||||||
SCM_DEFINE (scm_getegid, "getegid", 0, 0, 0,
|
SCM_DEFINE (scm_getegid, "getegid", 0, 0, 0,
|
||||||
(),
|
(),
|
||||||
"Return an integer representing the current effective group ID.\n"
|
"Return an integer representing the current effective group ID.\n"
|
||||||
|
@ -856,8 +856,9 @@ SCM_DEFINE (scm_getegid, "getegid", 0, 0, 0,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
#endif /* HAVE_GETGID */
|
||||||
|
|
||||||
|
#ifdef HAVE_SETUID
|
||||||
SCM_DEFINE (scm_setuid, "setuid", 1, 0, 0,
|
SCM_DEFINE (scm_setuid, "setuid", 1, 0, 0,
|
||||||
(SCM id),
|
(SCM id),
|
||||||
"Sets both the real and effective user IDs to the integer @var{id}, provided\n"
|
"Sets both the real and effective user IDs to the integer @var{id}, provided\n"
|
||||||
|
@ -870,7 +871,9 @@ SCM_DEFINE (scm_setuid, "setuid", 1, 0, 0,
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
#endif /* HAVE_SETUID */
|
||||||
|
|
||||||
|
#ifdef HAVE_SETGID
|
||||||
SCM_DEFINE (scm_setgid, "setgid", 1, 0, 0,
|
SCM_DEFINE (scm_setgid, "setgid", 1, 0, 0,
|
||||||
(SCM id),
|
(SCM id),
|
||||||
"Sets both the real and effective group IDs to the integer @var{id}, provided\n"
|
"Sets both the real and effective group IDs to the integer @var{id}, provided\n"
|
||||||
|
@ -883,7 +886,9 @@ SCM_DEFINE (scm_setgid, "setgid", 1, 0, 0,
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
#endif /* HAVE_SETGID */
|
||||||
|
|
||||||
|
#ifdef HAVE_SETUID
|
||||||
SCM_DEFINE (scm_seteuid, "seteuid", 1, 0, 0,
|
SCM_DEFINE (scm_seteuid, "seteuid", 1, 0, 0,
|
||||||
(SCM id),
|
(SCM id),
|
||||||
"Sets the effective user ID to the integer @var{id}, provided the process\n"
|
"Sets the effective user ID to the integer @var{id}, provided the process\n"
|
||||||
|
@ -905,10 +910,9 @@ SCM_DEFINE (scm_seteuid, "seteuid", 1, 0, 0,
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
#endif /* __MINGW32__ */
|
#endif /* HAVE_SETUID */
|
||||||
|
|
||||||
|
#ifdef HAVE_SETGID
|
||||||
#ifdef HAVE_SETEGID
|
|
||||||
SCM_DEFINE (scm_setegid, "setegid", 1, 0, 0,
|
SCM_DEFINE (scm_setegid, "setegid", 1, 0, 0,
|
||||||
(SCM id),
|
(SCM id),
|
||||||
"Sets the effective group ID to the integer @var{id}, provided the process\n"
|
"Sets the effective group ID to the integer @var{id}, provided the process\n"
|
||||||
|
@ -931,8 +935,7 @@ SCM_DEFINE (scm_setegid, "setegid", 1, 0, 0,
|
||||||
|
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
#endif
|
#endif /* HAVE_SETGID */
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_GETPGRP
|
#ifdef HAVE_GETPGRP
|
||||||
SCM_DEFINE (scm_getpgrp, "getpgrp", 0, 0, 0,
|
SCM_DEFINE (scm_getpgrp, "getpgrp", 0, 0, 0,
|
||||||
|
@ -948,7 +951,6 @@ SCM_DEFINE (scm_getpgrp, "getpgrp", 0, 0, 0,
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
#endif /* HAVE_GETPGRP */
|
#endif /* HAVE_GETPGRP */
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_SETPGID
|
#ifdef HAVE_SETPGID
|
||||||
SCM_DEFINE (scm_setpgid, "setpgid", 2, 0, 0,
|
SCM_DEFINE (scm_setpgid, "setpgid", 2, 0, 0,
|
||||||
(SCM pid, SCM pgid),
|
(SCM pid, SCM pgid),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue