r26140: Add a new test for searches by distinguieshedName and dn, and
authorAndrew Bartlett <abartlet@samba.org>
Tue, 27 Nov 2007 03:43:20 +0000 (04:43 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:46:20 +0000 (05:46 +0100)
implement these in the simple ldap mapping module.

We still don't pass this test, because we must get linked attributes
into OpenLDAP.

Andrew Bartlett
(This used to be commit d41f34e979bb119f71ab3cc2fdb3c08e4b92849c)

source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
testprogs/ejs/ldap.js

index 2b8b07f0b42a6d68a82811ad99c2255f75a80a3d..7efcccc9ffcac8af41a418ee33034705e47cbf42 100644 (file)
@@ -375,6 +375,15 @@ static const struct ldb_map_attribute entryuuid_attributes[] =
                         }
                }
        },
+       {
+               .local_name = "dn",
+               .type = MAP_RENAME,
+               .u = {
+                       .rename = {
+                                .remote_name = "entryDN"
+                        }
+               }
+       },
        {
                .local_name = "groupType",
                .type = MAP_CONVERT,
@@ -524,6 +533,15 @@ static const struct ldb_map_attribute nsuniqueid_attributes[] =
                         }
                }
        },
+       {
+               .local_name = "dn",
+               .type = MAP_RENAME,
+               .u = {
+                       .rename = {
+                                .remote_name = "entryDN"
+                        }
+               }
+       },
        {
                .local_name = "groupType",
                .type = MAP_CONVERT,
index ddf5d814f5248df01544b034e9d9a47b7281e436..40ce404890fe2136ad1d2a59f12bcfac738ee9d0 100755 (executable)
@@ -230,6 +230,28 @@ member: cn=ldaptestuser3,cn=users," + base_dn + "
        assert(res.msgs[0].cn == "ldaptestUSER3");
        assert(res.msgs[0].name == "ldaptestUSER3");
 
+       println("Testing ldb.search for (dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")");
+       var res = ldb.search("(dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")");
+       if (res.error != 0 || res.msgs.length != 1) {
+               println("Could not find (dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")");
+               assert(res.error == 0);
+               assert(res.msgs.length == 1);
+       }
+       assert(res.msgs[0].dn == ("CN=ldaptestUSER3,CN=Users," + base_dn));
+       assert(res.msgs[0].cn == "ldaptestUSER3");
+       assert(res.msgs[0].name == "ldaptestUSER3");
+
+       println("Testing ldb.search for (distinguishedName=CN=ldaptestUSER3,CN=Users," + base_dn + ")");
+       var res = ldb.search("(distinguishedName=CN=ldaptestUSER3,CN=Users," + base_dn + ")");
+       if (res.error != 0 || res.msgs.length != 1) {
+               println("Could not find (dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")");
+               assert(res.error == 0);
+               assert(res.msgs.length == 1);
+       }
+       assert(res.msgs[0].dn == ("CN=ldaptestUSER3,CN=Users," + base_dn));
+       assert(res.msgs[0].cn == "ldaptestUSER3");
+       assert(res.msgs[0].name == "ldaptestUSER3");
+
        // ensure we cannot add it again
        ok = ldb.add("
 dn: cn=ldaptestuser3,cn=userS," + base_dn + "