#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[] = {
};
#ifndef ZTS
-static HashTable ht_keys;
-static HashTable ht_socks;
+static HashTable PG(ht_fsock_keys);
+static HashTable PG(ht_fsock_socks);
#endif
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;
}
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;
*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);
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;
}
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;
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) &&
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;
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;
}
#ifndef _FOPEN_WRAPPERS_H
#define _FOPEN_WRAPPERS_H
+#include "php_globals.h"
+
#define IGNORE_PATH 0
#define USE_PATH 1
#define IGNORE_URL 2
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);