|
|
| version 1.115.2.12.2.18, 2003/03/27 10:53:01 | version 1.115.2.12.2.21, 2003/04/08 07:55:25 |
|---|---|
| Line 17 static const char* IDENT_UNTAINT_C="$Dat | Line 17 static const char* IDENT_UNTAINT_C="$Dat |
| #include "pa_common.h" | #include "pa_common.h" |
| #include "pa_charset.h" | #include "pa_charset.h" |
| #include "pa_request_charsets.h" | #include "pa_request_charsets.h" |
| #include "pa_sapi.h" | |
| extern "C" { // author forgot to do that | extern "C" { // author forgot to do that |
| #include "ec.h" | #include "ec.h" |
| Line 28 extern "C" { // author forgot to do that | Line 29 extern "C" { // author forgot to do that |
| #include "pa_sql_connection.h" | #include "pa_sql_connection.h" |
| #endif | #endif |
| // forwards | |
| void CORD_ec_flush_buf_optimize_whitespace(CORD_ec x); | |
| // defines | // defines |
| Line 265 inline void ec_append(CORD_ec& result, b | Line 262 inline void ec_append(CORD_ec& result, b |
| CORD_next(pos); | CORD_next(pos); |
| } | } |
| } | } |
| inline void pa_CORD_pos_advance(CORD_pos& pos, size_t size) { | |
| while(true) { | |
| size_t avail=CORD_pos_chars_left(pos); | |
| if(avail==0) { | |
| CORD_next(pos); | |
| if(!--size) | |
| break; | |
| } else if(avail<size) { | |
| CORD_pos_advance(pos, avail); | |
| size-=avail; | |
| } else { // avail>=size | |
| CORD_pos_advance(pos, size); | |
| break; | |
| } | |
| } | |
| } | |
| StringBody String::cstr_to_string_body(Language lang, | StringBody String::cstr_to_string_body(Language lang, |
| SQL_Connection* connection, | SQL_Connection* connection, |
| const Request_charsets *charsets) const { | const Request_charsets *charsets) const { |
| Line 285 StringBody String::cstr_to_string_body(L | Line 298 StringBody String::cstr_to_string_body(L |
| bool optimize=(to_lang & L_OPTIMIZE_BIT)!=0; | bool optimize=(to_lang & L_OPTIMIZE_BIT)!=0; |
| if(!optimize) | if(!optimize) |
| whitespace=false; | whitespace=false; |
| switch(to_lang & ~L_OPTIMIZE_BIT) { | switch(to_lang & ~L_OPTIMIZE_BIT) { |
| case L_CLEAN: | case L_CLEAN: |
| case L_TAINTED: | case L_TAINTED: |
| Line 315 StringBody String::cstr_to_string_body(L | Line 328 StringBody String::cstr_to_string_body(L |
| { | { |
| const char *fragment_str=body.mid(fragment_begin, fragment_length).cstr(); | const char *fragment_str=body.mid(fragment_begin, fragment_length).cstr(); |
| // skip source [we use recoded version] | // skip source [we use recoded version] |
| CORD_pos_advance(pos, fragment_length); | pa_CORD_pos_advance(pos, fragment_length); |
| const void *client_ptr; | const void *client_ptr; |
| size_t client_size; | size_t client_size; |
| if(charsets) | if(charsets) |
| Line 346 StringBody String::cstr_to_string_body(L | Line 359 StringBody String::cstr_to_string_body(L |
| const char *mail_ptr= | const char *mail_ptr= |
| body.mid(fragment_begin, mail_size=fragment_length).cstr(); | body.mid(fragment_begin, mail_size=fragment_length).cstr(); |
| // skip source [we use recoded version] | // skip source [we use recoded version] |
| CORD_pos_advance(pos, mail_size); | pa_CORD_pos_advance(pos, mail_size); |
| const char* charset_name=charsets->mail().name().cstr(); | const char* charset_name=charsets->mail().name().cstr(); |
| Line 398 StringBody String::cstr_to_string_body(L | Line 411 StringBody String::cstr_to_string_body(L |
| if(connection) { | if(connection) { |
| const char *fragment_str=body.mid(fragment_begin, fragment_length).cstr(); | const char *fragment_str=body.mid(fragment_begin, fragment_length).cstr(); |
| // skip source [we use recoded version] | // skip source [we use recoded version] |
| CORD_pos_advance(pos, fragment_length); | pa_CORD_pos_advance(pos, fragment_length); |
| to_string(connection->quote(fragment_str, fragment_length)); | to_string(connection->quote(fragment_str, fragment_length)); |
| } else | } else |
| Line 437 StringBody String::cstr_to_string_body(L | Line 450 StringBody String::cstr_to_string_body(L |
| }); | }); |
| break; | break; |
| default: | default: |
| throw Exception(0, | SAPI::die("unknown untaint language #%d", |
| 0, | static_cast<int>(to_lang)); // should never |
| "unknown untaint language #%d", | |
| static_cast<int>(to_lang)); // should never | |
| break; // never | break; // never |
| } | } |
| } | } |