From e7fe0945e29898245d19e36feab877dcceab5740 Mon Sep 17 00:00:00 2001 From: Bolke de Bruin Date: Wed, 12 Oct 2022 14:26:32 +0200 Subject: [PATCH] Treat an address slice containing only a NetBIOS address as empty As there is no way to associate a client with its NetBIOS name treat the address slice as empty if it only contains a NetBIOS address. This make the behavior equivalent to MIT Kerberos. --- types/HostAddress.go | 6 ++++++ v8/types/HostAddress.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/types/HostAddress.go b/types/HostAddress.go index 5396cb21..10248334 100644 --- a/types/HostAddress.go +++ b/types/HostAddress.go @@ -139,7 +139,13 @@ func HostAddressesEqual(h, a []HostAddress) bool { } // HostAddressesContains tests if a HostAddress is contained in a HostAddress slice. +// Treat an address slice containing only a NetBIOS addresses +// as empty, because we presently have no way of associating +// a client with its NetBIOS address. func HostAddressesContains(h []HostAddress, a HostAddress) bool { + if len(h) == 1 && h[0].AddrType == addrtype.NetBios { + return true + } for _, e := range h { if e.Equal(a) { return true diff --git a/v8/types/HostAddress.go b/v8/types/HostAddress.go index 895fe805..034eafa7 100644 --- a/v8/types/HostAddress.go +++ b/v8/types/HostAddress.go @@ -139,7 +139,13 @@ func HostAddressesEqual(h, a []HostAddress) bool { } // HostAddressesContains tests if a HostAddress is contained in a HostAddress slice. +// Treat an address slice containing only a NetBIOS addresses +// as empty, because we presently have no way of associating +// a client with its NetBIOS address. func HostAddressesContains(h []HostAddress, a HostAddress) bool { + if len(h) == 1 && h[0].AddrType == addrtype.NetBios { + return true + } for _, e := range h { if e.Equal(a) { return true