From 222fdd5237c1fd8551c39ce544171df3a5a41831 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 31 Aug 2005 21:04:17 +0000 Subject: r9842: More error checks in the ldb_map modules, extend testsuite (This used to be commit b7992de4b7d42a55e00509c887a269a07c19627d) --- testprogs/ejs/samba3sam | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'testprogs') 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); -- cgit