From 3bbe3fe4ce33a4a8bc2d3cef640ad16c5e49b843 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 15 Feb 2005 05:14:09 +0000 Subject: r5404: allow spaces in the string representation of nbt names (This used to be commit dd3d4ded21e50130243de3b35927368875620d47) --- source4/libcli/nbt/nbtname.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source4/libcli') diff --git a/source4/libcli/nbt/nbtname.c b/source4/libcli/nbt/nbtname.c index fc87c2f4b2..bf545a6374 100644 --- a/source4/libcli/nbt/nbtname.c +++ b/source4/libcli/nbt/nbtname.c @@ -334,10 +334,11 @@ static const char *nbt_hex_encode(TALLOC_CTX *mem_ctx, const char *s) { int i, len; char *ret; - const char *valid_chars = "_-.$@"; + const char *valid_chars = "_-.$@ "; +#define NBT_CHAR_ALLOW(c) (isalnum(c) || strchr(valid_chars, c)) for (len=i=0;s[i];i++,len++) { - if (!isalnum(s[i]) && !strchr(valid_chars, s[i])) { + if (!NBT_CHAR_ALLOW(s[i])) { len += 2; } } @@ -346,7 +347,7 @@ static const char *nbt_hex_encode(TALLOC_CTX *mem_ctx, const char *s) if (ret == NULL) return NULL; for (len=i=0;s[i];i++) { - if (isalnum(s[i]) || strchr(valid_chars, s[i])) { + if (NBT_CHAR_ALLOW(s[i])) { ret[len++] = s[i]; } else { snprintf(&ret[len], 4, "%%%02x", (unsigned char)s[i]); -- cgit