Rob Shearman : wininet: Fix basic authentication by putting Basic directing into the scheme field, as the pszAuthValue can have an optional realm string appended.

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 29 08:05:39 CDT 2007


Module: wine
Branch: master
Commit: 4d1b8b1a4e169f37878f3bc2874309c617a8b4c1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4d1b8b1a4e169f37878f3bc2874309c617a8b4c1

Author: Rob Shearman <rob at codeweavers.com>
Date:   Fri May 25 12:06:11 2007 +0100

wininet: Fix basic authentication by putting Basic directing into the scheme field, as the pszAuthValue can have an optional realm string appended.

---

 dlls/wininet/http.c |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index ad73e41..056e2fe 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -440,12 +440,6 @@ static BOOL HTTP_DoAuthorization( LPWININETHTTPREQW lpwhr, LPCWSTR pszAuthValue
         if (!pAuthInfo)
             return FALSE;
 
-        pAuthInfo->scheme = WININET_strdupW(pszAuthValue);
-        if (!pAuthInfo->scheme)
-        {
-            HeapFree(GetProcessHeap(), 0, pAuthInfo);
-            return FALSE;
-        }
         SecInvalidateHandle(&pAuthInfo->cred);
         SecInvalidateHandle(&pAuthInfo->ctx);
         memset(&pAuthInfo->exp, 0, sizeof(pAuthInfo->exp));
@@ -454,12 +448,29 @@ static BOOL HTTP_DoAuthorization( LPWININETHTTPREQW lpwhr, LPCWSTR pszAuthValue
         pAuthInfo->auth_data_len = 0;
         pAuthInfo->finished = FALSE;
 
-        if (!is_basic_auth_value(pszAuthValue))
+        if (is_basic_auth_value(pszAuthValue))
+        {
+            static const WCHAR szBasic[] = {'B','a','s','i','c',0};
+            pAuthInfo->scheme = WININET_strdupW(szBasic);
+            if (!pAuthInfo->scheme)
+            {
+                HeapFree(GetProcessHeap(), 0, pAuthInfo);
+                return FALSE;
+            }
+        }
+        else
         {
             SEC_WINNT_AUTH_IDENTITY_W nt_auth_identity;
             WCHAR *user = strchrW(domain_and_username, '\\');
             WCHAR *domain = domain_and_username;
 
+            pAuthInfo->scheme = WININET_strdupW(pszAuthValue);
+            if (!pAuthInfo->scheme)
+            {
+                HeapFree(GetProcessHeap(), 0, pAuthInfo);
+                return FALSE;
+            }
+
             if (user) user++;
             else
             {




More information about the wine-cvs mailing list