From: foobar Date: Mon, 9 May 2005 12:15:53 +0000 (+0000) Subject: - getlogin() / getgroups() are not necessarily available everywhere X-Git-Tag: php-5.0.1b1~279 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b87d8360ec3e3efd1e3451879b890584563d55c;p=php - getlogin() / getgroups() are not necessarily available everywhere --- diff --git a/ext/posix/config.m4 b/ext/posix/config.m4 index fc3767e98b..e687f73bf7 100644 --- a/ext/posix/config.m4 +++ b/ext/posix/config.m4 @@ -9,5 +9,5 @@ if test "$PHP_POSIX" = "yes"; then AC_DEFINE(HAVE_POSIX, 1, [whether to include POSIX-like functions]) PHP_NEW_EXTENSION(posix, posix.c, $ext_shared) - AC_CHECK_FUNCS(seteuid setegid setsid getsid setpgid getpgid ctermid mkfifo getrlimit) + AC_CHECK_FUNCS(seteuid setegid setsid getsid setpgid getpgid ctermid mkfifo getrlimit getlogin getgroups) fi diff --git a/ext/posix/php_posix.h b/ext/posix/php_posix.h index 10e70c1f5f..eff5efcf30 100644 --- a/ext/posix/php_posix.h +++ b/ext/posix/php_posix.h @@ -54,8 +54,12 @@ PHP_FUNCTION(posix_seteuid); #ifdef HAVE_SETEGID PHP_FUNCTION(posix_setegid); #endif +#ifdef HAVE_GETGROUPS PHP_FUNCTION(posix_getgroups); +#endif +#ifdef HAVE_GETLOGIN PHP_FUNCTION(posix_getlogin); +#endif /* POSIX.1, 4.3 */ PHP_FUNCTION(posix_getpgrp); diff --git a/ext/posix/posix.c b/ext/posix/posix.c index fa985726fa..42c1164e91 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -70,8 +70,12 @@ function_entry posix_functions[] = { #ifdef HAVE_SETEGID PHP_FE(posix_setegid, NULL) #endif +#ifdef HAVE_GETGROUPS PHP_FE(posix_getgroups, NULL) +#endif +#ifdef HAVE_GETLOGIN PHP_FE(posix_getlogin, NULL) +#endif /* POSIX.1, 4.3 */ PHP_FE(posix_getpgrp, NULL) @@ -299,6 +303,7 @@ PHP_FUNCTION(posix_setegid) /* {{{ proto array posix_getgroups(void) Get supplementary group id's (POSIX.1, 4.2.3) */ +#ifdef HAVE_GETGROUPS PHP_FUNCTION(posix_getgroups) { gid_t gidlist[NGROUPS_MAX]; @@ -318,10 +323,12 @@ PHP_FUNCTION(posix_getgroups) add_next_index_long(return_value, gidlist[i]); } } +#endif /* }}} */ /* {{{ proto string posix_getlogin(void) Get user name (POSIX.1, 4.2.4) */ +#ifdef HAVE_GETLOGIN PHP_FUNCTION(posix_getlogin) { char *p; @@ -335,6 +342,7 @@ PHP_FUNCTION(posix_getlogin) RETURN_STRING(p, 1); } +#endif /* }}} */ /* {{{ proto int posix_getpgrp(void)