Jacek Caban : credui: Correctly check for duplicated username entries in CredDialogFillUsernameCombo.

Alexandre Julliard julliard at winehq.org
Fri Oct 12 18:00:41 CDT 2018


Module: wine
Branch: master
Commit: 3acde309eda9f0c6b760bdacc28621aa8abb66a7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3acde309eda9f0c6b760bdacc28621aa8abb66a7

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Oct 12 14:50:25 2018 +0200

credui: Correctly check for duplicated username entries in CredDialogFillUsernameCombo.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/credui/credui_main.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/dlls/credui/credui_main.c b/dlls/credui/credui_main.c
index 1b9c71b..99aa9a1 100644
--- a/dlls/credui/credui_main.c
+++ b/dlls/credui/credui_main.c
@@ -160,20 +160,27 @@ static void CredDialogFillUsernameCombo(HWND hwndUsername, const struct cred_dia
         DWORD j;
         BOOL duplicate = FALSE;
 
+        if (!credentials[i]->UserName)
+            continue;
+
         if (params->dwFlags & CREDUI_FLAGS_GENERIC_CREDENTIALS)
         {
-            if ((credentials[i]->Type != CRED_TYPE_GENERIC) || !credentials[i]->UserName)
+            if (credentials[i]->Type != CRED_TYPE_GENERIC)
+            {
+                credentials[i]->UserName = NULL;
                 continue;
+            }
         }
-        else
+        else if (credentials[i]->Type == CRED_TYPE_GENERIC)
         {
-            if (credentials[i]->Type == CRED_TYPE_GENERIC)
-                continue;
+            credentials[i]->UserName = NULL;
+            continue;
         }
 
         /* don't add another item with the same name if we've already added it */
         for (j = 0; j < i; j++)
-            if (!strcmpW(credentials[i]->UserName, credentials[j]->UserName))
+            if (credentials[j]->UserName
+                && !strcmpW(credentials[i]->UserName, credentials[j]->UserName))
             {
                 duplicate = TRUE;
                 break;




More information about the wine-cvs mailing list