From 7dad66d8e38e206dd83b88a4e37c0f413b4b69df Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 18 Jan 2006 12:06:36 +0000 Subject: r12998: A big update to samldb.c This updates the module to handle both SID allocation and nextRid updating while importing users. (As imported users already have a SID, so don't go via the allocation step). We also ensure that SIDs in the database are unquie at create time. Furthermore, at allocation time, we double-check the SID isn't already in use, and that we don't create a foriegnSecurityPrincipal for a 'local' sid. Also create random samAccountName entries for users without one (we were setting $000000-000000000000). We may want to seperate the uniqueness code from the rest of samldb, and into a module with the objectguid code, which needs similar checks. These checks also need to apply to modification, or those modifications denied outright. Also update part of the testsuite to validate this. Andrew Bartlett (This used to be commit 7a9c8eee4bea88f5f0bb7c62f701476384b7dc84) --- testprogs/ejs/ldap.js | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'testprogs/ejs') diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js index 561d5d86f8..a432c11653 100755 --- a/testprogs/ejs/ldap.js +++ b/testprogs/ejs/ldap.js @@ -36,7 +36,21 @@ objectClass: user objectClass: person cn: LDAPtestUSER "); - assert(ok); + if (!ok) { + println(ldb.errstring()); + assert(ok); + } + + ok = ldb.add(" +dn: cn=ldaptestuser2,cn=users," + base_dn + " +objectClass: user +objectClass: person +cn: LDAPtestUSER2 +"); + if (!ok) { + println(ldb.errstring()); + assert(ok); + } println("Testing ldb.search"); var res = ldb.search("(&(cn=ldaptestuser)(objectClass=user))"); @@ -48,7 +62,25 @@ cn: LDAPtestUSER assert(res[0].whenCreated != undefined); ok = ldb.del(res[0].dn); - assert(ok); + if (!ok) { + println(ldb.errstring()); + assert(ok); + } + + println("Testing ldb.search"); + var res = ldb.search("(&(cn=ldaptestUSer2)(objectClass=user))"); + + assert(res[0].dn == "cn=ldaptestuser2,cn=users," + base_dn); + assert(res[0].cn == "ldaptestuser2"); + assert(res[0].name == "ldaptestuser2"); + assert(res[0].objectGUID != undefined); + assert(res[0].whenCreated != undefined); + + ok = ldb.del(res[0].dn); + if (!ok) { + println(ldb.errstring()); + assert(ok); + } } function find_basedn(ldb) -- cgit