From 1b7e0ffb97780e3a80fcc87f01ae77ad40916ef1 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 4 Apr 2024 13:47:52 +0200 Subject: [PATCH] [core,smartcard] allow userhint to match UPN the username might match the UPN of the smartcard certificate. If not fall back to compare to userHint --- libfreerdp/core/smartcardlogon.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libfreerdp/core/smartcardlogon.c b/libfreerdp/core/smartcardlogon.c index d5907cf0c..f3f558192 100644 --- a/libfreerdp/core/smartcardlogon.c +++ b/libfreerdp/core/smartcardlogon.c @@ -222,11 +222,14 @@ static BOOL set_info_certificate(SmartcardCertInfo* cert, BYTE* certBytes, DWORD return FALSE; } - if (userFilter && cert->userHint && strcmp(cert->userHint, userFilter) != 0) + if (userFilter && (!cert->upn || (strcmp(cert->upn, userFilter) != 0))) { - WLog_DBG(TAG, "discarding non matching cert by user %s@%s", cert->userHint, - cert->domainHint); - return FALSE; + if (cert->userHint && strcmp(cert->userHint, userFilter) != 0) + { + WLog_DBG(TAG, "discarding non matching cert by user %s@%s", cert->userHint, + cert->domainHint); + return FALSE; + } } if (domainFilter && cert->domainHint && strcmp(cert->domainHint, domainFilter) != 0)