|
|
| version 1.71, 2013/08/22 14:35:30 | version 1.76, 2015/06/02 18:46:05 |
|---|---|
| Line 70 static void math1(Request& r, MethodPara | Line 70 static void math1(Request& r, MethodPara |
| static void _##name(Request& r, MethodParams& params) {\ | static void _##name(Request& r, MethodParams& params) {\ |
| math1(r, params, &name);\ | math1(r, params, &name);\ |
| } | } |
| #define MATH1P(name_parser, name_c) \ | #define MATH1P(name_parser, name_c) \ |
| static void _##name_parser(Request& r, MethodParams& params) {\ | static void _##name_parser(Request& r, MethodParams& params) {\ |
| math1(r, params, &name_c);\ | math1(r, params, &name_c);\ |
| } | } |
| MATH1(round); MATH1(floor); MATH1P(ceiling, ceil); | |
| MATH1(trunc); MATH1(frac); | MATH1(round) |
| MATH1P(abs, fabs); MATH1(sign); | MATH1(floor) |
| MATH1(exp); | MATH1P(ceiling, ceil) |
| MATH1(log); MATH1(log10); | MATH1(trunc) |
| MATH1(sin); MATH1(asin); | MATH1(frac) |
| MATH1(cos); MATH1(acos); | MATH1P(abs, fabs) |
| MATH1(tan); MATH1(atan); | MATH1(sign) |
| MATH1(degrees); MATH1(radians); | MATH1(exp) |
| MATH1(sqrt); | MATH1(log) |
| MATH1(log10) | |
| MATH1(sin) | |
| MATH1(asin) | |
| MATH1(cos) | |
| MATH1(acos) | |
| MATH1(tan) | |
| MATH1(atan) | |
| MATH1(degrees) | |
| MATH1(radians) | |
| MATH1(sqrt) | |
| typedef double (*math2_func_ptr)(double, double); | typedef double (*math2_func_ptr)(double, double); |
| Line 98 static void math2(Request& r, MethodPara | Line 109 static void math2(Request& r, MethodPara |
| static void _##name(Request& r, MethodParams& params) {\ | static void _##name(Request& r, MethodParams& params) {\ |
| math2(r, params, &name);\ | math2(r, params, &name);\ |
| } | } |
| MATH2(pow); | |
| MATH2(pow) | |
| inline bool is_salt_body_char(int c) { | inline bool is_salt_body_char(int c) { |
| return isalnum(c) || c == '.' || c=='/'; | return pa_isalnum(c) || c == '.' || c=='/'; |
| } | } |
| static size_t calc_prefix_size(const char* salt) { | static size_t calc_prefix_size(const char* salt) { |
| if(strlen(salt)) { | if(strlen(salt)) { |
| Line 164 static void _crypt(Request& r, MethodPar | Line 176 static void _crypt(Request& r, MethodPar |
| } | } |
| static void _md5(Request& r, MethodParams& params) { | static void _md5(Request& r, MethodParams& params) { |
| const char *string=params.as_string(0, PARAMETER_MUST_BE_STRING).cstr_to_string_body_untaint(String::L_AS_IS).cstr(); | const char *string=params.as_string(0, PARAMETER_MUST_BE_STRING).cstr_to_string_body_untaint(String::L_AS_IS, r.connection(false), &r.charsets).cstr(); |
| PA_MD5_CTX context; | PA_MD5_CTX context; |
| unsigned char digest[16]; | unsigned char digest[16]; |
| Line 316 void SHA1ReadDigest(void *buf, SHA1Conte | Line 328 void SHA1ReadDigest(void *buf, SHA1Conte |
| } | } |
| static void _sha1(Request& r, MethodParams& params) { | static void _sha1(Request& r, MethodParams& params) { |
| const char *string = params.as_string(0, PARAMETER_MUST_BE_STRING).cstr_to_string_body_untaint(String::L_AS_IS).cstr(); | const char *string = params.as_string(0, PARAMETER_MUST_BE_STRING).cstr_to_string_body_untaint(String::L_AS_IS, r.connection(false), &r.charsets).cstr(); |
| SHA1Context c; | SHA1Context c; |
| unsigned char digest[20]; | unsigned char digest[20]; |
| Line 368 static void _digest(Request& r, MethodPa | Line 380 static void _digest(Request& r, MethodPa |
| String::C data; | String::C data; |
| if(const String* sdata=vdata.get_string()){ | if(const String* sdata=vdata.get_string()){ |
| String::Body body=sdata->cstr_to_string_body_untaint(String::L_AS_IS); // explode content, honor tainting changes | String::Body body=sdata->cstr_to_string_body_untaint(String::L_AS_IS, r.connection(false), &r.charsets); // explode content, honor tainting changes |
| data=String::C(body.cstr(), body.length()); | data=String::C(body.cstr(), body.length()); |
| } else { | } else { |
| VFile *file=vdata.as_vfile(String::L_AS_IS); | VFile *file=vdata.as_vfile(String::L_AS_IS); |