svn commit: samba r12580 - in branches/SAMBA_4_0/source/nbt_server/wins: .

metze at samba.org metze at samba.org
Thu Dec 29 18:54:16 GMT 2005


Author: metze
Date: 2005-12-29 18:54:16 +0000 (Thu, 29 Dec 2005)
New Revision: 12580

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12580

Log:
return the first 0x1B address as first address to 0x1C queries

metze
Modified:
   branches/SAMBA_4_0/source/nbt_server/wins/winsserver.c


Changeset:
Modified: branches/SAMBA_4_0/source/nbt_server/wins/winsserver.c
===================================================================
--- branches/SAMBA_4_0/source/nbt_server/wins/winsserver.c	2005-12-29 17:03:39 UTC (rev 12579)
+++ branches/SAMBA_4_0/source/nbt_server/wins/winsserver.c	2005-12-29 18:54:16 UTC (rev 12580)
@@ -334,13 +334,31 @@
 	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 @@
 		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);



More information about the samba-cvs mailing list