summaryrefslogtreecommitdiff
path: root/testprogs
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-01-18 12:06:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:51:15 -0500
commit7dad66d8e38e206dd83b88a4e37c0f413b4b69df (patch)
tree630d03be0f072caa02370fc4794471b3e46ba25e /testprogs
parentba8406fd3fb753deba9c3d5f8179dc70a200375d (diff)
downloadsamba-7dad66d8e38e206dd83b88a4e37c0f413b4b69df.tar.gz
samba-7dad66d8e38e206dd83b88a4e37c0f413b4b69df.tar.bz2
samba-7dad66d8e38e206dd83b88a4e37c0f413b4b69df.zip
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)
Diffstat (limited to 'testprogs')
-rwxr-xr-xtestprogs/ejs/ldap.js36
1 files changed, 34 insertions, 2 deletions
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)