[SCM] Samba Shared Repository - branch master updated
Matthias Dieter Wallnöfer
mdw at samba.org
Sun Nov 7 14:13:01 MST 2010
The branch, master has been updated
via 9ba7ce6 s4:ldap.py - add more "objectGUID" related tests
via 225f102 s4:objectguid LDB module - fix typo in output message
via 2c76be7 s4:objectguid LDB module - objectGUIDs cannot be specified on add operations
from c89bc83 s4:upgradeprovision - remove some "recalculate_sd" uses
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 9ba7ce6acf0ea0679933fdac5e73925927673761
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sun Nov 7 20:10:48 2010 +0100
s4:ldap.py - add more "objectGUID" related tests
Autobuild-User: Matthias Dieter Wallnöfer <mdw at samba.org>
Autobuild-Date: Sun Nov 7 21:12:03 UTC 2010 on sn-devel-104
commit 225f1021060cc2a4cede905e84aa41304f273bee
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sun Nov 7 20:10:29 2010 +0100
s4:objectguid LDB module - fix typo in output message
commit 2c76be76d5edad69c2daf5999266dddcbc2d1270
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sun Nov 7 20:09:51 2010 +0100
s4:objectguid LDB module - objectGUIDs cannot be specified on add operations
-----------------------------------------------------------------------
Summary of changes:
source4/dsdb/samdb/ldb_modules/objectguid.c | 10 +++-
source4/dsdb/tests/python/ldap.py | 78 ++++++++++++++++++++++++++-
2 files changed, 83 insertions(+), 5 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c
index 28d253a..623185f 100644
--- a/source4/dsdb/samdb/ldb_modules/objectguid.c
+++ b/source4/dsdb/samdb/ldb_modules/objectguid.c
@@ -128,6 +128,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req)
struct ldb_context *ldb;
struct ldb_request *down_req;
struct ldb_message *msg;
+ struct ldb_message_element *el;
struct GUID guid;
uint64_t seq_num;
int ret;
@@ -143,8 +144,11 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req)
return ldb_next_request(module, req);
}
- if (ldb_msg_find_element(req->op.add.message, "objectGUID") != NULL) {
- return ldb_next_request(module, req);
+ el = ldb_msg_find_element(req->op.add.message, "objectGUID");
+ if (el != NULL) {
+ ldb_set_errstring(ldb,
+ "objectguid: objectGUID must not be specified!");
+ return LDB_ERR_UNWILLING_TO_PERFORM;
}
ac = talloc(req, struct og_context);
@@ -212,7 +216,7 @@ static int objectguid_modify(struct ldb_module *module, struct ldb_request *req)
ldb = ldb_module_get_ctx(module);
- ldb_debug(ldb, LDB_DEBUG_TRACE, "objectguid_add_record\n");
+ ldb_debug(ldb, LDB_DEBUG_TRACE, "objectguid_modify_record\n");
/* do not manipulate our control entries */
if (ldb_dn_is_special(req->op.add.message->dn)) {
diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py
index 18af214..26969cc 100755
--- a/source4/dsdb/tests/python/ldap.py
+++ b/source4/dsdb/tests/python/ldap.py
@@ -25,6 +25,7 @@ from ldb import ERR_OBJECT_CLASS_VIOLATION, ERR_NOT_ALLOWED_ON_RDN
from ldb import ERR_NAMING_VIOLATION, ERR_CONSTRAINT_VIOLATION
from ldb import Message, MessageElement, Dn
from ldb import FLAG_MOD_ADD, FLAG_MOD_REPLACE, FLAG_MOD_DELETE
+from ldb import timestring
from samba import Ldb
from samba.dsdb import (UF_NORMAL_ACCOUNT,
UF_WORKSTATION_TRUST_ACCOUNT,
@@ -1250,12 +1251,85 @@ objectClass: container
self.assertEquals(len(res), 1, "Wrong number of hits for (&(cn=ldaptestuser5)(objectclass=user))")
self.delete_force(self.ldb, "cn=ldaptestuser5,cn=users," + self.base_dn)
+ def test_objectGUID(self):
+ """Test objectGUID behaviour"""
+ print "Testing objectGUID behaviour\n"
+
+ # The objectGUID cannot directly be set
+ try:
+ self.ldb.add_ldif("""
+dn: cn=ldaptestcontainer,""" + self.base_dn + """
+objectClass: container
+objectGUID: bd3480c9-58af-4cd8-92df-bc4a18b6e44d
+""")
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
+
+ self.ldb.add({
+ "dn": "cn=ldaptestcontainer," + self.base_dn,
+ "objectClass": "container" })
+
+ res = ldb.search("cn=ldaptestcontainer," + self.base_dn,
+ scope=SCOPE_BASE,
+ attrs=["objectGUID", "uSNCreated", "uSNChanged", "whenCreated", "whenChanged"])
+ self.assertTrue(len(res) == 1)
+ self.assertTrue("objectGUID" in res[0])
+ self.assertTrue("uSNCreated" in res[0])
+ self.assertTrue("uSNChanged" in res[0])
+ self.assertTrue("whenCreated" in res[0])
+ self.assertTrue("whenChanged" in res[0])
+
+ self.delete_force(self.ldb, "cn=ldaptestcontainer," + self.base_dn)
+
+ # All the following attributes are specificable on add operations
+ self.ldb.add({
+ "dn": "cn=ldaptestcontainer," + self.base_dn,
+ "objectClass": "container",
+ "uSNCreated" : "1",
+ "uSNChanged" : "1",
+ "whenCreated": timestring(long(time.time())),
+ "whenChanged": timestring(long(time.time())) })
+
+ res = ldb.search("cn=ldaptestcontainer," + self.base_dn,
+ scope=SCOPE_BASE,
+ attrs=["objectGUID", "uSNCreated", "uSNChanged", "whenCreated", "whenChanged"])
+ self.assertTrue(len(res) == 1)
+ self.assertTrue("objectGUID" in res[0])
+ self.assertTrue("uSNCreated" in res[0])
+ self.assertFalse(res[0]["uSNCreated"][0] == "1") # these are corrected
+ self.assertTrue("uSNChanged" in res[0])
+ self.assertFalse(res[0]["uSNChanged"][0] == "1") # these are corrected
+
+ self.delete_force(self.ldb, "cn=ldaptestcontainer," + self.base_dn)
+
+ # All this attributes are specificable on add operations
+ self.ldb.add({
+ "dn": "cn=ldaptestcontainer," + self.base_dn,
+ "objectclass": "container",
+ "uSNCreated" : "1",
+ "uSNChanged" : "1",
+ "whenCreated": timestring(long(time.time())),
+ "whenChanged": timestring(long(time.time())) })
+
+ res = ldb.search("cn=ldaptestcontainer," + self.base_dn,
+ scope=SCOPE_BASE,
+ attrs=["objectGUID", "uSNCreated", "uSNChanged", "whenCreated", "whenChanged"])
+ self.assertTrue(len(res) == 1)
+ self.assertTrue("objectGUID" in res[0])
+ self.assertTrue("uSNCreated" in res[0])
+ self.assertFalse(res[0]["uSNCreated"][0] == "1") # these are corrected
+ self.assertTrue("uSNChanged" in res[0])
+ self.assertFalse(res[0]["uSNChanged"][0] == "1") # these are corrected
+ self.assertTrue("whenCreated" in res[0])
+ self.assertTrue("whenChanged" in res[0])
+
+ self.delete_force(self.ldb, "cn=ldaptestcontainer," + self.base_dn)
+
def test_parentGUID(self):
"""Test parentGUID behaviour"""
print "Testing parentGUID behaviour\n"
- # TODO: This seems to fail on Windows Server. Hidden attribute?
-
self.ldb.add({
"dn": "cn=parentguidtest,cn=users," + self.base_dn,
"objectclass":"user",
--
Samba Shared Repository
More information about the samba-cvs
mailing list