From b4fd76f78eadd8648ceed508766235e80702aa8f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 30 Nov 2004 02:15:43 +0000 Subject: [PATCH] r4010: fixed parsing of null attributes in the ldb ldif parser --- source/lib/ldb/common/ldb_ldif.c | 8 ++++++-- source/lib/ldb/tests/init.ldif | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/source/lib/ldb/common/ldb_ldif.c b/source/lib/ldb/common/ldb_ldif.c index bd99468182d..94e15805a66 100644 --- a/source/lib/ldb/common/ldb_ldif.c +++ b/source/lib/ldb/common/ldb_ldif.c @@ -128,7 +128,11 @@ int ldb_should_b64_encode(const struct ldb_val *val) unsigned int i; uint8_t *p = val->data; - if (val->length == 0 || p[0] == ' ' || p[0] == ':') { + if (val->length == 0) { + return 0; + } + + if (p[0] == ' ' || p[0] == ':') { return 1; } @@ -377,7 +381,7 @@ static int next_attr(char **s, const char **attr, struct ldb_val *value) *attr = *s; - while (isspace(*p)) { + while (*p == ' ' || *p == '\t') { p++; } diff --git a/source/lib/ldb/tests/init.ldif b/source/lib/ldb/tests/init.ldif index a9ed4506fb3..3b0eeffe2f1 100644 --- a/source/lib/ldb/tests/init.ldif +++ b/source/lib/ldb/tests/init.ldif @@ -9,6 +9,7 @@ o: UM o: U-M o: U of M description: The University of Michigan at Ann Arbor +seeAlso: postaladdress: University of Michigan $ 535 W. William St. $ Ann Arbor, MI 481 09 $ US telephonenumber: +1 313 764-1817