diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-01-05 21:27:24 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:37:03 -0500 |
commit | 46908530bc39e0ba3742650639b35a6d0c32852b (patch) | |
tree | 10579634d026d9c04ccb5bcc434e4654812eb260 /source4/scripting | |
parent | a95d58ae8f45089e74099f707450a73432792ed9 (diff) | |
download | samba-46908530bc39e0ba3742650639b35a6d0c32852b.tar.gz samba-46908530bc39e0ba3742650639b35a6d0c32852b.tar.bz2 samba-46908530bc39e0ba3742650639b35a6d0c32852b.zip |
r20572: - prepare a test_samdb.ldb in the NET-API-BECOME-DC torture test
- we call a ejs script from the torture test for this task
so that we can use the provision template ldif's.
metze
(This used to be commit e84b0c7d4004df312ae58ed76dd708a2c3c37986)
Diffstat (limited to 'source4/scripting')
-rw-r--r-- | source4/scripting/libjs/provision.js | 59 |
1 files changed, 47 insertions, 12 deletions
diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js index 772505f569..1ef569c908 100644 --- a/source4/scripting/libjs/provision.js +++ b/source4/scripting/libjs/provision.js @@ -431,6 +431,50 @@ function setup_name_mappings(info, ldb) return true; } +function provision_fix_subobj(subobj, message) +{ + subobj.REALM = strupper(subobj.REALM); + subobj.HOSTNAME = strlower(subobj.HOSTNAME); + subobj.DOMAIN = strupper(subobj.DOMAIN); + assert(valid_netbios_name(subobj.DOMAIN)); + subobj.NETBIOSNAME = strupper(subobj.HOSTNAME); + assert(valid_netbios_name(subobj.NETBIOSNAME)); + var rdns = split(",", subobj.DOMAINDN); + subobj.RDN_DC = substr(rdns[0], strlen("DC=")); + + return true; +} + +function provision_become_dc(subobj, message, paths, session_info) +{ + var lp = loadparm_init(); + var sys = sys_init(); + var info = new Object(); + + var ok = provision_fix_subobj(subobj, message); + assert(ok); + + info.subobj = subobj; + info.message = message; + info.session_info = session_info; + + /* Also wipes the database */ + message("Setting up " + paths.samdb + " partitions\n"); + setup_ldb("provision_partitions.ldif", info, paths.samdb); + + var samdb = open_ldb(info, paths.samdb, false); + + message("Setting up " + paths.samdb + " attributes\n"); + setup_add_ldif("provision_init.ldif", info, samdb, false); + + message("Setting up " + paths.samdb + " rootDSE\n"); + setup_add_ldif("provision_rootdse_add.ldif", info, samdb, false); + + ok = samdb.transaction_commit(); + assert(ok); + + return true; +} /* provision samba4 - caution, this wipes all existing data! @@ -441,18 +485,9 @@ function provision(subobj, message, blank, paths, session_info, credentials, lda var sys = sys_init(); var info = new Object(); - /* - some options need to be upper/lower case - */ - subobj.REALM = strupper(subobj.REALM); - subobj.HOSTNAME = strlower(subobj.HOSTNAME); - subobj.DOMAIN = strupper(subobj.DOMAIN); - assert(valid_netbios_name(subobj.DOMAIN)); - subobj.NETBIOSNAME = strupper(subobj.HOSTNAME); - assert(valid_netbios_name(subobj.NETBIOSNAME)); - var rdns = split(",", subobj.DOMAINDN); - subobj.RDN_DC = substr(rdns[0], strlen("DC=")); - + var ok = provision_fix_subobj(subobj, message); + assert(ok); + if (subobj.DOMAINGUID != undefined) { subobj.DOMAINGUID_MOD = sprintf("replace: objectGUID\nobjectGUID: %s\n-", subobj.DOMAINGUID); } else { |