pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:3200:    }    }    pop_n_elems(args);    INACCURATE_GETTIMEOFDAY(&ret);    push_int(ret.tv_sec);   }      /*! @decl string(46..122) crypt(string(1..255) password)    *! @decl int(0..1) crypt(string(1..255) input_password, @    *! string(46..122) crypted_password) +  *! @decl string(46..122) crypt()    *!    *! This function crypts and verifies a short string (only the first    *! 8 characters are significant).    *!    *! The first syntax crypts the string @[password] into something that    *! is hopefully hard to decrypt.    *!    *! The second syntax is used to verify @[typed_password] against    *! @[crypted_password], and returns @expr{1@} if they match, and    *! @expr{0@} (zero) otherwise.    *! -  +  *! The third syntax generates a random string and then crypts it, +  *! creating a string useful as a password. +  *!    *! @note    *! Note that strings containing null characters will only be    *! processed up until the null character.    */   PMOD_EXPORT void f_crypt(INT32 args)   {    char salt[2];    char *ret, *pwd, *saltp = NULL;    char *alphabet =    "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";    -  get_all_args("crypt", args, "%s.%s", &pwd, &saltp); +  get_all_args("crypt", args, ".%s%s", &pwd, &saltp);    -  +  if( !pwd ) +  { +  do { +  push_random_string(16); +  push_constant_text("\0"); +  f_minus(2); +  } while(Pike_sp[-1].u.string->len<8); +  } +     if(saltp)    {    if( Pike_sp[1-args].u.string->len < 2 )    {    pop_n_elems(args);    push_int(0);    return;    }    } else {    struct svalue *random =
pike.git/src/builtin_functions.c:9398:       ADD_EFUN("compile", f_compile,    tFunc(tStr tOr(tObj, tVoid) tOr(tInt, tVoid) tOr(tInt, tVoid) tOr(tPrg(tObj), tVoid) tOr(tObj, tVoid) ,tPrg(tObj)),    OPT_EXTERNAL_DEPEND);       /* function(1=mixed:1) */    ADD_EFUN("copy_value",f_copy_value,tFunc(tSetvar(1,tMix),tVar(1)),0);       /* function(string:string)|function(string,string:int) */    ADD_EFUN("crypt",f_crypt, -  tOr(tFunc(tStr,tStr7),tFunc(tStr tStr,tInt01)),OPT_EXTERNAL_DEPEND); +  tOr(tFunc(tOr(tStr,tVoid),tStr7),tFunc(tStr tStr,tInt01)),OPT_EXTERNAL_DEPEND);       /* function(object|void:void) */    ADD_EFUN("destruct",f_destruct,tFunc(tOr(tObj,tVoid),tVoid),OPT_SIDE_EFFECT);       /* function(mixed,mixed:int) */    ADD_EFUN("equal",f_equal,tFunc(tMix tMix,tInt01),OPT_TRY_OPTIMIZE);       /* function(array(0=mixed),int|void,int|void:array(0)) */    ADD_FUNCTION2("everynth",f_everynth,    tFunc(tArr(tSetvar(0,tMix)) tOr(tInt,tVoid) tOr(tInt,tVoid),