s3-util: Fix authentication with long hostnames.
authorAndreas Schneider <asn@samba.org>
Mon, 12 Jan 2015 17:12:13 +0000 (18:12 +0100)
committerKarolin Seeger <kseeger@samba.org>
Wed, 14 Jan 2015 20:28:13 +0000 (21:28 +0100)
If the hostname is longer than MAX_NETBIOSNAME_LEN we fail to correctly
check the hostname.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11008

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit da2611adef32107f5a0eec97501c01232ab72efc)
Signed-off-by: Andreas Schneider <asn@samba.org>
source3/lib/util.c

index f64e2a3f5de1b2cb6321ccae0f4d9e74169aee48..9e6ac9c893c6964e076b5c63b8126adceed30bf5 100644 (file)
@@ -1192,7 +1192,9 @@ bool is_myname(const char *s)
        bool ret = False;
 
        for (n=0; my_netbios_names(n); n++) {
-               if (strequal(my_netbios_names(n), s)) {
+               const char *nbt_name = my_netbios_names(n);
+
+               if (strncasecmp_m(nbt_name, s, strlen(nbt_name)) == 0) {
                        ret=True;
                        break;
                }