summaryrefslogtreecommitdiff
path: root/source4/libcli/nbt
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-04-14 07:40:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:33 -0500
commite284a262942eb8c69d7862cb61bf4542baec6032 (patch)
tree74c000adaa7fbe5b73e943272050d612112ff3a3 /source4/libcli/nbt
parent8c4e06004cf5e95ea861440ef0ec0b4ddacf4c10 (diff)
downloadsamba-e284a262942eb8c69d7862cb61bf4542baec6032.tar.gz
samba-e284a262942eb8c69d7862cb61bf4542baec6032.tar.bz2
samba-e284a262942eb8c69d7862cb61bf4542baec6032.zip
r6338: ADS style GETDC response now works well enough that WinXP can join
Samba4 without Samba3 nmbd (This used to be commit f4d07d7d3b6973b503d8c98f177471dd6cebfa92)
Diffstat (limited to 'source4/libcli/nbt')
-rw-r--r--source4/libcli/nbt/nbtname.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source4/libcli/nbt/nbtname.c b/source4/libcli/nbt/nbtname.c
index f7d19d11cf..5f344d9c6d 100644
--- a/source4/libcli/nbt/nbtname.c
+++ b/source4/libcli/nbt/nbtname.c
@@ -144,6 +144,11 @@ NTSTATUS ndr_push_nbt_string(struct ndr_push *ndr, int ndr_flags, const char *s)
return NT_STATUS_OK;
}
+ if (s == NULL || *s == 0) {
+ return ndr_push_bytes(ndr, "", 1);
+ }
+
+
fullname = talloc_strdup(ndr, "");
NT_STATUS_HAVE_NO_MEMORY(fullname);
@@ -162,11 +167,14 @@ NTSTATUS ndr_push_nbt_string(struct ndr_push *ndr, int ndr_flags, const char *s)
so, we can use a NBT name pointer. This allows us to fit
longer names into the packet */
fulllen = strlen(fullname)+1;
- for (i=0;i + fulllen < ndr->offset;i++) {
+ for (i=0;i + fulllen <= ndr->offset;i++) {
if (ndr->data[i] == fullname[0] &&
memcmp(fullname, &ndr->data[i], fulllen) == 0) {
+ uint8_t b[2];
talloc_free(fullname);
- return ndr_push_uint16(ndr, NDR_SCALARS, 0xC000 | i);
+ b[0] = 0xC0 | (i>>8);
+ b[1] = (i&0xFF);
+ return ndr_push_bytes(ndr, b, 2);
}
}