diff options
author | Volker Lendecke <vl@samba.org> | 2018-02-17 17:11:41 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-02-27 09:14:17 +0100 |
commit | 7de96133858edee309102976fd7265d6e480e778 (patch) | |
tree | e1a6157a3668f4d17f26195d476d21e5900ca2ef /source4/nbt_server | |
parent | 211a6072adb05cb74b1012cbd3637fdfe377c4f2 (diff) | |
download | samba-7de96133858edee309102976fd7265d6e480e778.tar.gz |
nbt_server: Centralize a consistency check
This is a "should NEVER happen" and applies to both
LOGON_PRIMARY_QUERY and LOGON_SAM_LOGON_REQUEST
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source4/nbt_server')
-rw-r--r-- | source4/nbt_server/dgram/netlogon.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/source4/nbt_server/dgram/netlogon.c b/source4/nbt_server/dgram/netlogon.c index 5ed3223ddf2..ede3e77c965 100644 --- a/source4/nbt_server/dgram/netlogon.c +++ b/source4/nbt_server/dgram/netlogon.c @@ -113,17 +113,10 @@ static NTSTATUS nbtd_netlogon_samlogon( { struct nbt_name *name = &packet->data.msg.dest_name; struct ldb_context *samctx; - struct nbtd_interface *reply_iface = nbtd_find_reply_iface(iface, src->addr, false); - const char *my_ip = reply_iface->ip_address; struct dom_sid *sid; struct nbt_netlogon_response *response; NTSTATUS status; - if (!my_ip) { - DEBUG(0, ("Could not obtain own IP address for datagram socket\n")); - return NT_STATUS_NOT_SUPPORTED; - } - /* only answer getdc requests on the PDC or LOGON names */ if (name->type != NBT_NAME_PDC && name->type != NBT_NAME_LOGON) { return NT_STATUS_NOT_SUPPORTED; @@ -170,13 +163,19 @@ void nbtd_mailslot_netlogon_handler(struct dgram_mailslot_handler *dgmslot, NTSTATUS status = NT_STATUS_NO_MEMORY; struct nbtd_interface *iface = talloc_get_type(dgmslot->private_data, struct nbtd_interface); - struct nbt_netlogon_packet *netlogon; + struct nbt_netlogon_packet *netlogon = NULL; struct nbtd_interface *reply_iface = nbtd_find_reply_iface( iface, src->addr, false); struct nbtd_iface_name *iname; struct nbt_name *name = &packet->data.msg.dest_name; struct nbt_netlogon_response *response; + if (reply_iface->ip_address == NULL) { + DBG_WARNING("Could not obtain own IP address for datagram " + "socket\n"); + goto failed; + } + netlogon = talloc(dgmslot, struct nbt_netlogon_packet); if (netlogon == NULL) { goto failed; |