diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-08-30 00:41:02 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:34:58 -0500 |
commit | 7be4cf8c1ded42daf7e86ecd2c0dbfeeed312b22 (patch) | |
tree | 31b40e747ae679f4d6eeef2f8b3999070c747ea6 | |
parent | 37194224416d7509a457ee4aa18991b8bab0da7d (diff) | |
download | samba-7be4cf8c1ded42daf7e86ecd2c0dbfeeed312b22.tar.gz samba-7be4cf8c1ded42daf7e86ecd2c0dbfeeed312b22.tar.bz2 samba-7be4cf8c1ded42daf7e86ecd2c0dbfeeed312b22.zip |
r9770: Couple other bugfixes
Update TODO-list
(This used to be commit d9541535e3f9e1c058410eeb0a54d60181572f2b)
-rw-r--r-- | source4/lib/ldb/ldb_map/ldb_map.c | 16 | ||||
-rw-r--r-- | source4/lib/ldb/tests/samba3.ldif | 41 | ||||
-rwxr-xr-x | source4/lib/ldb/tests/test-samba3sam.sh | 17 | ||||
-rw-r--r-- | source4/lib/samba3/PLAN | 46 | ||||
-rw-r--r-- | source4/lib/samba3/tdbsam.c | 24 | ||||
-rw-r--r-- | source4/scripting/ejs/smbcalls_ldb.c | 6 | ||||
-rw-r--r-- | source4/scripting/ejs/smbcalls_samba3.c | 18 | ||||
-rw-r--r-- | source4/scripting/libjs/provision.js | 3 | ||||
-rw-r--r-- | source4/scripting/libjs/upgrade.js | 14 |
9 files changed, 79 insertions, 106 deletions
diff --git a/source4/lib/ldb/ldb_map/ldb_map.c b/source4/lib/ldb/ldb_map/ldb_map.c index f68ba3d545..7a620f3b81 100644 --- a/source4/lib/ldb/ldb_map/ldb_map.c +++ b/source4/lib/ldb/ldb_map/ldb_map.c @@ -754,12 +754,17 @@ static int map_search_bytree_mp(struct ldb_module *module, const struct ldb_dn * talloc_free(new_tree); talloc_free(newattrs); + if (mpret == -1) { + struct map_private *map_private = module->private_data; + map_private->last_err_string = ldb_errstring(privdat->mapped_ldb); + return -1; + } + /* - - per returned record, search local one for additional data (by dn) + - per returned record, search fallback database for additional data (by dn) - test if (full expression) is now true */ - *res = talloc_array(module, struct ldb_message *, mpret); ret = 0; @@ -775,7 +780,7 @@ static int map_search_bytree_mp(struct ldb_module *module, const struct ldb_dn * if (extraret == -1) { ldb_debug(module->ldb, LDB_DEBUG_ERROR, "Error searching for extra data!\n"); } else if (extraret > 1) { - ldb_debug(module->ldb, LDB_DEBUG_ERROR, "More then one result for extra data!\n"); + ldb_debug(module->ldb, LDB_DEBUG_ERROR, "More than one result for extra data!\n"); talloc_free(newres); return -1; } else if (extraret == 0) { @@ -820,12 +825,13 @@ static int map_search_bytree(struct ldb_module *module, const struct ldb_dn *bas int ret_fb, ret_mp; ret_fb = map_search_bytree_fb(module, base, scope, tree, attrs, &fbres); - if (ret_fb == -1) + if (ret_fb == -1) return -1; ret_mp = map_search_bytree_mp(module, base, scope, tree, attrs, &mpres); - if (ret_mp == -1) + if (ret_mp == -1) { return -1; + } /* Merge results */ *res = talloc_array(module, struct ldb_message *, ret_fb + ret_mp); diff --git a/source4/lib/ldb/tests/samba3.ldif b/source4/lib/ldb/tests/samba3.ldif index 02103b65b6..035eb1c516 100644 --- a/source4/lib/ldb/tests/samba3.ldif +++ b/source4/lib/ldb/tests/samba3.ldif @@ -1,4 +1,12 @@ -dn: uid=nobody,ou=Users,dc=test,dc=vernstok,dc=nl +dn: ou=Users,ou=Tests,dc=vernstok,dc=nl +objectClass: organizationalUnit +ou: Users + +dn: ou=Groups,ou=Tests,dc=vernstok,dc=nl +objectClass: organizationalUnit +ou: Groups + +dn: uid=nobody,ou=Users,ou=Tests,dc=vernstok,dc=nl cn: nobody sn: nobody objectClass: inetOrgPerson @@ -25,7 +33,7 @@ sambaAcctFlags: [NU ] sambaSID: S-1-5-21-4231626423-2410014848-2360679739-2998 loginShell: /bin/false -dn: cn=Domain Admins,ou=Groups,dc=test,dc=vernstok,dc=nl +dn: cn=Domain Admins,ou=Groups,ou=Tests,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 512 @@ -36,7 +44,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-512 sambaGroupType: 2 displayName: Domain Admins -dn: cn=Domain Users,ou=Groups,dc=test,dc=vernstok,dc=nl +dn: cn=Domain Users,ou=Groups,ou=Tests,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 513 @@ -46,7 +54,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-513 sambaGroupType: 2 displayName: Domain Users -dn: cn=Domain Guests,ou=Groups,dc=test,dc=vernstok,dc=nl +dn: cn=Domain Guests,ou=Groups,ou=Tests,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 514 @@ -56,7 +64,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-514 sambaGroupType: 2 displayName: Domain Guests -dn: cn=Print Operators,ou=Groups,dc=test,dc=vernstok,dc=nl +dn: cn=Print Operators,ou=Groups,ou=Tests,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 550 @@ -66,7 +74,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-550 sambaGroupType: 2 displayName: Print Operators -dn: cn=Backup Operators,ou=Groups,dc=test,dc=vernstok,dc=nl +dn: cn=Backup Operators,ou=Groups,ou=Tests,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 551 @@ -76,7 +84,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-551 sambaGroupType: 2 displayName: Backup Operators -dn: cn=Replicator,ou=Groups,dc=test,dc=vernstok,dc=nl +dn: cn=Replicator,ou=Groups,ou=Tests,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 552 @@ -86,7 +94,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-552 sambaGroupType: 2 displayName: Replicator -dn: cn=Domain Computers,ou=Groups,dc=test,dc=vernstok,dc=nl +dn: cn=Domain Computers,ou=Groups,ou=Tests,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 553 @@ -96,7 +104,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-553 sambaGroupType: 2 displayName: Domain Computers -dn: cn=Administrators,ou=Groups,dc=test,dc=vernstok,dc=nl +dn: cn=Administrators,ou=Groups,ou=Tests,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 544 @@ -106,7 +114,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-544 sambaGroupType: 2 displayName: Administrators -dn: cn=Users,ou=Groups,dc=test,dc=vernstok,dc=nl +dn: cn=Users,ou=Groups,ou=Tests,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 545 @@ -116,7 +124,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-545 sambaGroupType: 2 displayName: users -dn: cn=Guests,ou=Groups,dc=test,dc=vernstok,dc=nl +dn: cn=Guests,ou=Groups,ou=Tests,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 546 @@ -127,7 +135,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-546 sambaGroupType: 2 displayName: Guests -dn: cn=Power Users,ou=Groups,dc=test,dc=vernstok,dc=nl +dn: cn=Power Users,ou=Groups,ou=Tests,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 547 @@ -137,7 +145,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-547 sambaGroupType: 2 displayName: Power Users -dn: cn=Account Operators,ou=Groups,dc=test,dc=vernstok,dc=nl +dn: cn=Account Operators,ou=Groups,ou=Tests,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 548 @@ -147,7 +155,7 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-548 sambaGroupType: 2 displayName: Account Operators -dn: cn=Server Operators,ou=Groups,dc=test,dc=vernstok,dc=nl +dn: cn=Server Operators,ou=Groups,ou=Tests,dc=vernstok,dc=nl objectClass: posixGroup objectClass: sambaGroupMapping gidNumber: 549 @@ -157,10 +165,11 @@ sambaSID: S-1-5-21-4231626423-2410014848-2360679739-549 sambaGroupType: 2 displayName: Server Operators -dn: ou=Computers,dc=test,dc=vernstok,dc=nl +dn: ou=Computers,ou=Tests,dc=vernstok,dc=nl objectClass: organizationalUnit ou: Computers -dn: uid=Administrator,ou=Users,dc=test,dc=vernstok,dc=nl + +dn: uid=Administrator,ou=Users,ou=Tests,dc=vernstok,dc=nl cn: Administrator sn: Administrator objectClass: inetOrgPerson diff --git a/source4/lib/ldb/tests/test-samba3sam.sh b/source4/lib/ldb/tests/test-samba3sam.sh index 995a513d54..5baf0bf77a 100755 --- a/source4/lib/ldb/tests/test-samba3sam.sh +++ b/source4/lib/ldb/tests/test-samba3sam.sh @@ -1,17 +1,24 @@ #!/bin/sh -rm -f samba3.ldb samba4.ldb +S3URL=$1 -echo "Adding samba3 LDIF..." -$VALGRIND ldbadd -H tdb://samba3.ldb < samba3.ldif || exit 1 +if [ -z "$S3URL" ]; +then + rm -f samba3.ldb + S3URL="tdb://samba3.ldb" + echo "Adding samba3 LDIF..." + $VALGRIND ldbadd -H tdb://samba3.ldb < samba3.ldif || exit 1 +fi -echo "Adding samba4 LDIF..." +rm -f samba4.ldb + +echo "Initial samba4 LDIF..." $VALGRIND ldbadd -H tdb://samba4.ldb <<EOF dn: @MODULES @LIST: samba3sam dn: @MAP=samba3sam -@MAP_URL: tdb://samba3.ldb +@MAP_URL: $S3URL EOF diff --git a/source4/lib/samba3/PLAN b/source4/lib/samba3/PLAN index 87add2096e..abc3d5d6ae 100644 --- a/source4/lib/samba3/PLAN +++ b/source4/lib/samba3/PLAN @@ -1,44 +1,4 @@ -Three possible viable approaches: - 1) TDB conversion approach. Read in TDB dump out LDIF (one-way) - - samr.ldb: from tdbsam/smbpasswd, account_policy.tdb, secrets.tdb, group_mapping.tdb - - registry.ldb: from registry.tdb - - wins.ldif: from wins.tdb/wins.dat - - smb.conf/ea's: generated from the old smb.conf + share_info.tdb - - winbind.ldif: from winbindd_idmap.tdb (custom file format, not used - by samba4 yet as it doesn't - have Winbind yet) - - (one-way upgrades can be done by using ldbsearch -a on these dynamically - generated ldb's) - Since TDB's are local, there isn't much point in writing back backwards - compatible data. - - 2) samr "mapping" backend (alternative for samr.ldb) (two-way) - This would allow users to keep mixed domains containing Samba3 and Samba4. - - 3) The vampire way of doing things (one-way) - - samba3 pidl backend - - Samba4 vampire + server side samsync support in Samba3 - - unixinfo (\unixinfo) - - in Samba4 (client side) - - in Samba3 (server side) - - winsrepl (thru seperate pipe?) - - enum/add shares (\srvsvc) - - enum/add registry (\winreg) - - enum/add printers (\winreg, perhaps also \spoolss(?)) - - convert smb.conf (using Jerry's registry hack) - -(going with a combination of 1 and 2) - -ldb mapping backend: - - -Upgrade process: - - take libdir & smb.conf - - read various tdb files / old smb.conf - - write new smb.conf (ejs) - - list of parameters to keep.. generate some of the others - - add generated LDIF (ejs). Call out to current provisioning - -TODO: +TODO (SoC project): - move ini parsing stuff to seperate file param/ini.c + - test ldb_map backend (testsuite?) + - parse "passdb backend" setting and parse tdbsam/passdb based on it diff --git a/source4/lib/samba3/tdbsam.c b/source4/lib/samba3/tdbsam.c index fc293d5df9..5397abca49 100644 --- a/source4/lib/samba3/tdbsam.c +++ b/source4/lib/samba3/tdbsam.c @@ -84,14 +84,6 @@ static BOOL init_sam_from_buffer_v0(TDB_CONTEXT *tdb, struct samba3_samaccount * return False; } - if (lm_pw_len != 16) { - return False; - } - - if (nt_pw_len != 16) { - return False; - } - return True; } @@ -150,14 +142,6 @@ static BOOL init_sam_from_buffer_v1(TDB_CONTEXT *tdb, struct samba3_samaccount * return False; } - if (lm_pw_len != 16) { - return False; - } - - if (nt_pw_len != 16) { - return False; - } - return True; } @@ -216,14 +200,6 @@ static BOOL init_sam_from_buffer_v2(TDB_CONTEXT *tdb, struct samba3_samaccount * return False; } - if (lm_pw_len != 16) { - return False; - } - - if (nt_pw_len != 16) { - return False; - } - return True; } diff --git a/source4/scripting/ejs/smbcalls_ldb.c b/source4/scripting/ejs/smbcalls_ldb.c index 662da0d971..aabd43d1ac 100644 --- a/source4/scripting/ejs/smbcalls_ldb.c +++ b/source4/scripting/ejs/smbcalls_ldb.c @@ -264,6 +264,7 @@ static int ejs_base64encode(MprVarHandle eid, int argc, struct MprVar **argv) } blob = mprToDataBlob(argv[0]); + mprAssert(blob); ret = ldb_base64_encode(mprMemCtx(), (char *)blob->data, blob->length); if (!ret) { @@ -297,7 +298,10 @@ static int ejs_base64decode(MprVarHandle eid, int argc, struct MprVar **argv) if (ret == -1) { mpr_Return(eid, mprCreateUndefinedVar()); } else { - mpr_Return(eid, mprData((uint8_t *)tmp, ret)); + DATA_BLOB blob; + blob.data = (uint8_t *)tmp; + blob.length = ret; + mpr_Return(eid, mprDataBlob(blob)); } talloc_free(tmp); diff --git a/source4/scripting/ejs/smbcalls_samba3.c b/source4/scripting/ejs/smbcalls_samba3.c index eb37168bc8..936426c2da 100644 --- a/source4/scripting/ejs/smbcalls_samba3.c +++ b/source4/scripting/ejs/smbcalls_samba3.c @@ -165,6 +165,7 @@ static struct MprVar mprDomainSecrets(struct samba3_domainsecrets *ds) { struct MprVar v, e = mprObject("domainsecrets"); char *tmp; + DATA_BLOB blob; mprSetVar(&e, "name", mprString(ds->name)); @@ -183,7 +184,9 @@ static struct MprVar mprDomainSecrets(struct samba3_domainsecrets *ds) v = mprObject("hash_pw"); - mprSetVar(&v, "hash", mprData(ds->hash_pw.hash, 16)); + blob.data = ds->hash_pw.hash; + blob.length = 16; + mprSetVar(&v, "hash", mprDataBlob(blob)); mprSetVar(&v, "mod_time", mprCreateIntegerVar(ds->hash_pw.mod_time)); @@ -259,9 +262,12 @@ static struct MprVar mprSecrets(struct samba3_secrets *sec) for (j = 0; j < 8; j++) { struct MprVar k = mprObject("entry"); + DATA_BLOB blob; mprSetVar(&k, "kvno", mprCreateIntegerVar(sec->afs_keyfiles[i].entry[j].kvno)); - mprSetVar(&k, "key", mprData((uint8_t*)sec->afs_keyfiles[i].entry[j].key, 8)); + blob.data = (uint8_t*)sec->afs_keyfiles[i].entry[j].key; + blob.length = 8; + mprSetVar(&k, "key", mprDataBlob(blob)); mprAddArray(&ks, j, k); } @@ -316,6 +322,7 @@ static struct MprVar mprSamAccounts(struct samba3 *samba3) for (i = 0; i < samba3->samaccount_count; i++) { struct samba3_samaccount *a = &samba3->samaccounts[i]; + DATA_BLOB blob; m = mprObject("samba3_samaccount"); @@ -343,8 +350,11 @@ static struct MprVar mprSamAccounts(struct samba3 *samba3) mprSetVar(&m, "profile_path", mprString(a->profile_path)); mprSetVar(&m, "acct_desc", mprString(a->acct_desc)); mprSetVar(&m, "workstations", mprString(a->workstations)); - mprSetVar(&m, "lm_pw", mprData(a->lm_pw.hash, 16)); - mprSetVar(&m, "nt_pw", mprData(a->nt_pw.hash, 16)); + blob.length = 16; + blob.data = a->lm_pw.hash; + mprSetVar(&m, "lm_pw", mprDataBlob(blob)); + blob.data = a->nt_pw.hash; + mprSetVar(&m, "nt_pw", mprDataBlob(blob)); mprAddArray(&mpv, i, m); } diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js index b43d435ca9..9607d6f274 100644 --- a/source4/scripting/libjs/provision.js +++ b/source4/scripting/libjs/provision.js @@ -164,14 +164,13 @@ function setup_ldb(ldif, dbname, subobj) erase = arguments[4]; } - var dbfile = dbname; var src = lp.get("setup directory") + "/" + ldif; var data = sys.file_load(src); data = data + extra; data = substitute_var(data, subobj); - var ok = ldb.connect(dbfile); + var ok = ldb.connect(dbname); assert(ok); if (erase) { diff --git a/source4/scripting/libjs/upgrade.js b/source4/scripting/libjs/upgrade.js index dbf1c0f2c3..c78afd6a91 100644 --- a/source4/scripting/libjs/upgrade.js +++ b/source4/scripting/libjs/upgrade.js @@ -116,8 +116,6 @@ description: %s primaryGroupID: %d badPwdcount: %d logonCount: %d -ntPwdHash:: %s -lmPwdHash:: %s samba3Domain: %s samba3DirDrive: %s samba3MungedDial: %s @@ -131,6 +129,8 @@ samba3PassLastSetTime: %d samba3PassCanChangeTime: %d samba3PassMustChangeTime: %d samba3Rid: %d +ntPwdHash:: %s +lmPwdHash:: %s ", acc.fullname, domaindn, acc.logon_time, acc.logoff_time, acc.username, acc.nt_username, acc.fullname, acc.acct_desc, acc.group_rid, acc.bad_password_count, acc.logon_count, @@ -422,18 +422,20 @@ dn: @MAP=samba3sam message("Importing users\n"); for (var i in samba3.samaccounts) { - message("... " + samba3.samaccounts[i].username + "\n"); + message("... " + samba3.samaccounts[i].username); var ldif = upgrade_sam_account(samba3.samaccounts[i],subobj.BASEDN); ok = samdb.add(ldif); - assert(ok); + if (!ok) { message("... error!"); } + message("\n"); } message("Importing groups\n"); for (var i in samba3.groupmappings) { - message("... " + samba3.groupmappings[i].nt_name + "\n"); + message("... " + samba3.groupmappings[i].nt_name); var ldif = upgrade_sam_group(samba3.groupmappings[i],subobj.BASEDN); ok = samdb.add(ldif); - assert(ok); + if (!ok) { message("... error!"); } + message("\n"); } message("Importing registry data\n"); |