[PHP4BETA] CVS update: php4/ext/zlib

From: Date: Fri, 23 Apr 1999 04:12:13 +0000
Subject: [PHP4BETA] CVS update: php4/ext/zlib
Groups: php.version4 
Request: Send a blank email to php-version4+get-373@lists.php.net to get a copy of this message
Date: Friday April 23, 1999 @ 0:12 Author: rasmus Update of /repository/php4/ext/zlib In directory php:/tmp/cvs-serv7802/ext/zlib Modified Files: zlib.c Log Message: Make zlib compile Index: php4/ext/zlib/zlib.c diff -c php4/ext/zlib/zlib.c:1.1 php4/ext/zlib/zlib.c:1.2 *** php4/ext/zlib/zlib.c:1.1 Wed Apr 21 22:48:28 1999 --- php4/ext/zlib/zlib.c Fri Apr 23 00:12:13 1999 *************** *** 22,28 **** | Stefan Röhrich <sr@linux.de> | +----------------------------------------------------------------------+ */ ! /* $Id: zlib.c,v 1.1 1999/04/22 02:48:28 ssb Exp $ */ #if !PHP_31 && defined(THREAD_SAFE) #undef THREAD_SAFE #endif --- 22,28 ---- | Stefan Röhrich <sr@linux.de> | +----------------------------------------------------------------------+ */ ! /* $Id: zlib.c,v 1.2 1999/04/23 04:12:13 rasmus Exp $ */ #if !PHP_31 && defined(THREAD_SAFE) #undef THREAD_SAFE #endif *************** *** 96,107 **** #endif int gzgetss_state; int le_zp; - #if PHP_31 - int magic_quotes_runtime; - int safe_mode; - char *include_path; - char *doc_root; - #endif #if defined(THREAD_SAFE) }zlib_global_struct; #endif --- 96,101 ---- *************** *** 120,131 **** #define ZLIB_TLS_VARS #endif - #if PHP_31 - # define ZLIB_INI(a) ZLIB_GLOBAL(a) - #else - # define ZLIB_INI(a) php3_ini.a - #endif - function_entry php3_zlib_functions[] = { {"readgzfile", php3_readgzfile, NULL}, {"gzrewind", php3_gzrewind, NULL}, --- 114,119 ---- *************** *** 173,184 **** return FAILURE; } #endif - /* get our ini variables here */ - cfg_get_long("safe_mode",&ZLIB_INI(safe_mode)); - cfg_get_long("magic_quotes_runtime",&ZLIB_INI(magic_quotes_runtime)); - cfg_get_string("doc_root",&ZLIB_INI(doc_root)); - cfg_get_string("include_path",&ZLIB_INI(include_path)); - ZLIB_GLOBAL(le_zp) = register_list_destructors(gzclose,NULL); return SUCCESS; } --- 161,166 ---- *************** *** 214,224 **** static gzFile php3_gzopen_wrapper(char *path, char *mode, int options) { ZLIB_TLS_VARS; ! if (options & USE_PATH && ZLIB_INI(include_path) != NULL) { ! return php3_gzopen_with_path(path, mode, ZLIB_INI(include_path), NULL); } else { ! if (options & ENFORCE_SAFE_MODE && ZLIB_INI(safe_mode) && (!_php3_checkuid(path,1))) { return NULL; } if (_php3_check_open_basedir(path)) return NULL; --- 196,206 ---- static gzFile php3_gzopen_wrapper(char *path, char *mode, int options) { ZLIB_TLS_VARS; ! if (options & USE_PATH && PG(include_path) != NULL) { ! return php3_gzopen_with_path(path, mode, PG(include_path), NULL); } else { ! if (options & ENFORCE_SAFE_MODE && PG(safe_mode) && (!_php3_checkuid(path,1))) { return NULL; } if (_php3_check_open_basedir(path)) return NULL; *************** *** 244,250 **** /* Relative path open */ if (*filename == '.') { ! if (ZLIB_INI(safe_mode) &&(!_php3_checkuid(filename,2))) { return(NULL); } if (_php3_check_open_basedir(filename)) return NULL; --- 226,232 ---- /* Relative path open */ if (*filename == '.') { ! if (PG(safe_mode) &&(!_php3_checkuid(filename,2))) { return(NULL); } if (_php3_check_open_basedir(filename)) return NULL; *************** *** 261,268 **** #else if (*filename == '/') { #endif ! if (ZLIB_INI(safe_mode)) { ! snprintf(trypath,MAXPATHLEN,"%s%s",ZLIB_INI(doc_root),filename); if (!_php3_checkuid(trypath,2)) { return(NULL); } --- 243,250 ---- #else if (*filename == '/') { #endif ! if (PG(safe_mode)) { ! snprintf(trypath,MAXPATHLEN,"%s%s",PG(doc_root),filename); if (!_php3_checkuid(trypath,2)) { return(NULL); } *************** *** 279,285 **** } if (!path || (path && !*path)) { ! if (ZLIB_INI(safe_mode) &&(!_php3_checkuid(filename,2))) { return(NULL); } if (_php3_check_open_basedir(filename)) return NULL; --- 261,267 ---- } if (!path || (path && !*path)) { ! if (PG(safe_mode) &&(!_php3_checkuid(filename,2))) { return(NULL); } if (_php3_check_open_basedir(filename)) return NULL; *************** *** 305,311 **** end++; } snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename); ! if (ZLIB_INI(safe_mode)) { if (stat(trypath,&sb) == 0 &&(!_php3_checkuid(trypath,2))) { efree(pathbuf); return(NULL); --- 287,293 ---- end++; } snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename); ! if (PG(safe_mode)) { if (stat(trypath,&sb) == 0 &&(!_php3_checkuid(trypath,2))) { efree(pathbuf); return(NULL); *************** *** 372,378 **** /* Now loop through the file and do the magic quotes thing if needed */ memset(buf,0,8191); while((int)gzgets(zp, buf, 8191)) { ! if (ZLIB_INI(magic_quotes_runtime)) { int len; slashed = _php3_addslashes(buf,0,&len,0); /* 0 = don't free source string */ --- 354,360 ---- /* Now loop through the file and do the magic quotes thing if needed */ memset(buf,0,8191); while((int)gzgets(zp, buf, 8191)) { ! if (PG(magic_quotes_runtime)) { int len; slashed = _php3_addslashes(buf,0,&len,0); /* 0 = don't free source string */ *************** *** 512,518 **** efree(buf); RETVAL_FALSE; } else { ! if (ZLIB_INI(magic_quotes_runtime)) { return_value->value.str.val = _php3_addslashes(buf,0,&return_value->value.str.len,1); } else { return_value->value.str.val = buf; --- 494,500 ---- efree(buf); RETVAL_FALSE; } else { ! if (PG(magic_quotes_runtime)) { return_value->value.str.val = _php3_addslashes(buf,0,&return_value->value.str.len,1); } else { return_value->value.str.val = buf; *************** *** 717,723 **** } /* strip slashes only if the length wasn't specified explicitly */ ! if (!arg3 && ZLIB_INI(magic_quotes_runtime)) { _php3_stripslashes(arg2->value.str.val,&num_bytes); } --- 699,705 ---- } /* strip slashes only if the length wasn't specified explicitly */ ! if (!arg3 && PG(magic_quotes_runtime)) { _php3_stripslashes(arg2->value.str.val,&num_bytes); } *************** *** 911,917 **** return_value->value.str.len = gzread(zp, return_value->value.str.val, len); return_value->value.str.val[return_value->value.str.len] = 0; ! if (ZLIB_INI(magic_quotes_runtime)) { return_value->value.str.val = _php3_addslashes(return_value->value.str.val,return_value->value.str.len,&return_value->value.str.len,1); } return_value->type = IS_STRING; --- 893,899 ---- return_value->value.str.len = gzread(zp, return_value->value.str.val, len); return_value->value.str.val[return_value->value.str.len] = 0; ! if (PG(magic_quotes_runtime)) { return_value->value.str.val = _php3_addslashes(return_value->value.str.val,return_value->value.str.len,&return_value->value.str.len,1); } return_value->type = IS_STRING; -- PHP 4 Beta

« previous php.version4 (#373) next »