1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

added a dest_port parameter to send_mailslot() so we send replies to

the correct port in environments like ip masq.
(This used to be commit 7d455ee637)
This commit is contained in:
Andrew Tridgell 1998-08-30 17:04:24 +00:00
parent 98b0fafc61
commit ab4577f141
7 changed files with 27 additions and 22 deletions

View File

@ -782,7 +782,8 @@ BOOL listen_for_packets(BOOL run_election);
BOOL send_mailslot(BOOL unique, char *mailslot,char *buf,int len,
char *srcname, int src_type,
char *dstname, int dest_type,
struct in_addr dest_ip,struct in_addr src_ip);
struct in_addr dest_ip,struct in_addr src_ip,
int dest_port);
/*The following definitions come from nmbd/nmbd_processlogon.c */

View File

@ -122,7 +122,8 @@ Do not announce to ourselves.\n", work->work_group ));
to %s for workgroup %s.\n", namestr(&work->dmb_name), work->work_group ));
send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
global_myname, 0x0, work->dmb_name.name, 0x0, work->dmb_addr, FIRST_SUBNET->myip);
global_myname, 0x0, work->dmb_name.name, 0x0,
work->dmb_addr, FIRST_SUBNET->myip, DGRAM_PORT);
}

View File

@ -62,7 +62,7 @@ static void send_election_dgram(struct subnet_record *subrec, char *workgroup_na
send_mailslot(False, BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
global_myname, 0,
workgroup_name, 0x1e,
subrec->bcast_ip, subrec->myip);
subrec->bcast_ip, subrec->myip, DGRAM_PORT);
}
/*******************************************************************

View File

@ -536,12 +536,12 @@ originate from OS/2 Warp client. Ignoring packet.\n"));
/****************************************************************************
Send a backup list response.
*****************************************************************************/
static void send_backup_list_response(struct subnet_record *subrec,
struct work_record *work,
struct nmb_name *send_to_name,
unsigned char max_number_requested,
uint32 token, struct in_addr sendto_ip)
struct work_record *work,
struct nmb_name *send_to_name,
unsigned char max_number_requested,
uint32 token, struct in_addr sendto_ip,
int port)
{
char outbuf[1024];
char *p, *countptr, *nameptr;
@ -610,7 +610,7 @@ static void send_backup_list_response(struct subnet_record *subrec,
outbuf,PTR_DIFF(p,outbuf),
global_myname, 0,
send_to_name->name,0,
sendto_ip, subrec->myip);
sendto_ip, subrec->myip, port);
}
/*******************************************************************
@ -687,7 +687,7 @@ and I am not a local master browser.\n", workgroup_name));
}
send_backup_list_response(subrec, work, &dgram->source_name,
max_number_requested, token, p->ip);
max_number_requested, token, p->ip, p->port);
}
/*******************************************************************

View File

@ -1875,13 +1875,12 @@ BOOL listen_for_packets(BOOL run_election)
/****************************************************************************
Construct and send a netbios DGRAM.
Note that this currently sends all packets to port 138.
**************************************************************************/
BOOL send_mailslot(BOOL unique, char *mailslot,char *buf,int len,
char *srcname, int src_type,
char *dstname, int dest_type,
struct in_addr dest_ip,struct in_addr src_ip)
struct in_addr dest_ip,struct in_addr src_ip,
int dest_port)
{
BOOL loopback_this_packet = False;
struct packet_struct p;
@ -1936,7 +1935,7 @@ BOOL send_mailslot(BOOL unique, char *mailslot,char *buf,int len,
dgram->datasize = PTR_DIFF(p2,ptr+4); /* +4 for tcp length. */
p.ip = dest_ip;
p.port = DGRAM_PORT;
p.port = dest_port;
p.fd = find_subnet_mailslot_fd_for_address( src_ip );
p.timestamp = time(NULL);
p.packet_type = DGRAM_PACKET;

View File

@ -112,7 +112,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
dgram->dest_name.name_type,
dgram->source_name.name,
dgram->source_name.name_type,
p->ip, *iface_ip(p->ip));
p->ip, *iface_ip(p->ip), p->port);
break;
}
@ -167,7 +167,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
dgram->dest_name.name_type,
dgram->source_name.name,
dgram->source_name.name_type,
p->ip, *iface_ip(p->ip));
p->ip, *iface_ip(p->ip), p->port);
return;
}
@ -243,7 +243,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
dgram->dest_name.name_type,
dgram->source_name.name,
dgram->source_name.name_type,
p->ip, *iface_ip(p->ip));
p->ip, *iface_ip(p->ip), p->port);
break;
}

View File

@ -54,7 +54,8 @@ void send_browser_reset(int reset_type, char *to_name, int to_type, struct in_ad
p++;
send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
global_myname, 0x0, to_name, to_type, to_ip, FIRST_SUBNET->myip);
global_myname, 0x0, to_name, to_type, to_ip,
FIRST_SUBNET->myip, DGRAM_PORT);
}
/****************************************************************************
@ -84,7 +85,8 @@ to subnet %s\n", work->work_group, subrec->subnet_name));
p = skip_string(p,1);
send_mailslot(False, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
global_myname, 0x0, work->work_group,0x1e, subrec->bcast_ip, subrec->myip);
global_myname, 0x0, work->work_group,0x1e, subrec->bcast_ip,
subrec->myip, DGRAM_PORT);
}
/****************************************************************************
@ -124,7 +126,8 @@ static void send_announcement(struct subnet_record *subrec, int announce_type,
p = skip_string(p,1);
send_mailslot(False,BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
from_name, 0x0, to_name, to_type, to_ip, subrec->myip);
from_name, 0x0, to_name, to_type, to_ip, subrec->myip,
DGRAM_PORT);
}
/****************************************************************************
@ -155,7 +158,8 @@ static void send_lm_announcement(struct subnet_record *subrec, int announce_type
p = skip_string(p,1);
send_mailslot(False,LANMAN_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
from_name, 0x0, to_name, to_type, to_ip, subrec->myip);
from_name, 0x0, to_name, to_type, to_ip, subrec->myip,
DGRAM_PORT);
}
/****************************************************************************
@ -601,6 +605,6 @@ for workgroup %s on subnet %s.\n", global_myworkgroup, FIRST_SUBNET->subnet_name
global_myname, inet_ntoa(addr) ));
send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
global_myname, 0x0, "*", 0x0, addr, FIRST_SUBNET->myip);
global_myname, 0x0, "*", 0x0, addr, FIRST_SUBNET->myip, DGRAM_PORT);
}
}