kalle Tue, 13 Apr 2010 11:41:40 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=297957
Log: * Pass TSRMLS_C around pageinfo.c * Use zend_parse_parameters_none() in pageinfo.c Changed paths: U php/php-src/trunk/ext/standard/mail.c U php/php-src/trunk/ext/standard/pageinfo.c U php/php-src/trunk/ext/standard/pageinfo.h U php/php-src/trunk/main/SAPI.c U php/php-src/trunk/main/safe_mode.c Modified: php/php-src/trunk/ext/standard/mail.c =================================================================== --- php/php-src/trunk/ext/standard/mail.c 2010-04-13 11:14:04 UTC (rev 297956) +++ php/php-src/trunk/ext/standard/mail.c 2010-04-13 11:41:40 UTC (rev 297957) @@ -69,7 +69,7 @@ *p = ' '; \ } \ -extern long php_getuid(void); +extern long php_getuid(TSRMLS_D); /* {{{ proto int ezmlm_hash(string addr) Calculate EZMLM list hash value. */ @@ -241,9 +241,9 @@ php_basename(tmp, strlen(tmp), NULL, 0,&f, &f_len TSRMLS_CC); if (headers != NULL) { - spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n%s", php_getuid(), f, headers); + spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n%s", php_getuid(TSRMLS_C), f, headers); } else { - spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n", php_getuid(), f); + spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n", php_getuid(TSRMLS_C), f); } efree(f); } Modified: php/php-src/trunk/ext/standard/pageinfo.c =================================================================== --- php/php-src/trunk/ext/standard/pageinfo.c 2010-04-13 11:14:04 UTC (rev 297956) +++ php/php-src/trunk/ext/standard/pageinfo.c 2010-04-13 11:41:40 UTC (rev 297957) @@ -79,19 +79,15 @@ /* {{{ php_getuid */ -long php_getuid(void) +long php_getuid(TSRMLS_D) { - TSRMLS_FETCH(); - php_statpage(TSRMLS_C); return (BG(page_uid)); } /* }}} */ -long php_getgid(void) +long php_getgid(TSRMLS_D) { - TSRMLS_FETCH(); - php_statpage(TSRMLS_C); return (BG(page_gid)); } @@ -101,8 +97,12 @@ PHP_FUNCTION(getmyuid) { long uid; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } - uid = php_getuid(); + uid = php_getuid(TSRMLS_C); if (uid < 0) { RETURN_FALSE; } else { @@ -116,8 +116,12 @@ PHP_FUNCTION(getmygid) { long gid; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } - gid = php_getgid(); + gid = php_getgid(TSRMLS_C); if (gid < 0) { RETURN_FALSE; } else { @@ -131,6 +135,10 @@ PHP_FUNCTION(getmypid) { int pid; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } pid = getpid(); if (pid < 0) { @@ -145,6 +153,10 @@ Get the inode of the current script being parsed */ PHP_FUNCTION(getmyinode) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } + php_statpage(TSRMLS_C); if (BG(page_inode) < 0) { RETURN_FALSE; @@ -164,7 +176,13 @@ Get time of last page modification */ PHP_FUNCTION(getlastmod) { - long lm = php_getlastmod(TSRMLS_C); + long lm; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + lm = php_getlastmod(TSRMLS_C); if (lm < 0) { RETURN_FALSE; } else { @@ -173,7 +191,7 @@ } /* }}} */ -/* +/*nma * Local variables: * tab-width: 4 * c-basic-offset: 4 Modified: php/php-src/trunk/ext/standard/pageinfo.h =================================================================== --- php/php-src/trunk/ext/standard/pageinfo.h 2010-04-13 11:14:04 UTC (rev 297956) +++ php/php-src/trunk/ext/standard/pageinfo.h 2010-04-13 11:41:40 UTC (rev 297957) @@ -29,7 +29,7 @@ PHPAPI void php_statpage(TSRMLS_D); PHPAPI long php_getlastmod(TSRMLS_D); -extern long php_getuid(void); -extern long php_getgid(void); +extern long php_getuid(TSRMLS_D); +extern long php_getgid(TSRMLS_D); #endif Modified: php/php-src/trunk/main/SAPI.c =================================================================== --- php/php-src/trunk/main/SAPI.c 2010-04-13 11:14:04 UTC (rev 297956) +++ php/php-src/trunk/main/SAPI.c 2010-04-13 11:41:40 UTC (rev 297957) @@ -689,7 +689,7 @@ ptr++; } - myuid = php_getuid(); + myuid = php_getuid(TSRMLS_C); ptr_len = strlen(ptr); MAKE_STD_ZVAL(repl_temp); Modified: php/php-src/trunk/main/safe_mode.c =================================================================== --- php/php-src/trunk/main/safe_mode.c 2010-04-13 11:14:04 UTC (rev 297956) +++ php/php-src/trunk/main/safe_mode.c 2010-04-13 11:41:40 UTC (rev 297957) @@ -104,9 +104,9 @@ } else { uid = sb.st_uid; gid = sb.st_gid; - if (uid == php_getuid()) { + if (uid == php_getuid(TSRMLS_C)) { return 1; - } else if (PG(safe_mode_gid) && gid == php_getgid()) { + } else if (PG(safe_mode_gid) && gid == php_getgid(TSRMLS_C)) { return 1; } } @@ -157,9 +157,9 @@ } duid = sb.st_uid; dgid = sb.st_gid; - if (duid == php_getuid()) { + if (duid == php_getuid(TSRMLS_C)) { return 1; - } else if (PG(safe_mode_gid) && dgid == php_getgid()) { + } else if (PG(safe_mode_gid) && dgid == php_getgid(TSRMLS_C)) { return 1; } else { if (SG(rfc1867_uploaded_files)) { @@ -186,9 +186,9 @@ if ((flags & CHECKUID_NO_ERRORS) == 0) { if (PG(safe_mode_gid)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "SAFE MODE Restriction in effect. The script whose uid/gid is %ld/%ld is not allowed to access %s owned by uid/gid %ld/%ld", php_getuid(), php_getgid(), filename, uid, gid); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "SAFE MODE Restriction in effect. The script whose uid/gid is %ld/%ld is not allowed to access %s owned by uid/gid %ld/%ld", php_getuid(TSRMLS_C), php_getgid(TSRMLS_C), filename, uid, gid); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "SAFE MODE Restriction in effect. The script whose uid is %ld is not allowed to access %s owned by uid %ld", php_getuid(), filename, uid); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "SAFE MODE Restriction in effect. The script whose uid is %ld is not allowed to access %s owned by uid %ld", php_getuid(TSRMLS_C), filename, uid); } }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php