s3: auth: Andrew noticed f585f01148ab2d8f84c96b12e018742f5f17bcb0 doesn't keep the...
authorJeremy Allison <jra@samba.org>
Wed, 8 Sep 2021 00:39:38 +0000 (17:39 -0700)
committerVolker Lendecke <vl@samba.org>
Wed, 8 Sep 2021 06:38:21 +0000 (06:38 +0000)
This should make it identical.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Sep  8 06:38:21 UTC 2021 on sn-devel-184

source3/auth/server_info_sam.c

index b9c8b0a0959093eadd783c400d52c210094fbbb4..71a52f812a59ac1e74c6bf3f8c19f31fa635ffbf 100644 (file)
@@ -39,11 +39,16 @@ static bool is_our_machine_account(const char *username)
 {
        bool ret;
        size_t ulen = strlen(username);
+       const char *nb_name = lp_netbios_name();
+       size_t nb_namelen = strlen(nb_name);
 
        if (ulen == 0 || username[ulen-1] != '$') {
                return false;
        }
-       ret = strnequal(username, lp_netbios_name(), ulen-1);
+       if (nb_namelen != ulen-1) {
+               return false;
+       }
+       ret = strnequal(username, nb_name, ulen-1);
        return ret;
 }