1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-20 22:50:26 +03:00

r16061: Prove that removing the objectClass list in the samldb module breaks things.

With this fix, we now correctly detect computers again, and get the
correct objectCategory, which is important for the OSX AD plugin.

Andrew Bartlett
(This used to be commit 4e39d7bb245bc337ac496c7e39a510d1c5611c71)
This commit is contained in:
Andrew Bartlett 2006-06-06 17:19:58 +00:00 committed by Gerald (Jerry) Carter
parent 1335e8f5f1
commit 629d6ad3cf
2 changed files with 54 additions and 8 deletions

View File

@ -615,9 +615,6 @@ static int samldb_fill_user_or_computer_object(struct ldb_module *module, const
return LDB_ERR_OPERATIONS_ERROR;
}
/* remove objectclasses so that they will be added in the right order for MMC to be happy */
ldb_msg_remove_attr(msg, "objectclass");
if (samldb_find_attribute(msg, "objectclass", "computer") != NULL) {
ret = samldb_copy_template(module, msg2, "(&(CN=TemplateComputer)(objectclass=userTemplate))");

View File

@ -54,6 +54,28 @@ cn: LDAPtestUSER
}
}
var ok = ldb.add("
dn: cn=ldaptestcomputer,cn=computers," + base_dn + "
objectClass: computer
cn: LDAPtestCOMPUTER
");
if (!ok) {
ok = ldb.del("cn=ldaptestcomputer,cn=computers," + base_dn);
if (!ok) {
println(ldb.errstring());
assert(ok);
}
ok = ldb.add("
dn: cn=ldaptestcomputer,cn=computers," + base_dn + "
objectClass: computer
cn: LDAPtestCOMPUTER
");
if (!ok) {
println(ldb.errstring());
assert(ok);
}
}
ok = ldb.add("
dn: cn=ldaptestuser2,cn=users," + base_dn + "
objectClass: person
@ -134,23 +156,50 @@ objectClass: user
assert(res[0].objectClass[3] == "user");
assert(res[0].objectGUID != undefined);
assert(res[0].whenCreated != undefined);
assert(res[0].objectCategory == "cn=Person,cn=Schema,cn=Configuration," + base_dn);
println("Testing ldb.search for (&(cn=ldaptestuser)(objectClass=user))");
var res = ldb.search("(&(cn=ldaptestuser)(objectClass=user))");
println("Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))");
var res2 = ldb.search("(&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))");
if (res.length != 1) {
println("Could not find (&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))");
assert(res.length == 1);
}
assert(res[0].dn == res2[0].dn);
ok = ldb.del(res[0].dn);
if (!ok) {
println(ldb.errstring());
assert(ok);
}
println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectClass=user))");
var res = ldb.search("(&(cn=ldaptestcomputer)(objectClass=user))");
if (res.length != 1) {
println("Could not find (&(cn=ldaptestuser)(objectClass=user))");
assert(res.length == 1);
}
assert(res[0].dn == "cn=ldaptestuser,cn=users," + base_dn);
assert(res[0].cn == "ldaptestuser");
assert(res[0].name == "ldaptestuser");
assert(res[0].dn == "cn=ldaptestcomputer,cn=computers," + base_dn);
assert(res[0].cn == "ldaptestcomputer");
assert(res[0].name == "ldaptestcomputer");
assert(res[0].objectClass[0] == "top");
assert(res[0].objectClass[1] == "person");
assert(res[0].objectClass[2] == "organizationalPerson");
assert(res[0].objectClass[3] == "user");
assert(res[0].objectClass[4] == "computer");
assert(res[0].objectGUID != undefined);
assert(res[0].whenCreated != undefined);
assert(res[0].objectCategory == "cn=Computer,cn=Schema,cn=Configuration," + base_dn);
println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))");
var res2 = ldb.search("(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))");
if (res.length != 1) {
println("Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))");
assert(res.length == 1);
}
assert(res[0].dn == res2[0].dn);
ok = ldb.del(res[0].dn);
if (!ok) {