svn commit: samba r8083 - in
branches/SAMBA_4_0/source/lib/ldb/common: .
idra at samba.org
idra at samba.org
Sat Jul 2 18:34:14 GMT 2005
Author: idra
Date: 2005-07-02 18:34:13 +0000 (Sat, 02 Jul 2005)
New Revision: 8083
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8083
Log:
check attribute type is valid (only ascii alphanum chars and '-' char)
fail if not
Modified:
branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c 2005-07-02 17:30:03 UTC (rev 8082)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c 2005-07-02 18:34:13 UTC (rev 8083)
@@ -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 @@
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) {
More information about the samba-cvs
mailing list