cvs: php4 /sapi/aolserver aolserver.c
| From: | Sascha Schumann | Date: | Sat, 11 Nov 2000 18:35:16 +0000 |
| Subject: | cvs: php4 /sapi/aolserver aolserver.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-2559@lists.php.net to get a copy of this message | ||
sas Sat Nov 11 10:35:16 2000 EDT
Modified files:
/php4/sapi/aolserver aolserver.c
Log:
strdup private AOLserver data before inserting it into SAPI's request_info.
Index: php4/sapi/aolserver/aolserver.c
diff -u php4/sapi/aolserver/aolserver.c:1.51 php4/sapi/aolserver/aolserver.c:1.52
--- php4/sapi/aolserver/aolserver.c:1.51 Sun Oct 29 08:01:01 2000
+++ php4/sapi/aolserver/aolserver.c Sat Nov 11 10:35:15 2000
@@ -22,7 +22,7 @@
* - CGI/1.1 conformance
*/
-/* $Id: aolserver.c,v 1.51 2000/10/29 16:01:01 sas Exp $ */
+/* $Id: aolserver.c,v 1.52 2000/11/11 18:35:15 sas Exp $ */
/* conflict between PHP and AOLserver headers */
#define Debug php_Debug
@@ -211,7 +211,7 @@
NSLS_FETCH();
php_info_print_table_start();
- php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.51
2000/10/29 16:01:01 sas Exp $");
+ php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.52
2000/11/11 18:35:15 sas Exp $");
php_info_print_table_row(2, "Build date", Ns_InfoBuildDate());
php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile());
php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog());
@@ -446,16 +446,17 @@
server = Ns_ConnServer(NSG(conn));
- SG(request_info).query_string = NSG(conn->request->query);
+#define safe_strdup(x) ((x)?strdup((x)):NULL)
+ SG(request_info).query_string = safe_strdup(NSG(conn->request->query));
Ns_DStringInit(&ds);
Ns_UrlToFile(&ds, server, NSG(conn->request->url));
/* path_translated is the absolute path to the file */
- SG(request_info).path_translated = strdup(Ns_DStringValue(&ds));
+ SG(request_info).path_translated = safe_strdup(Ns_DStringValue(&ds));
Ns_DStringFree(&ds);
root = Ns_PageRoot(server);
- SG(request_info).request_uri = SG(request_info).path_translated + strlen(root);
+ SG(request_info).request_uri = strdup(SG(request_info).path_translated + strlen(root));
SG(request_info).request_method = NSG(conn)->request->method;
SG(request_info).content_length = Ns_ConnContentLength(NSG(conn));
index = Ns_SetIFind(NSG(conn)->headers, "content-type");
@@ -464,15 +465,13 @@
SG(sapi_headers).http_response_code = 200;
tmp = Ns_ConnAuthUser(NSG(conn));
- if(tmp) {
+ if (tmp)
tmp = estrdup(tmp);
- }
SG(request_info).auth_user = tmp;
tmp = Ns_ConnAuthPasswd(NSG(conn));
- if(tmp) {
+ if (tmp)
tmp = estrdup(tmp);
- }
SG(request_info).auth_password = tmp;
NSG(data_avail) = SG(request_info).content_length;
@@ -487,6 +486,9 @@
php_ns_request_dtor(NSLS_D SLS_DC)
{
free(SG(request_info).path_translated);
+ if (SG(request_info).query_string)
+ free(SG(request_info).query_string);
+ free(SG(request_info).request_uri);
}
/*