diff options
author | Andrew Bartlett <abartlet@samba.org> | 2006-06-06 17:19:58 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:08:55 -0500 |
commit | 629d6ad3cf98deba6b9e15701ed0c5d908b9fe11 (patch) | |
tree | 51cfa41b3bbbf5c26f8aa165b770570ba0f5461d /testprogs/ejs | |
parent | 1335e8f5f181e4d06a85a0f0b572b4bc9c42ef8e (diff) | |
download | samba-629d6ad3cf98deba6b9e15701ed0c5d908b9fe11.tar.gz samba-629d6ad3cf98deba6b9e15701ed0c5d908b9fe11.tar.bz2 samba-629d6ad3cf98deba6b9e15701ed0c5d908b9fe11.zip |
r16061: Prove that removing the objectClass list in the samldb module breaks things.
With this fix, we now correctly detect computers again, and get the
correct objectCategory, which is important for the OSX AD plugin.
Andrew Bartlett
(This used to be commit 4e39d7bb245bc337ac496c7e39a510d1c5611c71)
Diffstat (limited to 'testprogs/ejs')
-rwxr-xr-x | testprogs/ejs/ldap.js | 59 |
1 files changed, 54 insertions, 5 deletions
diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js index de00113573..db36e8cb6a 100755 --- a/testprogs/ejs/ldap.js +++ b/testprogs/ejs/ldap.js @@ -54,6 +54,28 @@ cn: LDAPtestUSER } } + var ok = ldb.add(" +dn: cn=ldaptestcomputer,cn=computers," + base_dn + " +objectClass: computer +cn: LDAPtestCOMPUTER +"); + if (!ok) { + ok = ldb.del("cn=ldaptestcomputer,cn=computers," + base_dn); + if (!ok) { + println(ldb.errstring()); + assert(ok); + } + ok = ldb.add(" +dn: cn=ldaptestcomputer,cn=computers," + base_dn + " +objectClass: computer +cn: LDAPtestCOMPUTER +"); + if (!ok) { + println(ldb.errstring()); + assert(ok); + } + } + ok = ldb.add(" dn: cn=ldaptestuser2,cn=users," + base_dn + " objectClass: person @@ -134,23 +156,50 @@ objectClass: user assert(res[0].objectClass[3] == "user"); assert(res[0].objectGUID != undefined); assert(res[0].whenCreated != undefined); + assert(res[0].objectCategory == "cn=Person,cn=Schema,cn=Configuration," + base_dn); - println("Testing ldb.search for (&(cn=ldaptestuser)(objectClass=user))"); - var res = ldb.search("(&(cn=ldaptestuser)(objectClass=user))"); + println("Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))"); + var res2 = ldb.search("(&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))"); + if (res.length != 1) { + println("Could not find (&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))"); + assert(res.length == 1); + } + + assert(res[0].dn == res2[0].dn); + + ok = ldb.del(res[0].dn); + if (!ok) { + println(ldb.errstring()); + assert(ok); + } + + println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectClass=user))"); + var res = ldb.search("(&(cn=ldaptestcomputer)(objectClass=user))"); if (res.length != 1) { println("Could not find (&(cn=ldaptestuser)(objectClass=user))"); assert(res.length == 1); } - assert(res[0].dn == "cn=ldaptestuser,cn=users," + base_dn); - assert(res[0].cn == "ldaptestuser"); - assert(res[0].name == "ldaptestuser"); + assert(res[0].dn == "cn=ldaptestcomputer,cn=computers," + base_dn); + assert(res[0].cn == "ldaptestcomputer"); + assert(res[0].name == "ldaptestcomputer"); assert(res[0].objectClass[0] == "top"); assert(res[0].objectClass[1] == "person"); assert(res[0].objectClass[2] == "organizationalPerson"); assert(res[0].objectClass[3] == "user"); + assert(res[0].objectClass[4] == "computer"); assert(res[0].objectGUID != undefined); assert(res[0].whenCreated != undefined); + assert(res[0].objectCategory == "cn=Computer,cn=Schema,cn=Configuration," + base_dn); + + println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))"); + var res2 = ldb.search("(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))"); + if (res.length != 1) { + println("Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))"); + assert(res.length == 1); + } + + assert(res[0].dn == res2[0].dn); ok = ldb.del(res[0].dn); if (!ok) { |