]> granicus.if.org Git - php/commitdiff
Win32/ZTS compiles again
authorZeev Suraski <zeev@php.net>
Sat, 19 Jun 1999 13:04:55 +0000 (13:04 +0000)
committerZeev Suraski <zeev@php.net>
Sat, 19 Jun 1999 13:04:55 +0000 (13:04 +0000)
ext/standard/fsock.c
main/fopen_wrappers.c
main/fopen_wrappers.h
main/php_globals.h

index 1bd2c548550b24fe50be2c2b5962da392a05e99c..0420cad037282da492535e637ef6870f17ce5a73 100644 (file)
@@ -87,11 +87,6 @@ extern int le_fp;
 #include "build-defs.h"
 #endif
 
-#ifndef ZTS
-static HashTable ht_keys;
-static HashTable ht_socks;
-#endif
-
 static unsigned char third_and_fourth_args_force_ref[] = { 4, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };
 
 function_entry fsock_functions[] = {
@@ -130,8 +125,8 @@ php3_module_entry fsock_module_entry = {
 };
  
 #ifndef ZTS
-static HashTable ht_keys;
-static HashTable ht_socks;
+static HashTable PG(ht_fsock_keys);
+static HashTable PG(ht_fsock_socks);
 #endif
 
 
@@ -160,8 +155,9 @@ int lookup_hostname(const char *addr, struct in_addr *in)
 int _php3_is_persistent_sock(int sock)
 {
        char *key;
+       PLS_FETCH();
 
-       if (_php3_hash_find(&ht_socks, (char *) &sock, sizeof(sock),
+       if (_php3_hash_find(&PG(ht_fsock_socks), (char *) &sock, sizeof(sock),
                                (void **) &key) == SUCCESS) {
                return 1;
        }
@@ -289,7 +285,7 @@ static void _php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) {
        key = emalloc(args[0]->value.str.len + 10);
        sprintf(key, "%s:%d", args[0]->value.str.val, portno);
 
-       if (persistent && _php3_hash_find(&ht_keys, key, strlen(key) + 1,
+       if (persistent && _php3_hash_find(&PG(ht_fsock_keys), key, strlen(key) + 1,
                                (void *) &sockp) == SUCCESS) {
                efree(key);
                *sock = *sockp;
@@ -364,9 +360,9 @@ static void _php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) {
 
        *sock=socketd;
        if (persistent) {
-               _php3_hash_update(&ht_keys, key, strlen(key) + 1, 
+               _php3_hash_update(&PG(ht_fsock_keys), key, strlen(key) + 1, 
                                sock, sizeof(*sock), NULL);
-               _php3_hash_update(&ht_socks, (char *) sock, sizeof(*sock),
+               _php3_hash_update(&PG(ht_fsock_socks), (char *) sock, sizeof(*sock),
                                key, strlen(key) + 1, NULL);
        }
        if(key) efree(key);
@@ -735,8 +731,8 @@ static void _php3_msock_destroy(int *data)
 int php3_minit_fsock(INIT_FUNC_ARGS)
 {
 #ifndef ZTS
-       _php3_hash_init(&ht_keys, 0, NULL, NULL, 1);
-       _php3_hash_init(&ht_socks, 0, NULL, (void (*)(void *))_php3_msock_destroy, 1);
+       _php3_hash_init(&PG(ht_fsock_keys), 0, NULL, NULL, 1);
+       _php3_hash_init(&PG(ht_fsock_socks), 0, NULL, (void (*)(void *))_php3_msock_destroy, 1);
 #endif
        return SUCCESS;
 }
@@ -746,8 +742,8 @@ int php3_minit_fsock(INIT_FUNC_ARGS)
 int php3_mshutdown_fsock(SHUTDOWN_FUNC_ARGS)
 {
 #ifndef ZTS
-       _php3_hash_destroy(&ht_socks);
-       _php3_hash_destroy(&ht_keys);
+       _php3_hash_destroy(&PG(ht_fsock_socks));
+       _php3_hash_destroy(&PG(ht_fsock_keys));
 #endif
        php_cleanup_sockbuf(1);
        return SUCCESS;
index e63897cff45273472d4fe80d6e076031bf85c602..8ca0076a8867c45f646f0b86c78161151b00f322 100644 (file)
@@ -100,13 +100,13 @@ int _php3_getftpresult(int socketd);
        
        When open_basedir is NULL, always return 0
 */
-PHPAPI int _php3_check_specific_open_basedir(char *basedir, char *path)
+PHPAPI int _php3_check_specific_open_basedir(char *basedir, char *path PLS_DC)
 {
        char resolved_name[MAXPATHLEN];
        char resolved_basedir[MAXPATHLEN];
        char local_open_basedir[MAXPATHLEN];
        int local_open_basedir_pos;
-       PLS_FETCH();
+       SLS_FETCH();
        
        /* Special case basedir==".": Use script-directory */
        if ((strcmp(PG(open_basedir), ".") == 0) && 
@@ -153,6 +153,8 @@ PHPAPI int _php3_check_specific_open_basedir(char *basedir, char *path)
 
 PHPAPI int _php3_check_open_basedir(char *path)
 {
+       PLS_FETCH();
+
        /* Only check when open_basedir is available */
        if (PG(open_basedir) && *PG(open_basedir)) {
                char *pathbuf;
@@ -174,7 +176,7 @@ PHPAPI int _php3_check_open_basedir(char *path)
                                end++;
                        }
 
-                       if (_php3_check_specific_open_basedir(ptr, path) == 0) {
+                       if (_php3_check_specific_open_basedir(ptr, path PLS_CC) == 0) {
                                efree(pathbuf);
                                return 0;
                        }
index c5c69db70f12ce05ea4311b440b37ceca640331a..5541480dff05f5b32950ded89cabec4c91ef8d9d 100644 (file)
@@ -33,6 +33,8 @@
 #ifndef _FOPEN_WRAPPERS_H
 #define _FOPEN_WRAPPERS_H
 
+#include "php_globals.h"
+
 #define IGNORE_PATH    0
 #define USE_PATH       1
 #define IGNORE_URL     2
@@ -84,7 +86,7 @@ extern PHPAPI FILE *php3_fopen_wrapper(char *filename, char *mode, int options,
 PHPAPI FILE *php3_fopen_for_parser(void);
 
 extern PHPAPI int _php3_check_open_basedir(char *path);
-extern PHPAPI int _php3_check_specific_open_basedir(char *basedir, char *path);
+extern PHPAPI int _php3_check_specific_open_basedir(char *basedir, char *path PLS_DC);
 
 extern PHPAPI FILE *php3_fopen_with_path(char *filename, char *mode, char *path, char **opened_path);
 
index 0269f9ce93014ec5dcc02f35a06b13817a687db7..55534df6a01987ad5b9a39ef330e8aa6821bcaba 100644 (file)
@@ -64,6 +64,10 @@ struct _php_core_globals {
        long y2k_compliance;
 
        unsigned char header_is_being_sent;
+
+       /* for fsock */
+       HashTable ht_fsock_keys;
+       HashTable ht_fsock_socks;
 };