summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/ldb_map/ldb_map.c16
-rw-r--r--source4/lib/ldb/tests/samba3.ldif41
-rwxr-xr-xsource4/lib/ldb/tests/test-samba3sam.sh17
-rw-r--r--source4/lib/samba3/PLAN46
-rw-r--r--source4/lib/samba3/tdbsam.c24
5 files changed, 51 insertions, 93 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;
}