]> granicus.if.org Git - php/commitdiff
MFH 0/-1 changes
authorSascha Schumann <sas@php.net>
Sun, 9 Feb 2003 21:28:49 +0000 (21:28 +0000)
committerSascha Schumann <sas@php.net>
Sun, 9 Feb 2003 21:28:49 +0000 (21:28 +0000)
main/SAPI.c
main/SAPI.h
sapi/apache/mod_php4.c
sapi/thttpd/thttpd.c

index 2f4dd43d352bee159c630ab53562df94ec7ffc2d..8e155733279a86c49a07f5ab3fe5d7b262100dd9 100644 (file)
@@ -856,7 +856,7 @@ SAPI_API int sapi_get_fd(int *fd TSRMLS_DC)
        if (sapi_module.get_fd) {
                return sapi_module.get_fd(fd TSRMLS_CC);
        } else {
-               return -1;
+               return FAILURE;
        }
 }
 
@@ -865,10 +865,30 @@ SAPI_API int sapi_force_http_10(TSRMLS_D)
        if (sapi_module.force_http_10) {
                return sapi_module.force_http_10(TSRMLS_C);
        } else {
-               return -1;
+               return FAILURE;
+       }
+}
+
+
+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 FAILURE;
+       }
+}
+
+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 FAILURE;
        }
 }
 
+
 /*
  * 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..c4afc8b32e3c213c72ec6b52dcdc670149423f94 100644 (file)
@@ -20,6 +20,7 @@
 /* $Id$ */
 
 #include "php_apache_http.h"
+#include "http_conf_globals.h"
 
 #ifdef NETWARE
 #define SIGPIPE SIGINT
@@ -354,9 +355,9 @@ static int sapi_apache_get_fd(int *nfd TSRMLS_DC)
        
        if (fd >= 0) {
                if (nfd) *nfd = fd;
-               return 0;
+               return SUCCESS;
        }
-       return -1;
+       return FAILURE;
 }
 /* }}} */
 
@@ -368,7 +369,23 @@ static int sapi_apache_force_http_10(TSRMLS_D)
        
        r->proto_num = HTTP_VERSION(1,0);
        
-       return 0;
+       return SUCCESS;
+}
+
+/* {{{ sapi_apache_get_target_uid
+ */
+static int sapi_apache_get_target_uid(uid_t *obj TSRMLS_DC)
+{
+       *obj = ap_user_id;
+       return SUCCESS;
+}
+
+/* {{{ sapi_apache_get_target_gid
+ */
+static int sapi_apache_get_target_gid(gid_t *obj TSRMLS_DC)
+{
+       *obj = ap_group_id;
+       return SUCCESS;
 }
 
 /* {{{ 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
 };
 /* }}} */
 
index ae46df350912bab5dbb88f3080bce6188551b49d..30d1cea79885dafa37e650446a20bad464e3d73c 100644 (file)
@@ -349,7 +349,7 @@ static int php_thttpd_startup(sapi_module_struct *sapi_module)
 static int sapi_thttpd_get_fd(int *nfd TSRMLS_DC)
 {
        if (nfd) *nfd = TG(hc)->conn_fd;
-       return 0;
+       return SUCCESS;
 }
 
 static sapi_module_struct thttpd_sapi_module = {