summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-01-13 11:08:40 +1100
committerAndrew Tridgell <tridge@samba.org>2011-01-14 16:39:32 +1100
commit27d7f6a31203c6ab3c5b1e3d667fc1c4c79d334f (patch)
treef14d6bcde4d294c0b0b4ae2907e03806e940fe1a /source4/dsdb/samdb
parentfb704d7fc1336ad73f685abd8ac454bbde8ac966 (diff)
downloadsamba-27d7f6a31203c6ab3c5b1e3d667fc1c4c79d334f.tar.gz
samba-27d7f6a31203c6ab3c5b1e3d667fc1c4c79d334f.tar.bz2
samba-27d7f6a31203c6ab3c5b1e3d667fc1c4c79d334f.zip
s4-dsdb: validate number of extended components
this checks that the number of extended components in a DN is valid, to match MS AD behaviour. We need to do this to ensure that our tools don't try to do operations that will be invalid when used against MS servers Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/extended_dn_in.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn_in.c b/source4/dsdb/samdb/ldb_modules/extended_dn_in.c
index 39e69d9b1e..4071adda79 100644
--- a/source4/dsdb/samdb/ldb_modules/extended_dn_in.c
+++ b/source4/dsdb/samdb/ldb_modules/extended_dn_in.c
@@ -273,6 +273,12 @@ static int extended_dn_in_fix(struct ldb_module *module, struct ldb_request *req
} else {
/* It looks like we need to map the DN */
const struct ldb_val *sid_val, *guid_val, *wkguid_val;
+ int num_components = ldb_dn_get_comp_num(dn);
+ int num_ex_components = ldb_dn_get_extended_comp_num(dn);
+
+ if (num_components != 0 || num_ex_components != 1) {
+ return ldb_error(ldb_module_get_ctx(module), LDB_ERR_INVALID_DN_SYNTAX, "invalid number of DN components");
+ }
sid_val = ldb_dn_get_extended_component(dn, "SID");
guid_val = ldb_dn_get_extended_component(dn, "GUID");
@@ -311,7 +317,8 @@ static int extended_dn_in_fix(struct ldb_module *module, struct ldb_request *req
p = strchr(wkguid_dup, ',');
if (!p) {
- return LDB_ERR_INVALID_DN_SYNTAX;
+ return ldb_error(ldb_module_get_ctx(module), LDB_ERR_INVALID_DN_SYNTAX,
+ "Invalid WKGUID format");
}
p[0] = '\0';
@@ -336,7 +343,8 @@ static int extended_dn_in_fix(struct ldb_module *module, struct ldb_request *req
base_dn_scope = LDB_SCOPE_BASE;
base_dn_attrs = wkattr;
} else {
- return LDB_ERR_INVALID_DN_SYNTAX;
+ return ldb_error(ldb_module_get_ctx(module), LDB_ERR_INVALID_DN_SYNTAX,
+ "Invalid extended DN component");
}
ac = talloc_zero(req, struct extended_search_context);