svn commit: samba r13103 - in branches/SAMBA_4_0/source/libcli: .

abartlet at samba.org abartlet at samba.org
Tue Jan 24 01:57:32 GMT 2006


Author: abartlet
Date: 2006-01-24 01:57:31 +0000 (Tue, 24 Jan 2006)
New Revision: 13103

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

Log:
Walk the names in the node status request, so I can find a server
name, and use that.

(I was trying to find a machine by the name of __SAMBA__)

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/libcli/finddcs.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/finddcs.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/finddcs.c	2006-01-24 01:52:56 UTC (rev 13102)
+++ branches/SAMBA_4_0/source/libcli/finddcs.c	2006-01-24 01:57:31 UTC (rev 13103)
@@ -209,23 +209,26 @@
 /* We have a node status reply (or perhaps a timeout) */
 static void fallback_node_status_replied(struct nbt_name_request *name_req) 
 {
+	int i;
 	struct finddcs_state *state = talloc_get_type(name_req->async.private, struct finddcs_state);
 	state->ctx->status = nbt_name_status_recv(name_req, state, &state->node_status);
 	if (!composite_is_ok(state->ctx)) return;
 
-	if (state->node_status.out.status.num_names > 0) {
-		int i;
-		char *name = talloc_strndup(state->dcs, state->node_status.out.status.names[0].name, 15);
-		/* Strip space padding */
-		if (name) {
-			i = MIN(strlen(name), 15);
-			for (; i > 0 && name[i - 1] == ' '; i--) {
-				name[i - 1] = '\0';
+	for (i=0; i < state->node_status.out.status.num_names; i++) {
+		int j;
+		if (state->node_status.out.status.names[i].type == NBT_NAME_SERVER) {
+			char *name = talloc_strndup(state->dcs, state->node_status.out.status.names[0].name, 15);
+			/* Strip space padding */
+			if (name) {
+				j = MIN(strlen(name), 15);
+				for (; j > 0 && name[j - 1] == ' '; j--) {
+					name[j - 1] = '\0';
+				}
 			}
+			state->dcs[0].name = name;
+			composite_done(state->ctx);
+			return;
 		}
-		state->dcs[0].name = name;
-		composite_done(state->ctx);
-		return;
 	}
 	composite_error(state->ctx, NT_STATUS_NO_LOGON_SERVERS);
 }



More information about the samba-cvs mailing list