summaryrefslogtreecommitdiffstats
path: root/source4/scripting
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-07-13 08:01:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:01:05 -0500
commit10f6e1657303dabcf7dbbaed8547f0cb6e845a5d (patch)
tree71e7780b02d67cf16a11f1ac33a497a7ef35ba7a /source4/scripting
parent5c98bbe2f0a3ee60f5e9bdeb0588eebc7acc8ba2 (diff)
downloadsamba-10f6e1657303dabcf7dbbaed8547f0cb6e845a5d.tar.gz
samba-10f6e1657303dabcf7dbbaed8547f0cb6e845a5d.tar.xz
samba-10f6e1657303dabcf7dbbaed8547f0cb6e845a5d.zip
r23859: Work to have Group Policy work 'out of the box' in Samba4.
This involves creating the SYSVOL and NETLOGON shares at provision time, and creating the right subdirectories. This also changes the behaviour of lp.get("foo") in ejs - we now return undefined, rather than syntax error, if the parameter doesn't exist (perhaps because the share isn't defined). Andrew Bartlett (This used to be commit 45cadf3bc0d38f6600666511a392e1ce353adee7)
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/ejs/smbcalls_config.c41
-rw-r--r--source4/scripting/libjs/provision.js26
2 files changed, 57 insertions, 10 deletions
diff --git a/source4/scripting/ejs/smbcalls_config.c b/source4/scripting/ejs/smbcalls_config.c
index 64310c08fde..6f15ee5a4a7 100644
--- a/source4/scripting/ejs/smbcalls_config.c
+++ b/source4/scripting/ejs/smbcalls_config.c
@@ -89,7 +89,8 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
/* its a share parameter */
int snum = lp_servicenumber(argv[0]);
if (snum == -1) {
- return -1;
+ mpr_Return(eid, mprCreateUndefinedVar());
+ return 0;
}
if (strchr(argv[1], ':')) {
/* its a parametric option on a share */
@@ -98,16 +99,23 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
strcspn(argv[1], ":"));
const char *option = strchr(argv[1], ':') + 1;
const char *value;
- if (type == NULL || option == NULL) return -1;
+ if (type == NULL || option == NULL) {
+ mpr_Return(eid, mprCreateUndefinedVar());
+ return 0;
+ }
value = lp_get_parametric(snum, type, option);
- if (value == NULL) return -1;
+ if (value == NULL) {
+ mpr_Return(eid, mprCreateUndefinedVar());
+ return 0;
+ }
mpr_ReturnString(eid, value);
return 0;
}
parm = lp_parm_struct(argv[1]);
if (parm == NULL || parm->class == P_GLOBAL) {
- return -1;
+ mpr_Return(eid, mprCreateUndefinedVar());
+ return 0;
}
parm_ptr = lp_parm_ptr(snum, parm);
} else if (strchr(argv[0], ':')) {
@@ -116,20 +124,30 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
argv[0], strcspn(argv[0], ":"));
const char *option = strchr(argv[0], ':') + 1;
const char *value;
- if (type == NULL || option == NULL) return -1;
+ if (type == NULL || option == NULL) {
+ mpr_Return(eid, mprCreateUndefinedVar());
+ return 0;
+ }
value = lp_get_parametric(-1, type, option);
- if (value == NULL) return -1;
+ if (value == NULL) {
+ mpr_Return(eid, mprCreateUndefinedVar());
+ return 0;
+ }
mpr_ReturnString(eid, value);
return 0;
} else {
/* its a global parameter */
parm = lp_parm_struct(argv[0]);
- if (parm == NULL) return -1;
+ if (parm == NULL) {
+ mpr_Return(eid, mprCreateUndefinedVar());
+ return 0;
+ }
parm_ptr = lp_parm_ptr(-1, parm);
}
if (parm == NULL || parm_ptr == NULL) {
- return -1;
+ mpr_Return(eid, mprCreateUndefinedVar());
+ return 0;
}
/* construct and return the right type of ejs object */
@@ -142,6 +160,7 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
mpr_Return(eid, mprCreateBoolVar(*(BOOL *)parm_ptr));
break;
case P_INTEGER:
+ case P_OCTAL:
case P_BYTES:
mpr_Return(eid, mprCreateIntegerVar(*(int *)parm_ptr));
break;
@@ -152,12 +171,14 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
return 0;
}
}
- return -1;
+ mpr_Return(eid, mprCreateUndefinedVar());
+ return 0;
case P_LIST:
mpr_Return(eid, mprList(parm->label, *(const char ***)parm_ptr));
break;
case P_SEP:
- return -1;
+ mpr_Return(eid, mprCreateUndefinedVar());
+ return 0;
}
return 0;
}
diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js
index deaa97114af..c417d7b64b9 100644
--- a/source4/scripting/libjs/provision.js
+++ b/source4/scripting/libjs/provision.js
@@ -389,6 +389,19 @@ function provision_default_paths(subobj)
paths.ldap_basedn_ldif = paths.ldapdir + "/" + subobj.DNSDOMAIN + ".ldif";
paths.ldap_config_basedn_ldif = paths.ldapdir + "/" + subobj.DNSDOMAIN + "-config.ldif";
paths.ldap_schema_basedn_ldif = paths.ldapdir + "/" + subobj.DNSDOMAIN + "-schema.ldif";
+
+ paths.netlogon = lp.get("netlogon", "path");
+
+ if (paths.netlogon == undefined) {
+ paths.netlogon = lp.get("lock dir") + "/netlogon";
+ }
+
+ paths.sysvol = lp.get("sysvol", "path");
+
+ if (paths.sysvol == undefined) {
+ paths.sysvol = lp.get("lock dir") + "/sysvol";
+ }
+
return paths;
}
@@ -466,6 +479,9 @@ function provision_fix_subobj(subobj, paths)
subobj.LDAPMANAGERDN = "cn=Manager," + subobj.DOMAINDN;
+ subobj.NETLOGONPATH = paths.netlogon;
+ subobj.SYSVOLPATH = paths.sysvol;
+
return true;
}
@@ -703,6 +719,16 @@ function provision(subobj, message, blank, paths, session_info, credentials, lda
if (lp.get("server role") == "domain controller") {
message("Setting up self join\n");
setup_add_ldif("provision_self_join.ldif", info, samdb, false);
+ setup_add_ldif("provision_group_policy.ldif", info, samdb, false);
+
+ sys.mkdir(paths.sysvol, 0755);
+ sys.mkdir(paths.sysvol + "/"+ subobj.DNSDOMAIN, 0755);
+ sys.mkdir(paths.sysvol + "/"+ subobj.DNSDOMAIN + "/Policies", 0755);
+ sys.mkdir(paths.sysvol + "/"+ subobj.DNSDOMAIN + "/Policies/{" + subobj.POLICYGUID + "}", 0755);
+ sys.mkdir(paths.sysvol + "/"+ subobj.DNSDOMAIN + "/Policies/{" + subobj.POLICYGUID + "}/Machine", 0755);
+ sys.mkdir(paths.sysvol + "/"+ subobj.DNSDOMAIN + "/Policies/{" + subobj.POLICYGUID + "}/User", 0755);
+
+ sys.mkdir(paths.netlogon, 0755);
}
if (setup_name_mappings(info, samdb) == false) {