sas             Tue Jan 21 06:03:59 2003 EDT

  Modified files:              
    /php4/main  SAPI.h SAPI.c 
    /php4/sapi/apache   mod_php4.c 
  Log:
  add sapi_get_target_uid/_gid for obtaining information about the
  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.
  
  
Index: php4/main/SAPI.h
diff -u php4/main/SAPI.h:1.96 php4/main/SAPI.h:1.97
--- php4/main/SAPI.h:1.96       Wed Jan 15 16:13:01 2003
+++ php4/main/SAPI.h    Tue Jan 21 06:03:57 2003
@@ -190,6 +190,9 @@
 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 @@
        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: php4/main/SAPI.c
diff -u php4/main/SAPI.c:1.162 php4/main/SAPI.c:1.163
--- php4/main/SAPI.c:1.162      Wed Jan 15 06:30:39 2003
+++ php4/main/SAPI.c    Tue Jan 21 06:03:57 2003
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: SAPI.c,v 1.162 2003/01/15 11:30:39 sas Exp $ */
+/* $Id: SAPI.c,v 1.163 2003/01/21 11:03:57 sas Exp $ */
 
 #include <ctype.h>
 #include <sys/stat.h>
@@ -868,6 +868,26 @@
                return -1;
        }
 }
+
+
+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:
Index: php4/sapi/apache/mod_php4.c
diff -u php4/sapi/apache/mod_php4.c:1.150 php4/sapi/apache/mod_php4.c:1.151
--- php4/sapi/apache/mod_php4.c:1.150   Tue Dec 31 10:59:01 2002
+++ php4/sapi/apache/mod_php4.c Tue Jan 21 06:03:58 2003
@@ -17,9 +17,10 @@
    | PHP 4.0 patches by Zeev Suraski <[EMAIL PROTECTED]>                      |
    +----------------------------------------------------------------------+
  */
-/* $Id: mod_php4.c,v 1.150 2002/12/31 15:59:01 sebastian Exp $ */
+/* $Id: mod_php4.c,v 1.151 2003/01/21 11:03:58 sas Exp $ */
 
 #include "php_apache_http.h"
+#include "http_conf_globals.h"
 
 #ifdef NETWARE
 #define SIGPIPE SIGINT
@@ -371,6 +372,22 @@
        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 @@
        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
 };
 /* }}} */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to