From 5940ca60e23d142e4d3d0b2ce12f191663147d03 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 11 Nov 2009 19:24:48 +1100 Subject: s4:ldb Don't segfault if we somehow get an unknown extended dn element --- source4/lib/ldb/common/ldb_dn.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c index 036f4a223e..9ac654973a 100644 --- a/source4/lib/ldb/common/ldb_dn.c +++ b/source4/lib/ldb/common/ldb_dn.c @@ -781,6 +781,9 @@ char *ldb_dn_get_extended_linearized(void *mem_ctx, struct ldb_dn *dn, int mode) int ret; ext_syntax = ldb_dn_extended_syntax_by_name(dn->ldb, name); + if (!ext_syntax) { + return NULL; + } if (mode == 1) { ret = ext_syntax->write_clear_fn(dn->ldb, mem_ctx, @@ -1823,6 +1826,11 @@ int ldb_dn_set_extended_component(struct ldb_dn *dn, return LDB_ERR_OTHER; } + if (!ldb_dn_extended_syntax_by_name(dn->ldb, name)) { + /* We don't know how to handle this type of thing */ + return LDB_ERR_INVALID_DN_SYNTAX; + } + for (i=0; i < dn->ext_comp_num; i++) { if (ldb_attr_cmp(dn->ext_components[i].name, name) == 0) { if (val) { -- cgit