summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb')
-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
3 files changed, 48 insertions, 26 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