From 67bf17598bd755ac07952fc44ce27031478d5503 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 2 Sep 2009 13:33:37 +1000 Subject: 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 --- source4/lib/ldb/common/ldb_controls.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source4') 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 *, -- cgit