--- parser3/src/classes/file.C 2009/05/13 07:36:04 1.188 +++ parser3/src/classes/file.C 2009/05/25 08:11:40 1.192 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_FILE_C="$Date: 2009/05/13 07:36:04 $"; +static const char * const IDENT_FILE_C="$Date: 2009/05/25 08:11:40 $"; #include "pa_config_includes.h" @@ -401,7 +401,7 @@ static void _exec_cgi(Request& r, Method if(value_cstr) \ env.put( \ String::Body(#name), \ - String::Body(value_cstr)); \ + String::Body(*value_cstr?value_cstr:0)); \ // passing SAPI::environment if(const char *const *pairs=SAPI::environment(r.sapi_info)) { while(const char* pair=*pairs++) @@ -616,19 +616,19 @@ static void _cgi(Request& r, MethodParam static void _list(Request& r, MethodParams& params) { Value& relative_path=params.as_no_junction(0, "path must not be code"); - VRegex* vregex; + VRegex* vregex=0; VRegexCleaner vrcleaner; if(params.count()>1){ Value& regexp=params.as_no_junction(1, "regexp must not be code"); - if(Value* value=regexp.as(VREGEX_TYPE, false)){ - vregex=static_cast(value); - } else { - vregex=new VRegex(r.charsets.source(), ®exp.as_string(), 0/*options*/); - vregex->study(); - vrcleaner.vregex=vregex; + if(regexp.is_defined()){ + if(Value* value=regexp.as(VREGEX_TYPE, false)){ + vregex=static_cast(value); + } else { + vregex=new VRegex(r.charsets.source(), ®exp.as_string(), 0/*options*/); + vregex->study(); + vrcleaner.vregex=vregex; + } } - } else { - vregex=0; } const char* absolute_path_cstr=r.absolute(relative_path.as_string()).cstr(String::L_FILE_SPEC); @@ -646,7 +646,7 @@ static void _list(Request& r, MethodPara if(!vregex || vregex->exec(ffblk.ff_name, file_name_size, ovector, ovector_size)>=0) { Table::element_type row(new ArrayString); - *row+=new String(pa_strdup(file_name_cstr, file_name_size), true/*tainted*/); + *row+=new String(pa_strdup(file_name_cstr, file_name_size), String::L_TAINTED); table+=row; } ); @@ -740,7 +740,7 @@ static void _dirname(Request& r, MethodP if(afterslash>0) r.write_assign_lang(file_spec.mid(0, afterslash==1?1:afterslash-1)); else - r.write_assign_lang(String(".", 1)); + r.write_assign_lang(String(".")); } static void _basename(Request& r, MethodParams& params) { @@ -827,11 +827,11 @@ public: break; case 1: if(!user_file_name) // user not specified? - user_file_name=new String(str, true); + user_file_name=new String(str, String::L_TAINTED); break; case 2: if(!user_content_type) // user not specified? - user_content_type=new String(str, true); + user_content_type=new String(str, String::L_TAINTED); break; default: error=SQL_Error(PARSER_RUNTIME, "result must not contain more then one row, three rows"); @@ -921,13 +921,13 @@ static void _base64(Request& r, MethodPa } else { // encode: ^f.base64[] const char* encoded=pa_base64_encode(self.value_ptr(), self.value_size()); - r.write_assign_lang(*new String(encoded, true/*tainted. once ?param=base64(something) was needed**/)); + r.write_assign_lang(*new String(encoded, String::L_TAINTED/*once ?param=base64(something) was needed**/)); } } else { // encode: ^file:base64[filespec] const String& file_spec=params.as_string(0, FILE_NAME_MUST_BE_STRING); const char* encoded=pa_base64_encode(r.absolute(file_spec)); - r.write_assign_lang(*new String(encoded, true/*tainted. once ?param=base64(something) was needed*/)); + r.write_assign_lang(*new String(encoded, String::L_TAINTED/*once ?param=base64(something) was needed*/)); } }