]> granicus.if.org Git - php/commitdiff
add sapi_get_target_uid/_gid for obtaining information about the
authorSascha Schumann <sas@php.net>
Tue, 21 Jan 2003 11:03:58 +0000 (11:03 +0000)
committerSascha Schumann <sas@php.net>
Tue, 21 Jan 2003 11:03:58 +0000 (11:03 +0000)
non-privileged user the web server is running as.  this is useful
for creating shared memory segments which need to be accessed by
the child processes/threads.

main/SAPI.c
main/SAPI.h
sapi/apache/mod_php4.c

index a11f98c95339398f7d8f29e2a792ab64a327fdd2..d23ec9a4ef43b8c6ddb09169e279d702f3f0f9c9 100644 (file)
@@ -869,6 +869,26 @@ SAPI_API int sapi_force_http_10(TSRMLS_D)
        }
 }
 
+
+SAPI_API int sapi_get_target_uid(uid_t *obj TSRMLS_DC)
+{
+       if (sapi_module.get_target_uid) {
+               return sapi_module.get_target_uid(obj TSRMLS_CC);
+       } else {
+               return -1;
+       }
+}
+
+SAPI_API int sapi_get_target_gid(gid_t *obj TSRMLS_DC)
+{
+       if (sapi_module.get_target_gid) {
+               return sapi_module.get_target_gid(obj TSRMLS_CC);
+       } else {
+               return -1;
+       }
+}
+
+
 /*
  * Local variables:
  * tab-width: 4
index 81235574ca3d8f67ab47a9cbf1a7b216dfa4c156..75c80fae41af861e4a691800e031c4313f33cf13 100644 (file)
@@ -190,6 +190,9 @@ SAPI_API void sapi_activate_headers_only(TSRMLS_D);
 SAPI_API int sapi_get_fd(int *fd TSRMLS_DC);
 SAPI_API int sapi_force_http_10(TSRMLS_D);
 
+SAPI_API int sapi_get_target_uid(uid_t * TSRMLS_DC);
+SAPI_API int sapi_get_target_gid(gid_t * TSRMLS_DC);
+
 struct _sapi_module_struct {
        char *name;
        char *pretty_name;
@@ -231,6 +234,9 @@ struct _sapi_module_struct {
        int (*get_fd)(int *fd TSRMLS_DC);
 
        int (*force_http_10)(TSRMLS_D);
+
+       int (*get_target_uid)(uid_t * TSRMLS_DC);
+       int (*get_target_gid)(gid_t * TSRMLS_DC);
 };
 
 
index 0f9eaeb074738ae8d48cd26a415e8bed3d08f834..0a14fd680418d62b832973cbff270d865076f110 100644 (file)
@@ -20,6 +20,7 @@
 /* $Id$ */
 
 #include "php_apache_http.h"
+#include "http_conf_globals.h"
 
 #ifdef NETWARE
 #define SIGPIPE SIGINT
@@ -371,6 +372,22 @@ static int sapi_apache_force_http_10(TSRMLS_D)
        return 0;
 }
 
+/* {{{ sapi_apache_get_target_uid
+ */
+static int sapi_apache_get_target_uid(uid_t *obj TSRMLS_DC)
+{
+       *obj = ap_user_id;
+       return 0;
+}
+
+/* {{{ sapi_apache_get_target_gid
+ */
+static int sapi_apache_get_target_gid(gid_t *obj TSRMLS_DC)
+{
+       *obj = ap_group_id;
+       return 0;
+}
+
 /* {{{ sapi_module_struct apache_sapi_module
  */
 static sapi_module_struct apache_sapi_module = {
@@ -415,7 +432,9 @@ static sapi_module_struct apache_sapi_module = {
        NULL,                                                   /* exe location */
        0,                                                              /* ini ignore */
        sapi_apache_get_fd,
-       sapi_apache_force_http_10
+       sapi_apache_force_http_10,
+       sapi_apache_get_target_uid,
+       sapi_apache_get_target_gid
 };
 /* }}} */