diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-08-31 16:51:09 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:36:17 -0500 |
commit | 0712cbdab4c397b9f74fcd681f40df9c9c2c59a8 (patch) | |
tree | 05a6e0151391ed749c6ea51c254747ac34c78a55 /source4/scripting | |
parent | 52bcf4c5a3a371e13530fe83c8b4ca06dad10b8f (diff) | |
download | samba-0712cbdab4c397b9f74fcd681f40df9c9c2c59a8.tar.gz samba-0712cbdab4c397b9f74fcd681f40df9c9c2c59a8.tar.bz2 samba-0712cbdab4c397b9f74fcd681f40df9c9c2c59a8.zip |
r9834: More tests for the upgrade from Samba3
(This used to be commit d2db164d6f674cada470e871c558c75f98244141)
Diffstat (limited to 'source4/scripting')
-rw-r--r-- | source4/scripting/ejs/smbcalls_samba3.c | 42 | ||||
-rw-r--r-- | source4/scripting/libjs/upgrade.js | 30 |
2 files changed, 63 insertions, 9 deletions
diff --git a/source4/scripting/ejs/smbcalls_samba3.c b/source4/scripting/ejs/smbcalls_samba3.c index 0d54d54dcc..0e4743eca9 100644 --- a/source4/scripting/ejs/smbcalls_samba3.c +++ b/source4/scripting/ejs/smbcalls_samba3.c @@ -55,6 +55,10 @@ static struct MprVar mprRegistry(struct samba3_regdb *reg) mprAddArray(&ks, i, k); } + if (i == 0) { + mprSetVar(&ks, "length", mprCreateIntegerVar(i)); + } + mprSetVar(&mpv, "keys", ks); return mpv; @@ -104,6 +108,11 @@ static struct MprVar mprIdmapDb(struct samba3_idmapdb *db) mprAddArray(&mps, i, mp); } + if (i == 0) { + mprSetVar(&mpv, "length", mprCreateIntegerVar(i)); + } + + mprSetVar(&mpv, "mappings", mps); return mpv; @@ -131,6 +140,11 @@ static struct MprVar mprGroupMappings(struct samba3_groupdb *db) mprAddArray(&mpv, i, g); } + if (i == 0) { + mprSetVar(&mpv, "length", mprCreateIntegerVar(i)); + } + + return mpv; } @@ -158,6 +172,10 @@ static struct MprVar mprAliases(struct samba3_groupdb *db) mprSetVar(&a, "members", am); } + if (i == 0) { + mprSetVar(&mpv, "length", mprCreateIntegerVar(i)); + } + return mpv; } @@ -219,6 +237,10 @@ static struct MprVar mprSecrets(struct samba3_secrets *sec) mprAddArray(&es, i, mprDomainSecrets(&sec->domains[i])); } + if (i == 0) { + mprSetVar(&es, "length", mprCreateIntegerVar(i)); + } + mprSetVar(&mpv, "domains", es); es = mprObject("trusted_domains"); @@ -247,6 +269,10 @@ static struct MprVar mprSecrets(struct samba3_secrets *sec) mprAddArray(&es, i, e); } + if (i == 0) { + mprSetVar(&es, "length", mprCreateIntegerVar(i)); + } + mprSetVar(&mpv, "trusted_domains", es); es = mprObject("array"); @@ -279,6 +305,10 @@ static struct MprVar mprSecrets(struct samba3_secrets *sec) mprAddArray(&es, i, e); } + if (i == 0) { + mprSetVar(&es, "length", mprCreateIntegerVar(i)); + } + mprSetVar(&mpv, "afs_keyfiles", es); mprSetVar(&mpv, "ipc_cred", mprCredentials(sec->ipc_cred)); @@ -301,6 +331,10 @@ static struct MprVar mprShares(struct samba3 *samba3) mprAddArray(&mpv, i, s); } + if (i == 0) { + mprSetVar(&mpv, "length", mprCreateIntegerVar(i)); + } + return mpv; } @@ -348,6 +382,10 @@ static struct MprVar mprSamAccounts(struct samba3 *samba3) mprAddArray(&mpv, i, m); } + if (i == 0) { + mprSetVar(&mpv, "length", mprCreateIntegerVar(i)); + } + return mpv; } @@ -375,6 +413,10 @@ static struct MprVar mprWinsEntries(struct samba3 *samba3) mprAddArray(&mpv, i, w); } + if (i == 0) { + mprSetVar(&mpv, "length", mprCreateIntegerVar(i)); + } + return mpv; } diff --git a/source4/scripting/libjs/upgrade.js b/source4/scripting/libjs/upgrade.js index e78865f196..59e433b0f2 100644 --- a/source4/scripting/libjs/upgrade.js +++ b/source4/scripting/libjs/upgrade.js @@ -448,26 +448,26 @@ dn: @MAP=samba3sam message("Importing users\n"); for (var i in samba3.samaccounts) { - message("... " + samba3.samaccounts[i].username); + var msg = "... " + samba3.samaccounts[i].username; var ldif = upgrade_sam_account(samba3.samaccounts[i],subobj.BASEDN); ok = samdb.add(ldif); if (!ok) { - message("... error: " + samdb.errstring()); + msg = msg + "... error: " + samdb.errstring(); ret = ret + 1; } - message("\n"); + message(msg + "\n"); } message("Importing groups\n"); for (var i in samba3.groupmappings) { - message("... " + samba3.groupmappings[i].nt_name); + var msg = "... " + samba3.groupmappings[i].nt_name; var ldif = upgrade_sam_group(samba3.groupmappings[i],subobj.BASEDN); ok = samdb.add(ldif); if (!ok) { - message("... error: " + samdb.errstring()); + msg = msg + "... error: " + samdb.errstring(); ret = ret + 1; } - message("\n"); + message(msg + "\n"); } message("Importing registry data\n"); @@ -480,13 +480,13 @@ dn: @MAP=samba3sam assert(ok); var ldif = upgrade_registry(samba3.registry, hn, regdb); for (var j in ldif) { - message("... ... " + j); + var msg = "... ... " + j; ok = regdb.add(ldif[j]); if (!ok) { - message("... error: " + regdb.errstring()); + msg = msg + "... error: " + regdb.errstring(); ret = ret + 1; } - message("\n"); + message(msg + "\n"); } } @@ -502,3 +502,15 @@ dn: @MAP=samba3sam return ret; } + +function upgrade_verify(subobj, samba3,paths,message) +{ + message("Verifying account policies\n"); + var samldb = ldb_init(); + var ne = 0; + + var ok = samldb.connect(paths.samdb); + assert(ok); + + // FIXME +} |