diff options
author | Andrew Bartlett <abartlet@samba.org> | 2007-11-14 03:51:02 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:45:13 +0100 |
commit | 58f9b5702a432a39a8276367532635300034d180 (patch) | |
tree | 836332cb90a5487cab1b5e201f259d4447a5db09 | |
parent | 3e0efe23833f6277b121b19e85e693737530ec6b (diff) | |
download | samba-58f9b5702a432a39a8276367532635300034d180.tar.gz samba-58f9b5702a432a39a8276367532635300034d180.tar.xz samba-58f9b5702a432a39a8276367532635300034d180.zip |
r25948: Fix up the samba3sam test (which is very fragile) to work with the new
restrictions imposed by the samldb module.
This module is worth keeping, because when we go back to do more
extensive backend mapping, the testing of this module shows it is
still possible.
Andrew Bartlett
(This used to be commit a10d2554dc1f9b57ce2a98ea20969b3b3c8aec53)
-rw-r--r-- | testdata/samba3/provision_samba3sam.ldif | 123 | ||||
-rwxr-xr-x | testprogs/ejs/samba3sam.js | 54 |
2 files changed, 42 insertions, 135 deletions
diff --git a/testdata/samba3/provision_samba3sam.ldif b/testdata/samba3/provision_samba3sam.ldif index c3e949c34b0..9d13f8a1e0e 100644 --- a/testdata/samba3/provision_samba3sam.ldif +++ b/testdata/samba3/provision_samba3sam.ldif @@ -75,127 +75,4 @@ isSynchronized: TRUE vendorName: Samba Team (http://samba.org) vendorVersion: ${VERSION} -dn: CN=Templates -objectClass: top -objectClass: container -cn: Templates -description: Container for SAM account templates -instanceType: 4 -showInAdvancedViewOnly: TRUE -systemFlags: 2348810240 -objectCategory: CN=Container,CN=Schema,CN=Configuration,${BASEDN} -isCriticalSystemObject: TRUE - -### -# note! the template users must not match normal searches. Be careful -# with what classes you put them in -### - -dn: CN=TemplateUser,CN=Templates -objectClass: top -objectClass: person -objectClass: organizationalPerson -objectClass: Template -objectClass: userTemplate -cn: TemplateUser -instanceType: 4 -userAccountControl: 514 -badPwdCount: 0 -codePage: 0 -countryCode: 0 -badPasswordTime: 0 -lastLogoff: 0 -lastLogon: 0 -pwdLastSet: 0 -primaryGroupID: 513 -accountExpires: -1 -logonCount: 0 -sAMAccountType: 805306368 -objectCategory: CN=Person,CN=Schema,CN=Configuration,${BASEDN} - -dn: CN=TemplateComputer,CN=Templates -objectClass: top -objectClass: person -objectClass: organizationalPerson -objectClass: Template -objectClass: userTemplate -cn: TemplateComputer -instanceType: 4 -userAccountControl: 4098 -badPwdCount: 0 -codePage: 0 -countryCode: 0 -badPasswordTime: 0 -lastLogoff: 0 -lastLogon: 0 -pwdLastSet: 0 -primaryGroupID: 513 -accountExpires: -1 -logonCount: 0 -sAMAccountType: 805306369 -objectCategory: CN=Computer,CN=Schema,CN=Configuration,${BASEDN} - -dn: CN=TemplateTrustingDomain,CN=Templates -objectClass: top -objectClass: Template -objectClass: userTemplate -cn: TemplateTrustingDomain -instanceType: 4 -userAccountControl: 2080 -badPwdCount: 0 -codePage: 0 -countryCode: 0 -badPasswordTime: 0 -lastLogoff: 0 -lastLogon: 0 -primaryGroupID: 513 -accountExpires: -1 -logonCount: 0 -sAMAccountType: 805306370 - -dn: CN=TemplateGroup,CN=Templates -objectClass: top -objectClass: Template -objectClass: groupTemplate -cn: TemplateGroup -instanceType: 4 -groupType: -2147483646 -sAMAccountType: 268435456 -objectCategory: CN=Group,CN=Schema,CN=Configuration,${BASEDN} - -# Currently this isn't used, we don't have a way to detect it different from an incoming alias -# -# dn: CN=TemplateAlias,CN=Templates -# objectClass: top -# objectClass: Template -# objectClass: aliasTemplate -# cn: TemplateAlias -# instanceType: 4 -# groupType: -2147483644 -# sAMAccountType: 268435456 - -dn: CN=TemplateForeignSecurityPrincipal,CN=Templates -objectClass: top -objectClass: Template -objectClass: foreignSecurityPrincipalTemplate -cn: TemplateForeignSecurityPrincipal -instanceType: 4 -showInAdvancedViewOnly: TRUE -objectCategory: CN=Foreign-Security-Principal,CN=Schema,CN=Configuration,${BASEDN} - -dn: CN=TemplateSecret,CN=Templates -objectClass: top -objectClass: leaf -objectClass: Template -objectClass: secretTemplate -cn: TemplateSecret -instanceType: 4 - -dn: CN=TemplateTrustedDomain,CN=Templates -objectClass: top -objectClass: leaf -objectClass: Template -objectClass: trustedDomainTemplate -cn: TemplateTrustedDomain -instanceType: 4 diff --git a/testprogs/ejs/samba3sam.js b/testprogs/ejs/samba3sam.js index 44a1f140b15..e5639b8ec81 100755 --- a/testprogs/ejs/samba3sam.js +++ b/testprogs/ejs/samba3sam.js @@ -263,7 +263,20 @@ function test_map_search(ldb, s3, s4) var dn; var attrs; - /* Add a set of split records */ + + var ldif = " +dn: " + "sambaDomainName=TESTS," + s3.BASEDN + " +objectclass: sambaDomain +objectclass: top +sambaSID: S-1-5-21-4231626423-2410014848-2360679739 +sambaNextRid: 2000 +sambaDomainName: TESTS" + ldif = substitute_var(ldif, s3); + assert(ldif != undefined); + var ok = s3.db.add(ldif); + assert(ok.error == 0); + + printf("Add a set of split records"); var ldif = " dn: " + s4.dn("cn=X") + " objectClass: user @@ -297,6 +310,7 @@ nextRid: y lastLogon: z description: y "; + ldif = substitute_var(ldif, s4); assert(ldif != undefined); var ok = ldb.add(ldif); @@ -305,7 +319,8 @@ description: y assert(ok.error == 0); } - /* Add a set of remote records */ + println("Add a set of remote records"); + var ldif = " dn: " + s3.dn("cn=A") + " objectClass: posixAccount @@ -429,7 +444,7 @@ description: y */ res = ldb.search("(objectSid=*)", NULL, ldb. SCOPE_DEFAULT, attrs); assert(res.error == 0); - assert(res.msgs.length == 2); + assert(res.msgs.length == 3); assert(res.msgs[0].dn == s4.dn("cn=X")); assert(res.msgs[0].dnsHostName == "x"); assert(res.msgs[0].lastLogon == "x"); @@ -610,7 +625,7 @@ description: y attrs = new Array("dnsHostName", "lastLogon"); res = ldb.search("(!(revision=x))", NULL, ldb.SCOPE_DEFAULT, attrs); assert(res.error == 0); - assert(res.msgs.length == 4); + assert(res.msgs.length == 5); assert(res.msgs[0].dn == s4.dn("cn=B")); assert(res.msgs[0].dnsHostName == undefined); assert(res.msgs[0].lastLogon == "y"); @@ -628,7 +643,7 @@ description: y attrs = new Array("dnsHostName", "lastLogon"); res = ldb.search("(!(description=x))", NULL, ldb.SCOPE_DEFAULT, attrs); assert(res.error == 0); - assert(res.msgs.length == 2); + assert(res.msgs.length == 3); assert(res.msgs[0].dn == s4.dn("cn=Z")); assert(res.msgs[0].dnsHostName == "z"); assert(res.msgs[0].lastLogon == "z"); @@ -640,7 +655,7 @@ description: y attrs = new Array("dnsHostName", "lastLogon"); res = ldb.search("(!(&(codePage=x)(revision=x)))", NULL, ldb.SCOPE_DEFAULT, attrs); assert(res.error == 0); - assert(res.msgs.length == 4); + assert(res.msgs.length == 5); assert(res.msgs[0].dn == s4.dn("cn=B")); assert(res.msgs[0].dnsHostName == undefined); assert(res.msgs[0].lastLogon == "y"); @@ -658,7 +673,7 @@ description: y attrs = new Array("dnsHostName", "lastLogon"); res = ldb.search("(!(&(lastLogon=x)(description=x)))", NULL, ldb.SCOPE_DEFAULT, attrs); assert(res.error == 0); - assert(res.msgs.length == 4); + assert(res.msgs.length == 5); assert(res.msgs[0].dn == s4.dn("cn=Y")); assert(res.msgs[0].dnsHostName == "y"); assert(res.msgs[0].lastLogon == "y"); @@ -676,7 +691,7 @@ description: y attrs = new Array("dnsHostName", "lastLogon"); res = ldb.search("(!(&(codePage=x)(description=x)))", NULL, ldb.SCOPE_DEFAULT, attrs); assert(res.error == 0); - assert(res.msgs.length == 4); + assert(res.msgs.length == 5); assert(res.msgs[0].dn == s4.dn("cn=B")); assert(res.msgs[0].dnsHostName == undefined); assert(res.msgs[0].lastLogon == "y"); @@ -711,7 +726,7 @@ description: y attrs = new Array("dnsHostName", "lastLogon"); res = ldb.search("(!(|(badPwdCount=x)(lastLogon=x)))", NULL, ldb.SCOPE_DEFAULT, attrs); assert(res.error == 0); - assert(res.msgs.length == 3); + assert(res.msgs.length == 4); assert(res.msgs[0].dn == s4.dn("cn=Y")); assert(res.msgs[0].dnsHostName == "y"); assert(res.msgs[0].lastLogon == "y"); @@ -726,7 +741,7 @@ description: y attrs = new Array("dnsHostName", "lastLogon"); res = ldb.search("(!(|(revision=x)(lastLogon=y)))", NULL, ldb.SCOPE_DEFAULT, attrs); assert(res.error == 0); - assert(res.msgs.length == 3); + assert(res.msgs.length == 4); assert(res.msgs[0].dn == s4.dn("cn=A")); assert(res.msgs[0].dnsHostName == undefined); assert(res.msgs[0].lastLogon == "x"); @@ -737,11 +752,11 @@ description: y assert(res.msgs[2].dnsHostName == undefined); assert(res.msgs[2].lastLogon == "z"); - /* Search by complex parse tree */ + println("Search by complex parse tree"); attrs = new Array("dnsHostName", "lastLogon"); res = ldb.search("(|(&(revision=x)(dnsHostName=x))(!(&(description=x)(nextRid=y)))(badPwdCount=y))", NULL, ldb.SCOPE_DEFAULT, attrs); assert(res.error == 0); - assert(res.msgs.length == 5); + assert(res.msgs.length == 6); assert(res.msgs[0].dn == s4.dn("cn=B")); assert(res.msgs[0].dnsHostName == undefined); assert(res.msgs[0].lastLogon == "y"); @@ -1174,18 +1189,28 @@ samba3.BASEDN = "cn=Samba3Sam"; samba3.db = ldb_init(); samba3.dn = make_dn; +var templates = new Object("templates partition info"); +templates.file = prefix + "/" + "templates.ldb"; +templates.url = "tdb://" + templates.file; +templates.BASEDN = "cn=templates"; +templates.db = ldb_init(); + sys.unlink(ldbfile); sys.unlink(samba3.file); +sys.unlink(templates.file); sys.unlink(samba4.file); var ok = ldb.connect(ldburl); assert(ok); var ok = samba3.db.connect(samba3.url); assert(ok); +var ok = templates.db.connect(templates.url); +assert(ok); var ok = samba4.db.connect(samba4.url); assert(ok); setup_data(samba3, sys.file_load(datadir + "/" + "samba3.ldif")); +setup_data(templates, sys.file_load(datadir + "/" + "provision_samba3sam_templates.ldif")); setup_modules(ldb, samba3, samba4, sys.file_load(datadir + "/" + "provision_samba3sam.ldif")); ldb = ldb_init(); @@ -1197,6 +1222,7 @@ test_s3sam_modify(ldb, samba3); sys.unlink(ldbfile); sys.unlink(samba3.file); +sys.unlink(templates.file); sys.unlink(samba4.file); ldb = ldb_init(); @@ -1205,10 +1231,14 @@ assert(ok); samba3.db = ldb_init(); var ok = samba3.db.connect(samba3.url); assert(ok); +templates.db = ldb_init(); +var ok = templates.db.connect(templates.url); +assert(ok); samba4.db = ldb_init(); var ok = samba4.db.connect(samba4.url); assert(ok); +setup_data(templates, sys.file_load(datadir + "/" + "provision_samba3sam_templates.ldif")); setup_modules(ldb, samba3, samba4, sys.file_load(datadir + "provision_samba3sam.ldif")); ldb = ldb_init(); |