summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-05-12 21:35:16 +0000
committerZeev Suraski <zeev@php.net>1999-05-12 21:35:16 +0000
commit49b01a4b3dc6d660e33801bdae840c9448da11cc (patch)
treef1484e32a32d10e4a1f5ecb58453707d8e017706
parentcefca57c9c845101cb8d39b0cc062d20e2da791d (diff)
downloadphp-git-49b01a4b3dc6d660e33801bdae840c9448da11cc.tar.gz
Support HTTP Auth under ISAPI. Now, these short pieces of code took *A LOT* of
research :(
-rw-r--r--main/SAPI.c8
-rw-r--r--main/main.c20
2 files changed, 20 insertions, 8 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
index 87be2e3fe8..178e2b8d83 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -111,14 +111,6 @@ SAPI_API void sapi_deactivate(SLS_D)
if (SG(request_info).post_data) {
efree(SG(request_info).post_data);
}
- if (SG(server_context)) {
- if (SG(request_info).auth_user) {
- efree(SG(request_info).auth_user);
- }
- if (SG(request_info).auth_password) {
- efree(SG(request_info).auth_password);
- }
- }
}
diff --git a/main/main.c b/main/main.c
index 2f2d0d6508..0b9d086fa7 100644
--- a/main/main.c
+++ b/main/main.c
@@ -629,6 +629,26 @@ int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC)
init_executor(CLS_C ELS_CC);
startup_scanner(CLS_C);
+ if (SG(request_info).auth_user) {
+ zval *auth_user;
+
+ MAKE_STD_ZVAL(auth_user);
+ auth_user->type = IS_STRING;
+ auth_user->value.str.val = SG(request_info).auth_user;
+ auth_user->value.str.len = strlen(auth_user->value.str.val);
+
+ zend_hash_update(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), &auth_user, sizeof(zval *), NULL);
+ }
+ if (SG(request_info).auth_user) {
+ zval *auth_password;
+
+ MAKE_STD_ZVAL(auth_password);
+ auth_password->type = IS_STRING;
+ auth_password->value.str.val = SG(request_info).auth_password;
+ auth_password->value.str.len = strlen(auth_password->value.str.val);
+
+ zend_hash_update(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), &auth_password, sizeof(zval *), NULL);
+ }
return SUCCESS;
}