dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0102-UTIL-Use-max-15-characters-for-AD-host-UPN.patch

bb7cd1
From b2dcfa00dcb7b315a739d35ff6722a25b0ab5556 Mon Sep 17 00:00:00 2001
bb7cd1
From: Lukas Slebodnik <lslebodn@redhat.com>
bb7cd1
Date: Tue, 14 Mar 2017 10:34:00 +0100
bb7cd1
Subject: [PATCH 102/102] UTIL: Use max 15 characters for AD host UPN
bb7cd1
MIME-Version: 1.0
bb7cd1
Content-Type: text/plain; charset=UTF-8
bb7cd1
Content-Transfer-Encoding: 8bit
bb7cd1
bb7cd1
We do not want to use host principal with AD
bb7cd1
"host/name.domain.tld@DOMAIN.TLD" because it does not work.
bb7cd1
We need to use correct user principal for AD hosts. And we cannot
bb7cd1
rely all fallback "*$" because of other principals in keytab.
bb7cd1
bb7cd1
The NetBIOS naming convention allows for 16 characters in a NetBIOS
bb7cd1
name. Microsoft, however, limits NetBIOS names to 15 characters and
bb7cd1
uses the 16th character as a NetBIOS suffix.
bb7cd1
https://support.microsoft.com/en-us/help/163409/netbios-suffixes-16th-character-of-the-netbios-name
bb7cd1
bb7cd1
Resolves:
bb7cd1
https://pagure.io/SSSD/sssd/issue/3329
bb7cd1
bb7cd1
Reviewed-by: Michal Židek <mzidek@redhat.com>
bb7cd1
(cherry picked from commit c6f1bc32774a7cf2f8678499dfbced420be3a3a1)
bb7cd1
---
bb7cd1
 src/util/sss_krb5.c | 8 +++++++-
bb7cd1
 1 file changed, 7 insertions(+), 1 deletion(-)
bb7cd1
bb7cd1
diff --git a/src/util/sss_krb5.c b/src/util/sss_krb5.c
bb7cd1
index d461cf881566af37f31524c16f6a5f1511a5dc89..a3f066e8add5b7d7575c1e0f537c5729e4a0dad0 100644
bb7cd1
--- a/src/util/sss_krb5.c
bb7cd1
+++ b/src/util/sss_krb5.c
bb7cd1
@@ -51,7 +51,13 @@ sss_krb5_get_primary(TALLOC_CTX *mem_ctx,
bb7cd1
             *c = toupper(*c);
bb7cd1
         }
bb7cd1
 
bb7cd1
-        primary = talloc_asprintf(mem_ctx, "%s$", shortname);
bb7cd1
+        /* The samAccountName is recommended to be less than 20 characters.
bb7cd1
+         * This is only for users and groups. For machine accounts,
bb7cd1
+         * the real limit is caused by NetBIOS protocol.
bb7cd1
+         * NetBIOS names are limited to 16 (15 + $)
bb7cd1
+         * https://support.microsoft.com/en-us/help/163409/netbios-suffixes-16th-character-of-the-netbios-name
bb7cd1
+         */
bb7cd1
+        primary = talloc_asprintf(mem_ctx, "%.15s$", shortname);
bb7cd1
         talloc_free(shortname);
bb7cd1
         return primary;
bb7cd1
     }
bb7cd1
-- 
bb7cd1
2.9.3
bb7cd1