summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2018-02-17 17:11:41 +0100
committerAndreas Schneider <asn@cryptomilk.org>2018-02-27 09:14:17 +0100
commit7de96133858edee309102976fd7265d6e480e778 (patch)
treee1a6157a3668f4d17f26195d476d21e5900ca2ef
parent211a6072adb05cb74b1012cbd3637fdfe377c4f2 (diff)
downloadsamba-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>
-rw-r--r--source4/nbt_server/dgram/netlogon.c15
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;