if (sapi_module.get_fd) {
return sapi_module.get_fd(fd TSRMLS_CC);
} else {
- return -1;
+ return FAILURE;
}
}
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
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;
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);
};
/* $Id$ */
#include "php_apache_http.h"
+#include "http_conf_globals.h"
#ifdef NETWARE
#define SIGPIPE SIGINT
if (fd >= 0) {
if (nfd) *nfd = fd;
- return 0;
+ return SUCCESS;
}
- return -1;
+ return FAILURE;
}
/* }}} */
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
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
};
/* }}} */
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 = {