mirror of
https://github.com/samba-team/samba.git
synced 2025-11-12 04:23:49 +03:00
r8640: continue the trend by moving the ejs random calls into an object
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
2dc493eea6
commit
ed4fb68ef7
@@ -80,13 +80,24 @@ static int ejs_randsid(MprVarHandle eid, int argc, struct MprVar **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
initialise random ejs subsystem
|
||||
*/
|
||||
static int ejs_random_init(MprVarHandle eid, int argc, struct MprVar **argv)
|
||||
{
|
||||
struct MprVar *obj = mprInitObject(eid, "random", argc, argv);
|
||||
|
||||
mprSetCFunction(obj, "random", ejs_random);
|
||||
mprSetCFunction(obj, "randpass", ejs_randpass);
|
||||
mprSetCFunction(obj, "randguid", ejs_randguid);
|
||||
mprSetCFunction(obj, "randsid", ejs_randsid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
setup C functions that be called from ejs
|
||||
*/
|
||||
void smb_setup_ejs_random(void)
|
||||
{
|
||||
ejsDefineCFunction(-1, "random", ejs_random, NULL, MPR_VAR_SCRIPT_HANDLE);
|
||||
ejsDefineCFunction(-1, "randpass", ejs_randpass, NULL, MPR_VAR_SCRIPT_HANDLE);
|
||||
ejsDefineCFunction(-1, "randguid", ejs_randguid, NULL, MPR_VAR_SCRIPT_HANDLE);
|
||||
ejsDefineCFunction(-1, "randsid", ejs_randsid, NULL, MPR_VAR_SCRIPT_HANDLE);
|
||||
ejsDefineCFunction(-1, "random_init", ejs_random_init, NULL, MPR_VAR_SCRIPT_HANDLE);
|
||||
}
|
||||
|
||||
@@ -224,6 +224,7 @@ function provision_guess()
|
||||
var subobj = new Object();
|
||||
var nss = nss_init();
|
||||
var lp = loadparm_init();
|
||||
random_init(local);
|
||||
|
||||
subobj.REALM = lp.get("realm");
|
||||
subobj.DOMAIN = lp.get("workgroup");
|
||||
@@ -277,6 +278,7 @@ function newuser(username, unixname, password, message)
|
||||
var lp = loadparm_init();
|
||||
var samdb = lp.get("sam database");
|
||||
var ldb = ldb_init();
|
||||
random_init(local);
|
||||
|
||||
/* connect to the sam */
|
||||
var ok = ldb.connect(samdb);
|
||||
|
||||
Reference in New Issue
Block a user