summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-02-15 05:14:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:10:42 -0500
commit3bbe3fe4ce33a4a8bc2d3cef640ad16c5e49b843 (patch)
tree801d1f125a8bc3b7db61d1ea6bab5669ecd8c353
parent82e6a6e46b53843f21dd02b342868380c770a8fa (diff)
downloadsamba-3bbe3fe4ce33a4a8bc2d3cef640ad16c5e49b843.tar.gz
samba-3bbe3fe4ce33a4a8bc2d3cef640ad16c5e49b843.tar.bz2
samba-3bbe3fe4ce33a4a8bc2d3cef640ad16c5e49b843.zip
r5404: allow spaces in the string representation of nbt names
(This used to be commit dd3d4ded21e50130243de3b35927368875620d47)
-rw-r--r--source4/libcli/nbt/nbtname.c7
1 files changed, 4 insertions, 3 deletions
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]);