summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-12-29 18:54:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:48:56 -0500
commit70a15ba4df525838474dce086989582adf6e4de8 (patch)
tree0e0270bdfeee84e06e26ed2586ee46ee7964e8db
parent2842acf5e30077a702632dd5d7b0ad0ce59b6a62 (diff)
downloadsamba-70a15ba4df525838474dce086989582adf6e4de8.tar.gz
samba-70a15ba4df525838474dce086989582adf6e4de8.tar.bz2
samba-70a15ba4df525838474dce086989582adf6e4de8.zip
r12580: return the first 0x1B address as first address to 0x1C queries
metze (This used to be commit 669009579dfe93b4d5008f93c2949dd4d929baf4)
-rw-r--r--source4/nbt_server/wins/winsserver.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source4/nbt_server/wins/winsserver.c b/source4/nbt_server/wins/winsserver.c
index e30ac11397..02b2048f73 100644
--- a/source4/nbt_server/wins/winsserver.c
+++ b/source4/nbt_server/wins/winsserver.c
@@ -334,13 +334,31 @@ static void nbtd_winsserver_query(struct nbt_name_socket *nbtsock,
struct wins_server *winssrv = iface->nbtsrv->winssrv;
struct nbt_name *name = &packet->questions[0].name;
struct winsdb_record *rec;
+ struct winsdb_record *rec_1b = NULL;
const char **addresses;
+ const char **addresses_1b = NULL;
uint16_t nb_flags = 0; /* TODO: ... */
if (name->type == NBT_NAME_MASTER) {
goto notfound;
}
+ /*
+ * w2k3 returns the first address of the 0x1B record as first address
+ * to a 0x1C query
+ */
+ if (name->type == NBT_NAME_LOGON) {
+ struct nbt_name name_1b;
+
+ name_1b = *name;
+ name_1b.type = NBT_NAME_PDC;
+
+ status = winsdb_lookup(winssrv->wins_db, &name_1b, packet, &rec_1b);
+ if (NT_STATUS_IS_OK(status)) {
+ addresses_1b = winsdb_addr_string_list(packet, rec_1b->addresses);
+ }
+ }
+
status = winsdb_lookup(winssrv->wins_db, name, packet, &rec);
if (!NT_STATUS_IS_OK(status)) {
goto notfound;
@@ -371,6 +389,30 @@ static void nbtd_winsserver_query(struct nbt_name_socket *nbtsock,
goto notfound;
}
+ /*
+ * if addresses_1b isn't NULL, we have a 0x1C query and need to return the
+ * first 0x1B address as first address
+ */
+ if (addresses_1b && addresses_1b[0]) {
+ const char **addresses_1c = addresses;
+ uint32_t i;
+
+ addresses = str_list_add(NULL, addresses_1b[0]);
+ if (!addresses) {
+ goto notfound;
+ }
+ talloc_steal(packet, addresses);
+
+ for (i=0; addresses_1c[i]; i++) {
+ if (strcmp(addresses_1b[0], addresses_1c[i]) == 0) continue;
+
+ addresses = str_list_add(addresses, addresses_1c[i]);
+ if (!addresses) {
+ goto notfound;
+ }
+ }
+ }
+
found:
nbtd_name_query_reply(nbtsock, packet, src, name,
0, nb_flags, addresses);