summaryrefslogtreecommitdiff
path: root/testprogs/ejs
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-31 21:04:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:36:17 -0500
commit222fdd5237c1fd8551c39ce544171df3a5a41831 (patch)
tree062732388f1155cbe911144abe4a503171a6ca97 /testprogs/ejs
parent84bfcd3c78afefd8d2869c695c116c9df7ee03c4 (diff)
downloadsamba-222fdd5237c1fd8551c39ce544171df3a5a41831.tar.gz
samba-222fdd5237c1fd8551c39ce544171df3a5a41831.tar.bz2
samba-222fdd5237c1fd8551c39ce544171df3a5a41831.zip
r9842: More error checks in the ldb_map modules, extend testsuite
(This used to be commit b7992de4b7d42a55e00509c887a269a07c19627d)
Diffstat (limited to 'testprogs/ejs')
-rwxr-xr-xtestprogs/ejs/samba3sam30
1 files changed, 25 insertions, 5 deletions
diff --git a/testprogs/ejs/samba3sam b/testprogs/ejs/samba3sam
index 223cd87eee..3331cfe164 100755
--- a/testprogs/ejs/samba3sam
+++ b/testprogs/ejs/samba3sam
@@ -1,6 +1,8 @@
#!/usr/bin/env smbscript
libinclude("base.js");
+var mypath = substr(ARGV[0], 0, -strlen("samba3sam"));
+
var sys = sys_init();
var s3url;
var s3 = ldb_init();
@@ -17,7 +19,7 @@ if (ARGV.length == 2) {
var s3 = ldb_init();
ok = s3.connect(s3url);
assert(ok);
- var ldif = sys.file_load("../../testdata/samba3/samba3.ldif");
+ var ldif = sys.file_load(mypath + "../../testdata/samba3/samba3.ldif");
assert(ldif != undefined);
ok = s3.add(ldif);
assert(ok);
@@ -25,16 +27,34 @@ if (ARGV.length == 2) {
println("Initial samba4 LDIF...");
var s4 = ldb_init();
+sys.unlink("samba4.ldb");
ok = s4.connect("tdb://samba4.ldb");
assert(ok);
-ok = s4.add(sprintf("
-dn: @MODULES
-@LIST: samba3sam
-dn: @MAP=samba3sam
+var ldif = sys.file_load(mypath + "../../source/setup/provision_init.ldif");
+assert(ldif != undefined);
+ok = s4.add(ldif);
+assert(ok);
+
+ok = s4.add(sprintf("dn: @MAP=samba3sam
@MAP_URL: %s", s3url));
assert(ok);
+ok = s4.modify("
+dn: @MODULES
+replace: @LIST
+@LIST: samldb,timestamps,objectguid,rdn_name,samba3sam");
+assert(ok);
+
+println("Reconnecting to LDB database");
+s4 = ldb_init();
+ok = s4.connect("tdb://samba4.ldb");
+assert(ok);
+
+msg = s4.search("(ou=Users)");
+assert(msg.length == 1);
+assert(msg['mappedFromDn'] == msg['dn']);
+
println("Looking up by non-mapped attribute");
msg = s4.search("(cn=Administrator)");
assert(msg.length == 1);