[PHP4BETA] cvs: /php4 configuration-parser.y main.c /php4/ext/standard basic_functions.c basic_functions.h From: Zeev Suraski (zeev <email protected>)
Date: 01/30/00

zeev Sun Jan 30 21:32:11 2000 EDT

  Modified files:
    /php4 configuration-parser.y main.c
    /php4/ext/standard basic_functions.c basic_functions.h
  Log:
  Initial work on the protected env vars stuff
  
  
Index: php4/configuration-parser.y
diff -u php4/configuration-parser.y:1.29 php4/configuration-parser.y:1.30
--- php4/configuration-parser.y:1.29 Mon Jan 17 18:33:20 2000
+++ php4/configuration-parser.y Sun Jan 30 21:31:40 2000
@@ -19,7 +19,7 @@
 
 
 
-/* $Id: configuration-parser.y,v 1.29 2000/01/17 17:33:20 zeev Exp $ */
+/* $Id: configuration-parser.y,v 1.30 2000/01/30 20:31:40 zeev Exp $ */
 
 #define DEBUG_CFG_PARSER 0
 #include "php.h"
@@ -48,7 +48,7 @@
 extern HashTable browser_hash;
 PHPAPI extern char *php_ini_path;
 #endif
-static HashTable *activezend_hash_table;
+static HashTable *active_hash_table;
 static pval *current_section;
 static char *currently_parsed_filename;
 
@@ -226,7 +226,7 @@
                 }
                         
                 init_cfg_scanner();
- activezend_hash_table = &configuration_hash;
+ active_hash_table = &configuration_hash;
                 parsing_mode = PARSING_MODE_CFG;
                 currently_parsed_filename = "php.ini";
                 yyparse();
@@ -254,7 +254,7 @@
                         return FAILURE;
                 }
                 init_cfg_scanner();
- activezend_hash_table = &browser_hash;
+ active_hash_table = &browser_hash;
                 parsing_mode = PARSING_MODE_BROWSCAP;
                 currently_parsed_filename = browscap;
                 yyparse();
@@ -410,10 +410,10 @@
 #endif
                         $3.type = IS_STRING;
                         if (parsing_mode==PARSING_MODE_CFG) {
- zend_hash_update(activezend_hash_table, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(pval), NULL);
- if (activezend_hash_table == &configuration_hash) {
- php_alter_ini_entry($1.value.str.val, $1.value.str.len+1, $3.value.str.val, $3.value.str.len+1, PHP_INI_SYSTEM);
- }
+ zend_hash_update(active_hash_table, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(pval), NULL);
+ if (active_hash_table == &configuration_hash) {
+ php_alter_ini_entry($1.value.str.val, $1.value.str.len+1, $3.value.str.val, $3.value.str.len+1, PHP_INI_SYSTEM);
+ }
                         } else if (parsing_mode==PARSING_MODE_BROWSCAP) {
                                 zend_str_tolower($1.value.str.val,$1.value.str.len);
                                 zend_hash_update(current_section->value.ht, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(pval), NULL);
@@ -461,7 +461,7 @@
                                 tmp.value.ht = (HashTable *) malloc(sizeof(HashTable));
                                 zend_hash_init(tmp.value.ht, 0, NULL, (void (*)(void *))pvalue_config_destructor, 1);
                                 tmp.type = IS_OBJECT;
- zend_hash_update(activezend_hash_table, $1.value.str.val, $1.value.str.len+1, (void *) &tmp, sizeof(pval), (void **) &current_section);
+ zend_hash_update(active_hash_table, $1.value.str.val, $1.value.str.len+1, (void *) &tmp, sizeof(pval), (void **) &current_section);
                                 tmp.value.str.val = zend_strndup($1.value.str.val,$1.value.str.len);
                                 tmp.value.str.len = $1.value.str.len;
                                 tmp.type = IS_STRING;
Index: php4/main.c
diff -u php4/main.c:1.188 php4/main.c:1.189
--- php4/main.c:1.188 Sat Jan 29 13:57:08 2000
+++ php4/main.c Sun Jan 30 21:31:40 2000
@@ -19,7 +19,7 @@
 */
 
 
-/* $Id: main.c,v 1.188 2000/01/29 12:57:08 zeev Exp $ */
+/* $Id: main.c,v 1.189 2000/01/30 20:31:40 zeev Exp $ */
 
 
 #include <stdio.h>
@@ -209,6 +209,7 @@
         STD_PHP_INI_ENTRY("safe_mode_exec_dir", "1", PHP_INI_SYSTEM, OnUpdateString, safe_mode_exec_dir, php_core_globals, core_globals)
         STD_PHP_INI_BOOLEAN("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateBool, enable_dl, php_core_globals, core_globals)
         STD_PHP_INI_BOOLEAN("expose_php", "1", PHP_INI_SYSTEM, OnUpdateBool, expose_php, php_core_globals, core_globals)
+
 
         PHP_INI_ENTRY("SMTP", "localhost", PHP_INI_ALL, NULL)
         PHP_INI_ENTRY("sendmail_path", DEFAULT_SENDMAIL_PATH, PHP_INI_SYSTEM, NULL)
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.149 php4/ext/standard/basic_functions.c:1.150
--- php4/ext/standard/basic_functions.c:1.149 Mon Jan 17 18:33:20 2000
+++ php4/ext/standard/basic_functions.c Sun Jan 30 21:31:41 2000
@@ -307,9 +307,14 @@
 };
 
 
+static PHP_INI_MH(OnUpdateSafeModeProtectedEnvVars)
+{
+ return SUCCESS;
+}
+
+
 PHP_INI_BEGIN()
- PHP_INI_ENTRY1("highlight.string", "#foobar", PHP_INI_ALL, NULL, NULL)
- PHP_INI_ENTRY1("test2", "testing", PHP_INI_SYSTEM, NULL, NULL)
+ PHP_INI_ENTRY_EX("safe_mode_protected_env_vars", SAFE_MODE_PROTECTED_ENV_VARS, PHP_INI_SYSTEM, OnUpdateSafeModeProtectedEnvVars, NULL)
 PHP_INI_END()
 
 
Index: php4/ext/standard/basic_functions.h
diff -u php4/ext/standard/basic_functions.h:1.39 php4/ext/standard/basic_functions.h:1.40
--- php4/ext/standard/basic_functions.h:1.39 Sun Dec 26 01:18:44 1999
+++ php4/ext/standard/basic_functions.h Sun Jan 30 21:31:41 2000
@@ -29,7 +29,7 @@
  */
 
 
-/* $Id: basic_functions.h,v 1.39 1999/12/26 00:18:44 zeev Exp $ */
+/* $Id: basic_functions.h,v 1.40 2000/01/30 20:31:41 zeev Exp $ */
 
 #ifndef _BASIC_FUNCTIONS_H
 #define _BASIC_FUNCTIONS_H
@@ -136,6 +136,8 @@
         zval **array_walk_func_name;
         zval **user_compare_func_name;
         
+ HashTable protected_env_vars;
+
         /* pageinfo.c */
         long page_uid;
         long page_inode;
@@ -179,5 +181,11 @@
         int key_len;
 } putenv_entry;
 #endif
+
+/* Values are coma-delimited
+ * All variables, beginning with the following prefixes, will be protected
+ * from change by the PHP runtime function putenv()
+ */
+#define SAFE_MODE_PROTECTED_ENV_VARS "LD_"
 
 #endif /* _BASIC_FUNCTIONS_H */

-- 
PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
To unsubscribe, e-mail: php4beta-unsubscribe <email protected>
For additional commands, e-mail: php4beta-help <email protected>
To contact the list administrators, e-mail: php4beta-admin <email protected>