From 8a8948a17a947bccf04df817f5011093c0c5c523 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 1 Nov 2007 12:34:06 +0100 Subject: r25781: Handle and test linked attribute renames. Andrew Bartlett (This used to be commit 56d9dd5140b6d7d7bbaa2f59ecdff7ee70c4faac) --- testprogs/ejs/ldap.js | 67 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) (limited to 'testprogs') diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js index b5c73e4f65..c18e293780 100755 --- a/testprogs/ejs/ldap.js +++ b/testprogs/ejs/ldap.js @@ -55,6 +55,30 @@ cN: LDAPtestUSER } } + ldb.del("cn=ldaptestgroup,cn=users," + base_dn); + + var ok = ldb.add(" +dn: cn=ldaptestgroup,cn=uSers," + base_dn + " +objectclass: group +member: cn=ldaptestuser,cn=useRs," + base_dn + " +"); + if (ok.error != 0) { + ok = ldb.del("cn=ldaptestgroup,cn=users," + base_dn); + if (ok.error != 0) { + println(ok.errstr); + assert(ok.error == 0); + } + ok = ldb.add(" +dn: cn=ldaptestgroup,cn=uSers," + base_dn + " +objectclass: group +member: cn=ldaptestuser,cn=useRs," + base_dn + " +"); + if (ok.error != 0) { + println(ok.errstr); + assert(ok.error == 0); + } + } + var ok = ldb.add(" dn: cn=ldaptestcomputer,cn=computers," + base_dn + " objectclass: computer @@ -77,6 +101,11 @@ cn: LDAPtestCOMPUTER } } + if (ok.error != 0) { + println(ok.errstr); + assert(ok.error == 0); + } + var ok = ldb.add(" dn: cn=ldaptest2computer,cn=computers," + base_dn + " objectClass: computer @@ -140,6 +169,20 @@ cn: LDAPtestUSER2 } } + println("Testing Group Modifies"); + ok = ldb.modify(" +dn: cn=ldaptestgroup,cn=users," + base_dn + " +changetype: modify +add: member +member: cn=ldaptestuser2,cn=users," + base_dn + " +member: cn=ldaptestcomputer,cn=computers," + base_dn + " +"); + + if (ok.error != 0) { + println(ok.errstr); + assert(ok.error == 0); + } + ok = ldb.del("cn=ldaptestuser3,cn=users," + base_dn); println("Testing Renames"); @@ -230,6 +273,14 @@ cn: LDAPtestUSER3 ok = ldb.del("cn=ldaptestuser5,cn=users," + base_dn); + ok = ldb.del("cn=ldaptestgroup2,cn=users," + base_dn); + + ok = ldb.rename("cn=ldaptestgroup,cn=users," + base_dn, "cn=ldaptestgroup2,cn=users," + base_dn); + if (ok.error != 0) { + println(ok.errstr); + assert(ok.error == 0); + } + println("Testing subtree Renames"); ok = ldb.add(" @@ -562,7 +613,13 @@ objectClass: user // assert(res.msgs[0].userAccountControl == 4098); - var attrs = new Array("cn", "name", "objectClass", "objectGUID", "whenCreated", "nTSecurityDescriptor"); + ok = ldb.del(res.msgs[0].dn); + if (ok.error != 0) { + println(ok.errstr); + assert(ok.error == 0); + } + + var attrs = new Array("cn", "name", "objectClass", "objectGUID", "whenCreated", "nTSecurityDescriptor", "memberOf"); println("Testing ldb.search for (&(cn=ldaptestUSer2)(objectClass=user))"); var res = ldb.search("(&(cn=ldaptestUSer2)(objectClass=user))", base_dn, ldb.SCOPE_SUBTREE, attrs); if (res.error != 0 || res.msgs.length != 1) { @@ -581,7 +638,7 @@ objectClass: user assert(res.msgs[0].objectGUID != undefined); assert(res.msgs[0].whenCreated != undefined); assert(res.msgs[0].nTSecurityDescriptor != undefined); - + assert(res.msgs[0].memberOf[0] == ("CN=ldaptestgroup2,CN=Users," + base_dn)); ok = ldb.del(res.msgs[0].dn); if (ok.error != 0) { @@ -614,6 +671,12 @@ objectClass: user assert(ok.error == 0); } + ok = ldb.del(("CN=ldaptestgroup2,CN=Users," + base_dn)) + if (ok.error != 0) { + println(ok.errstr); + assert(ok.error == 0); + } + println("Testing ldb.search for (&(cn=ldaptestutf8user2 ÈÙÉÌÒÀ)(objectClass=user))"); var res = ldb.search("(&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))"); -- cgit