--- parser3/src/classes/math.C 2006/11/01 17:43:43 1.42 +++ parser3/src/classes/math.C 2007/04/23 16:31:11 1.46 @@ -8,7 +8,7 @@ Copyright (C) 1996, 1997, 1998, 1999 Theodore Ts'o. */ -static const char * const IDENT_MATH_C="$Date: 2006/11/01 17:43:43 $"; +static const char * const IDENT_MATH_C="$Date: 2007/04/23 16:31:11 $"; #include "pa_vmethod_frame.h" #include "pa_common.h" @@ -166,7 +166,7 @@ static inline int _random(uint top) { static void _random(Request& r, MethodParams& params) { double top=params.as_double(0, "range must be expression", r); if(top<=0 || top>MAX_UINT) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "top(%g) must be [1..%u]", top, MAX_UINT); @@ -196,7 +196,8 @@ static void math1(Request& r, MethodPara MATH1(round); MATH1(floor); MATH1P(ceiling, ceil); MATH1(trunc); MATH1(frac); MATH1P(abs, fabs); MATH1(sign); -MATH1(exp); MATH1(log); +MATH1(exp); +MATH1(log); MATH1P(ln, log); MATH1P(lg, log10); MATH1(sin); MATH1(asin); MATH1(cos); MATH1(acos); MATH1(tan); MATH1(atan); @@ -268,40 +269,22 @@ static void _crypt(Request& r, MethodPar if(!static_sample_buf // nothing generated || !static_sample_buf[0] // generated nothing || strncmp(static_sample_buf, normal_salt, prefix_size)!=0) // salt prefix not preserved - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "crypt on this platform does not support '%.*s' salt prefix", prefix_size, normal_salt); r.write_pass_lang(String(pa_strdup(static_sample_buf))); #else - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "salt must start with '" PA_MD5PW_ID "'"); #endif } } -static const char* hex_string(unsigned char* bytes, size_t size, bool upcase) { - char *bytes_hex=new(PointerFreeGC) char [size*2/*byte->hh*/+1/*for zero-teminator*/]; - unsigned char *src=bytes; - unsigned char *end=bytes+size; - char *dest=bytes_hex; - - const char *hex=upcase?"0123456789ABCDEF":"0123456789abcdef"; - - for(; src