diff options
author | Andrew Bartlett <abartlet@samba.org> | 2007-07-13 08:01:36 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:01:05 -0500 |
commit | 10f6e1657303dabcf7dbbaed8547f0cb6e845a5d (patch) | |
tree | 71e7780b02d67cf16a11f1ac33a497a7ef35ba7a /source4/scripting/ejs | |
parent | 5c98bbe2f0a3ee60f5e9bdeb0588eebc7acc8ba2 (diff) | |
download | samba-10f6e1657303dabcf7dbbaed8547f0cb6e845a5d.tar.gz samba-10f6e1657303dabcf7dbbaed8547f0cb6e845a5d.tar.bz2 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/ejs')
-rw-r--r-- | source4/scripting/ejs/smbcalls_config.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/source4/scripting/ejs/smbcalls_config.c b/source4/scripting/ejs/smbcalls_config.c index 64310c08fd..6f15ee5a4a 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; } |