diff options
author | Simo Sorce <idra@samba.org> | 2005-07-02 18:34:13 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:19:06 -0500 |
commit | e6b353e7640dcc98cd6d519cee1d5ff42e8c676f (patch) | |
tree | 11b99e204db841a42540bcc3b036dca6c883a10d /source4 | |
parent | 1c5105065a44173667de2a022dd2417e56b527d6 (diff) | |
download | samba-e6b353e7640dcc98cd6d519cee1d5ff42e8c676f.tar.gz samba-e6b353e7640dcc98cd6d519cee1d5ff42e8c676f.tar.bz2 samba-e6b353e7640dcc98cd6d519cee1d5ff42e8c676f.zip |
r8083: check attribute type is valid (only ascii alphanum chars and '-' char)
fail if not
(This used to be commit b1a61cd5d03b4c61b81c810123ffeb3621831617)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb/common/ldb_dn.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c index 18b620b506..8b9cf4e129 100644 --- a/source4/lib/ldb/common/ldb_dn.c +++ b/source4/lib/ldb/common/ldb_dn.c @@ -41,6 +41,21 @@ #define LDB_DN_NULL_FAILED(x) if (!(x)) goto failed +static int ldb_dn_is_valid_attribute_name(const char *name) +{ + while (*name) { + if (! isascii(*name)) { + return 0; + } + if (! (isalnum(*name) || *name == '-')) { + return 0; + } + name++; + } + + return 1; +} + static char *ldb_dn_escape_value(void *mem_ctx, struct ldb_val value) { const char *p, *s, *src; @@ -250,6 +265,10 @@ static struct ldb_dn_component ldb_dn_explode_component(void *mem_ctx, char *raw if (!dc.name) return dc; + if (! ldb_dn_is_valid_attribute_name(dc.name)) { + goto failed; + } + ret = get_quotes_position(p, &qs, &qe); switch (ret) { |