--- parser3/src/classes/file.C 2001/04/03 07:54:24 1.16 +++ parser3/src/classes/file.C 2001/04/05 18:22:56 1.19 @@ -1,9 +1,11 @@ -/* - Parser +/** @file + Parser: @b file parser class. + Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexander Petrosyan (http://design.ru/paf) - $Id: file.C,v 1.16 2001/04/03 07:54:24 paf Exp $ + $Id: file.C,v 1.19 2001/04/05 18:22:56 paf Exp $ */ #include "pa_request.h" @@ -27,15 +29,10 @@ static void _save(Request& r, const Stri // forcing // ^save[this body type] r.fail_if_junction_(true, vfile_name, - method_name, "file name must not be junction"); - - // forcing untaint language - String lfile_name(pool); - lfile_name.append(vfile_name.as_string(), - String::UL_FILE_NAME, true); + method_name, "file name must not be code"); // save - static_cast(r.self)->save(r.absolute(lfile_name)); + static_cast(r.self)->save(r.absolute(vfile_name.as_string())); } static void _delete(Request& r, const String& method_name, Array *params) { @@ -44,15 +41,10 @@ static void _delete(Request& r, const St // forcing // ^delete[this body type] r.fail_if_junction_(true, vfile_name, - method_name, "file name must not be junction"); + method_name, "file name must not be code"); - // forcing untaint language - String lfile_name(pool); - lfile_name.append(vfile_name.as_string(), - String::UL_FILE_NAME, true); - // unlink - file_delete(pool, r.absolute(lfile_name)); + file_delete(pool, r.absolute(vfile_name.as_string())); } static void _find(Request& r, const String& method_name, Array *params) { @@ -61,12 +53,9 @@ static void _find(Request& r, const Stri // forcing // ^delete[this body type] r.fail_if_junction_(true, vfile_name, - method_name, "file name must not be junction"); + method_name, "file name must not be code"); - // forcing untaint language - String lfile_name(pool); - lfile_name.append(vfile_name.as_string(), - String::UL_FILE_NAME, true); + const String &lfile_name=vfile_name.as_string(); // passed file name simply exists in current dir if(file_readable(r.absolute(lfile_name))) { @@ -91,7 +80,7 @@ static void _find(Request& r, const Stri // forcing ..{this body type} Value& not_found_code=*static_cast(params->get(1)); r.fail_if_junction_(false, not_found_code, - method_name, "not-found param must be junction"); + method_name, "not-found param must be code"); r.write_pass_lang(r.process(not_found_code)); } } @@ -102,17 +91,14 @@ static void _load(Request& r, const Stri // forcing ^load[this body type] r.fail_if_junction_(true, vfile_name, - method_name, "file name must not be junction"); + method_name, "file name must not be code"); - // forcing untaint language - String lfile_name(pool); - lfile_name.append(vfile_name.as_string(), - String::UL_FILE_NAME, true); + const String& lfile_name=vfile_name.as_string(); void *data; size_t size; file_read(pool, r.absolute(lfile_name), data, size, false/*binary*/); - char *user_file_name=params->size()==1?lfile_name.cstr() + char *user_file_name=params->size()==1?lfile_name.cstr(String::UL_FILE_NAME) :static_cast(params->get(1))->as_string().cstr(); const String *mime_type=0;