diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-03-25 09:24:53 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:59:11 -0500 |
commit | 767685e9fd836d9ea3082855e7d9204ca66f047f (patch) | |
tree | 198a4abc1b49323273da0808ed7bf3a5d2d535a3 /source4/nbt_server/dgram | |
parent | 3451ba729dad31e7a435908970d58965f08465f7 (diff) | |
download | samba-767685e9fd836d9ea3082855e7d9204ca66f047f.tar.gz samba-767685e9fd836d9ea3082855e7d9204ca66f047f.tar.bz2 samba-767685e9fd836d9ea3082855e7d9204ca66f047f.zip |
r14709: allways use the unicast socket of the interface, when reply to DGRAM
requests...
this fixes a bug where I thought windows would try KRB5 via broadcast...
metze
(This used to be commit 0e7b224294ce6a3b5bbdc284181ab496a5a0c058)
Diffstat (limited to 'source4/nbt_server/dgram')
-rw-r--r-- | source4/nbt_server/dgram/netlogon.c | 18 | ||||
-rw-r--r-- | source4/nbt_server/dgram/ntlogon.c | 6 |
2 files changed, 15 insertions, 9 deletions
diff --git a/source4/nbt_server/dgram/netlogon.c b/source4/nbt_server/dgram/netlogon.c index 632f987c37..c50c0ba1c0 100644 --- a/source4/nbt_server/dgram/netlogon.c +++ b/source4/nbt_server/dgram/netlogon.c @@ -33,11 +33,13 @@ reply to a GETDC request */ static void nbtd_netlogon_getdc(struct dgram_mailslot_handler *dgmslot, + struct nbtd_interface *iface, struct nbt_dgram_packet *packet, const struct socket_address *src, struct nbt_netlogon_packet *netlogon) { struct nbt_name *name = &packet->data.msg.dest_name; + struct nbtd_interface *reply_iface = nbtd_find_reply_iface(iface, src->addr, False); struct nbt_netlogon_packet reply; struct nbt_netlogon_response_from_pdc *pdc; const char *ref_attrs[] = {"nETBIOSName", NULL}; @@ -80,7 +82,7 @@ static void nbtd_netlogon_getdc(struct dgram_mailslot_handler *dgmslot, packet->data.msg.dest_name.type = 0; - dgram_mailslot_netlogon_reply(dgmslot->dgmsock, + dgram_mailslot_netlogon_reply(reply_iface->dgmsock, packet, netlogon->req.pdc.mailslot_name, &reply); @@ -90,12 +92,14 @@ static void nbtd_netlogon_getdc(struct dgram_mailslot_handler *dgmslot, /* reply to a ADS style GETDC request */ -static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot, +static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot, + struct nbtd_interface *iface, struct nbt_dgram_packet *packet, const struct socket_address *src, struct nbt_netlogon_packet *netlogon) { struct nbt_name *name = &packet->data.msg.dest_name; + struct nbtd_interface *reply_iface = nbtd_find_reply_iface(iface, src->addr, False); struct nbt_netlogon_packet reply; struct nbt_netlogon_response_from_pdc2 *pdc; struct ldb_context *samctx; @@ -104,7 +108,7 @@ static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot, struct ldb_message **ref_res, **dom_res; int ret; const char **services = lp_server_services(); - struct socket_address *my_ip = socket_get_my_addr(dgmslot->dgmsock->sock, packet); + const char *my_ip = reply_iface->ip_address; if (!my_ip) { DEBUG(0, ("Could not obtain own IP address for datagram socket\n")); return; @@ -188,14 +192,14 @@ static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot, pdc->site_name2 = "Default-First-Site-Name"; pdc->unknown = 0x10; /* what is this? */ pdc->unknown2 = 2; /* and this ... */ - pdc->pdc_ip = my_ip->addr; + pdc->pdc_ip = my_ip; pdc->nt_version = 13; pdc->lmnt_token = 0xFFFF; pdc->lm20_token = 0xFFFF; packet->data.msg.dest_name.type = 0; - dgram_mailslot_netlogon_reply(dgmslot->dgmsock, + dgram_mailslot_netlogon_reply(reply_iface->dgmsock, packet, netlogon->req.pdc2.mailslot_name, &reply); @@ -235,10 +239,10 @@ void nbtd_mailslot_netlogon_handler(struct dgram_mailslot_handler *dgmslot, switch (netlogon->command) { case NETLOGON_QUERY_FOR_PDC: - nbtd_netlogon_getdc(dgmslot, packet, src, netlogon); + nbtd_netlogon_getdc(dgmslot, iface, packet, src, netlogon); break; case NETLOGON_QUERY_FOR_PDC2: - nbtd_netlogon_getdc2(dgmslot, packet, src, netlogon); + nbtd_netlogon_getdc2(dgmslot, iface, packet, src, netlogon); break; default: DEBUG(2,("unknown netlogon op %d from %s:%d\n", diff --git a/source4/nbt_server/dgram/ntlogon.c b/source4/nbt_server/dgram/ntlogon.c index 165a9f461a..15bf903844 100644 --- a/source4/nbt_server/dgram/ntlogon.c +++ b/source4/nbt_server/dgram/ntlogon.c @@ -29,11 +29,13 @@ reply to a SAM LOGON request */ static void nbtd_ntlogon_sam_logon(struct dgram_mailslot_handler *dgmslot, + struct nbtd_interface *iface, struct nbt_dgram_packet *packet, const struct socket_address *src, struct nbt_ntlogon_packet *ntlogon) { struct nbt_name *name = &packet->data.msg.dest_name; + struct nbtd_interface *reply_iface = nbtd_find_reply_iface(iface, src->addr, False); struct nbt_ntlogon_packet reply; struct nbt_ntlogon_sam_logon_reply *logon; @@ -56,7 +58,7 @@ static void nbtd_ntlogon_sam_logon(struct dgram_mailslot_handler *dgmslot, packet->data.msg.dest_name.type = 0; - dgram_mailslot_ntlogon_reply(dgmslot->dgmsock, + dgram_mailslot_ntlogon_reply(reply_iface->dgmsock, packet, ntlogon->req.logon.mailslot_name, &reply); @@ -97,7 +99,7 @@ void nbtd_mailslot_ntlogon_handler(struct dgram_mailslot_handler *dgmslot, switch (ntlogon->command) { case NTLOGON_SAM_LOGON: - nbtd_ntlogon_sam_logon(dgmslot, packet, src, ntlogon); + nbtd_ntlogon_sam_logon(dgmslot, iface, packet, src, ntlogon); break; default: DEBUG(2,("unknown ntlogon op %d from %s:%d\n", |