summaryrefslogtreecommitdiff
path: root/source4/scripting/ejs
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-05-29 01:20:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:53:00 -0500
commit5fb459e4fa3201a3d5cbc22c5ff011bfc98a9519 (patch)
tree7bfef694058416ed31fcce643f65b04977fcd419 /source4/scripting/ejs
parentb8b580dbcb0468306b89e0a37589700dee6ca7b8 (diff)
downloadsamba-5fb459e4fa3201a3d5cbc22c5ff011bfc98a9519.tar.gz
samba-5fb459e4fa3201a3d5cbc22c5ff011bfc98a9519.tar.bz2
samba-5fb459e4fa3201a3d5cbc22c5ff011bfc98a9519.zip
r23177: Add in a new provision-backend script. This helps set up the OpenLDAP or Fedora DS backend.
This required a new mkdir() call in ejs. We can now provision just the schema for ad2oLschema to operate on (with provision_schema(), without performing the whole provision, just to wipe it again (adjustments to 'make test' to come soon). Andrew Bartlett (This used to be commit 01d54d13dc66ef2127ac52c64ede53d0790738ec)
Diffstat (limited to 'source4/scripting/ejs')
-rw-r--r--source4/scripting/ejs/smbcalls_sys.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c
index ce3f3f5a98..1b1affc80d 100644
--- a/source4/scripting/ejs/smbcalls_sys.c
+++ b/source4/scripting/ejs/smbcalls_sys.c
@@ -305,6 +305,33 @@ static int ejs_sys_file_save(MprVarHandle eid, int argc, char **argv)
return 0;
}
+/*
+ mkdir()
+ usage:
+ ok = sys.mkdir(dirname, mode);
+*/
+static int ejs_sys_mkdir(MprVarHandle eid, int argc, struct MprVar **argv)
+{
+ BOOL ret;
+ char *name;
+ if (argc != 2) {
+ ejsSetErrorMsg(eid, "sys_mkdir invalid arguments, need mkdir(dirname, mode)");
+ return -1;
+ }
+ if (!mprVarIsString(argv[0]->type)) {
+ ejsSetErrorMsg(eid, "sys_mkdir dirname not a string");
+ return -1;
+ }
+ if (!mprVarIsNumber(argv[1]->type)) {
+ ejsSetErrorMsg(eid, "sys_mkdir mode not a number");
+ return -1;
+ }
+ mprVarToString(&name, 0, NULL, argv[0]);
+ ret = mkdir(name, mprVarToNumber(argv[1]));
+ mpr_Return(eid, mprCreateBoolVar(ret == 0));
+ return 0;
+}
+
/*
return fields of a stat() call
@@ -438,6 +465,7 @@ static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv)
mprSetCFunction(obj, "ntgmtime", ejs_sys_ntgmtime);
mprSetCFunction(obj, "ldaptime", ejs_sys_ldaptime);
mprSetCFunction(obj, "httptime", ejs_sys_httptime);
+ mprSetCFunction(obj, "mkdir", ejs_sys_mkdir);
mprSetStringCFunction(obj, "unlink", ejs_sys_unlink);
mprSetStringCFunction(obj, "file_load", ejs_sys_file_load);
mprSetStringCFunction(obj, "file_save", ejs_sys_file_save);