summaryrefslogtreecommitdiff
path: root/source3/nameservresp.c
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-08-12 23:02:45 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-08-12 23:02:45 +0000
commit9b41ada7c8f5eb77a1acf0eaf29a7d6f8cbaea36 (patch)
tree676108f92f9f81260853c9e5f8b5572f48397415 /source3/nameservresp.c
parent6fc2072d55080862af346a01781edede4931e533 (diff)
downloadsamba-9b41ada7c8f5eb77a1acf0eaf29a7d6f8cbaea36.tar.gz
samba-9b41ada7c8f5eb77a1acf0eaf29a7d6f8cbaea36.tar.bz2
samba-9b41ada7c8f5eb77a1acf0eaf29a7d6f8cbaea36.zip
charset.c: Fixed bug with 'valid chars' param.
loadparm.c: Fixed bug with 'valid chars' param. nameelect.c:Unregister the 1b name from the WINS server when unbecoming master. nameservresp.c: Fix nasty browse bug where we were sending the query to the wrong ip address. Jeremy (jallison@whistle.com) (This used to be commit 927d1875f0c09fe7b2e1c1bc4b1af2c0b8de0f7c)
Diffstat (limited to 'source3/nameservresp.c')
-rw-r--r--source3/nameservresp.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/source3/nameservresp.c b/source3/nameservresp.c
index 2fb38a0407..a88481d06b 100644
--- a/source3/nameservresp.c
+++ b/source3/nameservresp.c
@@ -143,21 +143,40 @@ static void response_name_reg(struct nmb_name *ans_name,
NAME_QUERY_SRV_CHK, and NAME_QUERY_FIND_MST dealt with here.
****************************************************************************/
static void response_server_check(struct nmb_name *ans_name,
- struct response_record *n, struct subnet_record *d)
+ struct response_record *n, struct subnet_record *d, struct packet_struct *p)
{
+ struct nmb_packet *nmb = &p->packet.nmb;
+ struct in_addr send_ip;
+ enum state_type cmd;
+
+ /* This next fix was from Bernhard Laeser <nlaesb@ascom.ch>
+ who noticed we were replying directly back to the server
+ we sent to - rather than reading the response.
+ */
+
+ if (nmb->header.rcode == 0 && nmb->answers->rdata)
+ putip((char*)&send_ip,&nmb->answers->rdata[2]);
+ else
+ {
+
+ DEBUG(2,("response_server_check: name query for %s failed\n",
+ namestr(ans_name)));
+ return;
+ }
+
/* issue another state: this time to do a name status check */
- enum state_type cmd = (n->state == NAME_QUERY_DOM_SRV_CHK) ?
+ cmd = (n->state == NAME_QUERY_DOM_SRV_CHK) ?
NAME_STATUS_DOM_SRV_CHK : NAME_STATUS_SRV_CHK;
- /* initiate a name status check on the server that replied
- in addition, the workgroup being checked has been stored
+ /* initiate a name status check on address given in the reply
+ record. In addition, the workgroup being checked has been stored
in the response_record->my_name (see announce_master) we
also propagate this into the same field. */
queue_netbios_packet(d,ClientNMB,NMB_STATUS, cmd,
ans_name->name, ans_name->name_type,
0,0,0,n->my_name,NULL,
- False,False,n->send_ip,n->reply_to_ip);
+ False,False,send_ip,n->reply_to_ip);
}
@@ -720,7 +739,7 @@ static void response_process(struct subnet_record *d, struct packet_struct *p,
case NAME_QUERY_SRV_CHK:
case NAME_QUERY_FIND_MST:
{
- response_server_check(ans_name, n, d);
+ response_server_check(ans_name, n, d, p);
break;
}