hirokawa Mon Apr 4 11:06:36 2005 EDT
Modified files:
/php-src/main SAPI.c SAPI.h main.c php_variables.c
/php-src/sapi/apache mod_php5.c
/php-src/sapi/apache_hooks mod_php5.c
Log:
added a server variable PHP_AUTH_DIGEST to support HTTP Digest Authentication.
http://cvs.php.net/diff.php/php-src/main/SAPI.c?r1=1.199&r2=1.200&ty=u
Index: php-src/main/SAPI.c
diff -u php-src/main/SAPI.c:1.199 php-src/main/SAPI.c:1.200
--- php-src/main/SAPI.c:1.199 Mon Mar 14 14:25:37 2005
+++ php-src/main/SAPI.c Mon Apr 4 11:06:27 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: SAPI.c,v 1.199 2005/03/14 19:25:37 rasmus Exp $ */
+/* $Id: SAPI.c,v 1.200 2005/04/04 15:06:27 hirokawa Exp $ */
#include <ctype.h>
#include <sys/stat.h>
@@ -424,6 +424,9 @@
if (SG(request_info).auth_password) {
efree(SG(request_info).auth_password);
}
+ if (SG(request_info).auth_digest) {
+ efree(SG(request_info).auth_digest);
+ }
if (SG(request_info).content_type_dup) {
efree(SG(request_info).content_type_dup);
}
http://cvs.php.net/diff.php/php-src/main/SAPI.h?r1=1.112&r2=1.113&ty=u
Index: php-src/main/SAPI.h
diff -u php-src/main/SAPI.h:1.112 php-src/main/SAPI.h:1.113
--- php-src/main/SAPI.h:1.112 Mon Mar 14 14:25:37 2005
+++ php-src/main/SAPI.h Mon Apr 4 11:06:28 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: SAPI.h,v 1.112 2005/03/14 19:25:37 rasmus Exp $ */
+/* $Id: SAPI.h,v 1.113 2005/04/04 15:06:28 hirokawa Exp $ */
#ifndef SAPI_H
#define SAPI_H
@@ -98,6 +98,7 @@
/* for HTTP authentication */
char *auth_user;
char *auth_password;
+ char *auth_digest;
/* this is necessary for the CGI SAPI module */
char *argv0;
http://cvs.php.net/diff.php/php-src/main/main.c?r1=1.622&r2=1.623&ty=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.622 php-src/main/main.c:1.623
--- php-src/main/main.c:1.622 Wed Mar 23 20:11:11 2005
+++ php-src/main/main.c Mon Apr 4 11:06:28 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.622 2005/03/24 01:11:11 andi Exp $ */
+/* $Id: main.c,v 1.623 2005/04/04 15:06:28 hirokawa Exp $ */
/* {{{ includes
*/
@@ -1736,6 +1736,11 @@
SG(request_info).auth_user = SG(request_info).auth_password =
NULL;
}
+ if (auth && auth[0] != '\0' && strncmp(auth, "Digest ", 7) == 0) {
+ SG(request_info).auth_digest = estrdup(auth);
+ ret = 0;
+ }
+
return ret;
}
/* }}} */
http://cvs.php.net/diff.php/php-src/main/php_variables.c?r1=1.87&r2=1.88&ty=u
Index: php-src/main/php_variables.c
diff -u php-src/main/php_variables.c:1.87 php-src/main/php_variables.c:1.88
--- php-src/main/php_variables.c:1.87 Mon Mar 28 13:46:57 2005
+++ php-src/main/php_variables.c Mon Apr 4 11:06:33 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_variables.c,v 1.87 2005/03/28 18:46:57 iliaa Exp $ */
+/* $Id: php_variables.c,v 1.88 2005/04/04 15:06:33 hirokawa Exp $ */
#include <stdio.h>
#include "php.h"
@@ -515,6 +515,9 @@
if (SG(request_info).auth_password) {
php_register_variable("PHP_AUTH_PW",
SG(request_info).auth_password, array_ptr TSRMLS_CC);
}
+ if (SG(request_info).auth_digest) {
+ php_register_variable("PHP_AUTH_DIGEST",
SG(request_info).auth_digest, array_ptr TSRMLS_CC);
+ }
/* store request init time */
{
zval new_entry;
http://cvs.php.net/diff.php/php-src/sapi/apache/mod_php5.c?r1=1.13&r2=1.14&ty=u
Index: php-src/sapi/apache/mod_php5.c
diff -u php-src/sapi/apache/mod_php5.c:1.13 php-src/sapi/apache/mod_php5.c:1.14
--- php-src/sapi/apache/mod_php5.c:1.13 Mon Mar 14 14:25:38 2005
+++ php-src/sapi/apache/mod_php5.c Mon Apr 4 11:06:36 2005
@@ -17,7 +17,7 @@
| PHP 4.0 patches by Zeev Suraski <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: mod_php5.c,v 1.13 2005/03/14 19:25:38 rasmus Exp $ */
+/* $Id: mod_php5.c,v 1.14 2005/04/04 15:06:36 hirokawa Exp $ */
#include "php_apache_http.h"
#include "http_conf_globals.h"
@@ -489,24 +489,27 @@
if (r->headers_in) {
authorization = table_get(r->headers_in, "Authorization");
}
+
+ SG(request_info).auth_user = NULL;
+ SG(request_info).auth_password = NULL;
+
if (authorization
- && (!PG(safe_mode) || (PG(safe_mode) && !auth_type(r)))
- && !strcasecmp(getword(r->pool, &authorization, ' '), "Basic"))
{
- tmp = uudecode(r->pool, authorization);
- SG(request_info).auth_user = NULL;
- tmp_user = getword_nulls_nc(r->pool, &tmp, ':');
- if (tmp_user) {
- r->connection->user = pstrdup(r->connection->pool,
tmp_user);
- r->connection->ap_auth_type = "Basic";
- SG(request_info).auth_user = estrdup(tmp_user);
- }
- SG(request_info).auth_password = NULL;
- if (tmp) {
- SG(request_info).auth_password = estrdup(tmp);
+ && (!PG(safe_mode) || (PG(safe_mode) && !auth_type(r)))) {
+ if (!strcasecmp(getword(r->pool, &authorization, ' '),
"Basic")) {
+ tmp = uudecode(r->pool, authorization);
+ tmp_user = getword_nulls_nc(r->pool, &tmp, ':');
+ if (tmp_user) {
+ r->connection->user =
pstrdup(r->connection->pool, tmp_user);
+ r->connection->ap_auth_type = "Basic";
+ SG(request_info).auth_user = estrdup(tmp_user);
+ }
+ if (tmp) {
+ SG(request_info).auth_password = estrdup(tmp);
+ }
+ } else if (!strcasecmp(getword(r->pool, &authorization, ' '),
"Digest")) {
+ r->connection->ap_auth_type = "Digest";
+ SG(request_info).auth_digest = estrdup(authorization);
}
- } else {
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
}
}
/* }}} */
http://cvs.php.net/diff.php/php-src/sapi/apache_hooks/mod_php5.c?r1=1.7&r2=1.8&ty=u
Index: php-src/sapi/apache_hooks/mod_php5.c
diff -u php-src/sapi/apache_hooks/mod_php5.c:1.7
php-src/sapi/apache_hooks/mod_php5.c:1.8
--- php-src/sapi/apache_hooks/mod_php5.c:1.7 Mon Mar 14 14:25:38 2005
+++ php-src/sapi/apache_hooks/mod_php5.c Mon Apr 4 11:06:36 2005
@@ -17,7 +17,7 @@
| PHP 4.0 patches by Zeev Suraski <[EMAIL PROTECTED]>
|
+----------------------------------------------------------------------+
*/
-/* $Id: mod_php5.c,v 1.7 2005/03/14 19:25:38 rasmus Exp $ */
+/* $Id: mod_php5.c,v 1.8 2005/04/04 15:06:36 hirokawa Exp $ */
#include "php_apache_http.h"
@@ -579,24 +579,26 @@
if (r->headers_in) {
authorization = table_get(r->headers_in, "Authorization");
}
- if (authorization
- && !auth_type(r)
- && !strcasecmp(getword(r->pool, &authorization, ' '), "Basic"))
{
- tmp = uudecode(r->pool, authorization);
- SG(request_info).auth_user = NULL;
- tmp_user = getword_nulls_nc(r->pool, &tmp, ':');
- if (tmp_user) {
- r->connection->user = pstrdup(r->connection->pool,
tmp_user);
- r->connection->ap_auth_type = "Basic";
- SG(request_info).auth_user = estrdup(tmp_user);
- }
- SG(request_info).auth_password = NULL;
- if (tmp) {
- SG(request_info).auth_password = estrdup(tmp);
+
+ SG(request_info).auth_user = NULL;
+ SG(request_info).auth_password = NULL;
+
+ if (authorization && !auth_type(r)) {
+ if (!strcasecmp(getword(r->pool, &authorization, ' '), "Basic")) {
+ tmp = uudecode(r->pool, authorization);
+ tmp_user = getword_nulls_nc(r->pool, &tmp, ':');
+ if (tmp_user) {
+ r->connection->user = pstrdup(r->connection->pool, tmp_user);
+ r->connection->ap_auth_type = "Basic";
+ SG(request_info).auth_user = estrdup(tmp_user);
+ }
+ if (tmp) {
+ SG(request_info).auth_password = estrdup(tmp);
+ }
+ } else if (!strcasecmp(getword(r->pool, &authorization, ' '),
"Digest")) {
+ r->connection->ap_auth_type = "Digest";
+ SG(request_info).auth_digest = estrdup(authorization);
}
- } else {
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
}
}
/* }}} */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php