svn commit: samba r8640 - in branches/SAMBA_4_0:
source/scripting/ejs source/scripting/libjs swat/install
tridge at samba.org
tridge at samba.org
Wed Jul 20 07:29:24 GMT 2005
Author: tridge
Date: 2005-07-20 07:29:23 +0000 (Wed, 20 Jul 2005)
New Revision: 8640
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8640
Log:
continue the trend by moving the ejs random calls into an object
Modified:
branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rand.c
branches/SAMBA_4_0/source/scripting/libjs/provision.js
branches/SAMBA_4_0/swat/install/newuser.esp
Changeset:
Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rand.c
===================================================================
--- branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rand.c 2005-07-20 07:20:03 UTC (rev 8639)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rand.c 2005-07-20 07:29:23 UTC (rev 8640)
@@ -81,12 +81,23 @@
}
/*
+ 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);
}
Modified: branches/SAMBA_4_0/source/scripting/libjs/provision.js
===================================================================
--- branches/SAMBA_4_0/source/scripting/libjs/provision.js 2005-07-20 07:20:03 UTC (rev 8639)
+++ branches/SAMBA_4_0/source/scripting/libjs/provision.js 2005-07-20 07:29:23 UTC (rev 8640)
@@ -224,6 +224,7 @@
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 @@
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);
Modified: branches/SAMBA_4_0/swat/install/newuser.esp
===================================================================
--- branches/SAMBA_4_0/swat/install/newuser.esp 2005-07-20 07:20:03 UTC (rev 8639)
+++ branches/SAMBA_4_0/swat/install/newuser.esp 2005-07-20 07:29:23 UTC (rev 8640)
@@ -9,6 +9,7 @@
<%
var f = FormObj("newuser", 3, 2);
var i;
+var rand = random_init();
f.element[0].label = "User Name";
f.element[0].name = "USERNAME";
@@ -29,7 +30,7 @@
form.UNIXNAME = form.USERNAME;
}
if (form.PASSWORD == undefined) {
- form.PASSWORD = randpass();
+ form.PASSWORD = rand.randpass();
}
newuser(form.USERNAME, form.UNIXNAME, form.PASSWORD, writefln);
} else {
More information about the samba-cvs
mailing list