summaryrefslogtreecommitdiff
path: root/ext/posix/posix.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-06-19 02:19:13 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-06-19 02:19:13 +0000
commit3b7be889d89076b1bdddee1ff46d980112ff1902 (patch)
tree93a2b84495de3651bb553b602a6b9e92b9364070 /ext/posix/posix.c
parentaae5df3ffdf31e0ddb294cf588b15cd18514f99d (diff)
downloadphp-git-3b7be889d89076b1bdddee1ff46d980112ff1902.tar.gz
Added posix_initgroups() function.
Diffstat (limited to 'ext/posix/posix.c')
-rw-r--r--ext/posix/posix.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index bb1935c435..715f482e8d 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -134,6 +134,9 @@ zend_function_entry posix_functions[] = {
PHP_FE(posix_get_last_error, NULL)
PHP_FALIAS(posix_errno, posix_get_last_error, NULL)
PHP_FE(posix_strerror, NULL)
+#ifdef HAVE_INITGROUPS
+ PHP_FE(posix_initgroups, NULL)
+#endif
{NULL, NULL, NULL}
};
@@ -1056,6 +1059,22 @@ PHP_FUNCTION(posix_strerror)
#endif
+/* {{{ proto bool initgroups(string name, int base_group_id)
+ Calculate the group access list for the user specified in name. */
+PHP_FUNCTION(posix_initgroups)
+{
+ long basegid;
+ char *name;
+ int name_len;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &name, &name_len, &basegid) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ RETURN_BOOL(!initgroups((const char *)name, basegid));
+}
+/* }}} */
+
/*
* Local variables:
* tab-width: 4