summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-19 19:33:16 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-19 19:37:47 +0200
commit131be8da0fa2db11b91cb08a182a524832db1d41 (patch)
tree5db30c1204c02bdcd8b14f7a8bd6ce9cbdd12ee8 /source4/dsdb/samdb
parent3055ead4cff55895917ca88c3fb91c89da34ad5f (diff)
downloadsamba-131be8da0fa2db11b91cb08a182a524832db1d41.tar.gz
samba-131be8da0fa2db11b91cb08a182a524832db1d41.tar.bz2
samba-131be8da0fa2db11b91cb08a182a524832db1d41.zip
s4:instancetype LDB module - "instanceType" is single-valued - MS-ADTS 3.1.1.5.2.2
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/instancetype.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/instancetype.c b/source4/dsdb/samdb/ldb_modules/instancetype.c
index 4ed906f362..f71a8d3948 100644
--- a/source4/dsdb/samdb/ldb_modules/instancetype.c
+++ b/source4/dsdb/samdb/ldb_modules/instancetype.c
@@ -84,6 +84,7 @@ static int instancetype_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 it_context *ac;
uint32_t instance_type;
int ret;
@@ -97,8 +98,17 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
return ldb_next_request(module, req);
}
- if (ldb_msg_find_element(req->op.add.message, "instanceType")) {
- unsigned int instanceType = ldb_msg_find_attr_as_uint(req->op.add.message, "instanceType", 0);
+ el = ldb_msg_find_element(req->op.add.message, "instanceType");
+ if (el != NULL) {
+ unsigned int instanceType;
+
+ if (el->num_values != 1) {
+ ldb_set_errstring(ldb, "instancetype: the 'instanceType' attribute is single-valued!");
+ return LDB_ERR_UNWILLING_TO_PERFORM;
+ }
+
+ instanceType = ldb_msg_find_attr_as_uint(req->op.add.message,
+ "instanceType", 0);
if (!(instanceType & INSTANCE_TYPE_IS_NC_HEAD)) {
return ldb_next_request(module, req);
}