1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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>
This commit is contained in:
Volker Lendecke 2018-02-17 17:11:41 +01:00 committed by Andreas Schneider
parent 211a6072ad
commit 7de9613385

View File

@ -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;