--- parser3/src/main/untaint.C 2003/11/25 15:04:21 1.125 +++ parser3/src/main/untaint.C 2004/02/11 15:33:16 1.129 @@ -1,11 +1,11 @@ /** @file Parser: String class part: untaint mechanizm. - Copyright(c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) + Copyright(c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_UNTAINT_C="$Date: 2003/11/25 15:04:21 $"; +static const char * const IDENT_UNTAINT_C="$Date: 2004/02/11 15:33:16 $"; #include "pa_string.h" @@ -23,15 +23,10 @@ extern "C" { // author forgot to do that #include "ec.h" } -#define PA_SQL - -#ifdef PA_SQL #include "pa_sql_connection.h" -#endif // defines - #undef CORD_ec_append // redefining to intercept flushes and implement whitespace optimization // of all consequent white space chars leaving only first one @@ -72,8 +67,8 @@ extern "C" { // author forgot to do that CORD_ec_append(info->result, hex[((unsigned char)c)%0x10]); \ } else \ CORD_ec_append(info->result, otherwise); -#define to_char(c) CORD_ec_append(info->result, c) -#define to_string(s) CORD_ec_append_cord(info->result, s) +#define to_char(c) { CORD_ec_append(info->result, c); whitespace=false; } +#define to_string(s) { CORD_ec_append_cord(info->result, s); whitespace=false; } inline bool need_file_encode(unsigned char c){ // russian letters and space ENABLED @@ -412,7 +407,6 @@ int cstr_to_string_body_block(char alang _default; }); break; -#ifdef PA_SQL case String::L_SQL: // tainted, untaint language: sql if(info->connection) { @@ -426,7 +420,6 @@ int cstr_to_string_body_block(char alang 0, "untaint in SQL language failed - no connection specified"); break; -#endif case String::L_JS: escape(switch(c) { case '"': to_string("\\\""); break; @@ -457,8 +450,7 @@ int cstr_to_string_body_block(char alang }); break; default: - assert(!"should never"); - SAPI::die("unknown untaint language #%d", + SAPI::abort("unknown untaint language #%d", static_cast(to_lang)); // should never break; // never }