From 49736de46a340ed9256d7a914631a67453aa7530 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 24 Jun 2005 05:17:36 +0000 Subject: r7873: hopefully fixed build of ldb_explode_dn() on AIX I'd really rather see this code completely replaced, but I'll leave that to simo (he has volunteered) :-) (This used to be commit cc2e08d68e27aa203ccc26e8d544a86de3399877) --- source4/lib/ldb/common/ldb_explode_dn.c | 36 +++++++++------------------------ 1 file changed, 9 insertions(+), 27 deletions(-) (limited to 'source4/lib/ldb/common/ldb_explode_dn.c') diff --git a/source4/lib/ldb/common/ldb_explode_dn.c b/source4/lib/ldb/common/ldb_explode_dn.c index 0dcca5dc70..0e2efa876c 100644 --- a/source4/lib/ldb/common/ldb_explode_dn.c +++ b/source4/lib/ldb/common/ldb_explode_dn.c @@ -35,7 +35,6 @@ * Author: Derrell Lipman */ -#include #include "includes.h" #include "ldb/include/ldb.h" #include "ldb/include/ldb_private.h" @@ -496,35 +495,18 @@ failed: } -static char * -parse_slash(char *p, - char *end) +static char *parse_slash(char *p, char *end) { - switch (*(p + 1)) { - case ',': - case '=': - case '\n': - case '+': - case '<': - case '>': - case '#': - case ';': - case '\\': - case '"': + unsigned x; + if (strchr(",=\n+<>#;\\\"", p[1])) { memmove(p, p + 1, end - (p + 1)); return (end - 1); - - default: - if (isxdigit(p[1]) && isxdigit(p[2])) { - int x; - - sscanf(p + 1, "%02x", &x); - *p = (char) x; - memmove(p + 1, p + 3, end - (p + 3)); - return (end - 2); - } else { - return NULL; - } } + if (sscanf(p + 1, "%02x", &x) == 1) { + *p = (unsigned char)x; + memmove(p + 1, p + 3, end - (p + 3)); + return (end - 2); + } + return NULL; } -- cgit