summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-02 13:33:37 +1000
committerAndrew Tridgell <tridge@samba.org>2009-09-02 18:19:55 +1000
commit67bf17598bd755ac07952fc44ce27031478d5503 (patch)
tree122658d57835e5b679cd25ce587b7171508d97c1 /source4
parent4b336fed94b953cd78087a1ffcf75b65cb846c0f (diff)
downloadsamba-67bf17598bd755ac07952fc44ce27031478d5503.tar.gz
samba-67bf17598bd755ac07952fc44ce27031478d5503.tar.bz2
samba-67bf17598bd755ac07952fc44ce27031478d5503.zip
don't allow two controls to be added with the same OID
Two controls with the same OID makes no sense, as they may have different data attached
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/common/ldb_controls.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source4/lib/ldb/common/ldb_controls.c b/source4/lib/ldb/common/ldb_controls.c
index 3c2ef5ea00..b38373ec12 100644
--- a/source4/lib/ldb/common/ldb_controls.c
+++ b/source4/lib/ldb/common/ldb_controls.c
@@ -127,7 +127,13 @@ int ldb_request_add_control(struct ldb_request *req, const char *oid, bool criti
struct ldb_control **ctrls;
struct ldb_control *ctrl;
- for (n=0; req->controls && req->controls[n];) { n++; }
+ for (n=0; req->controls && req->controls[n];) {
+ /* having two controls of the same OID makes no sense */
+ if (strcmp(oid, req->controls[n]->oid) == 0) {
+ return LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS;
+ }
+ n++;
+ }
ctrls = talloc_realloc(req, req->controls,
struct ldb_control *,