Nikolay Sivov : msxml3: Embed user/password in uri used to create a moniker .
Alexandre Julliard
julliard at winehq.org
Tue Mar 26 15:11:11 CDT 2013
Module: wine
Branch: master
Commit: 448e939ebe3faeec2f837b1c44a14c58e8ba93c5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=448e939ebe3faeec2f837b1c44a14c58e8ba93c5
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Mar 18 12:44:44 2013 +0400
msxml3: Embed user/password in uri used to create a moniker.
---
dlls/msxml3/httprequest.c | 61 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c
index c67177b..681ccab 100644
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -619,8 +619,27 @@ static HRESULT WINAPI Authenticate_Authenticate(IAuthenticate *iface,
HWND *hwnd, LPWSTR *username, LPWSTR *password)
{
BindStatusCallback *This = impl_from_IAuthenticate(iface);
- FIXME("(%p)->(%p %p %p)\n", This, hwnd, username, password);
- return E_NOTIMPL;
+ httprequest *request = This->request;
+
+ TRACE("(%p)->(%p %p %p)\n", This, hwnd, username, password);
+
+ if (request->user && *request->user)
+ {
+ if (hwnd) *hwnd = NULL;
+ *username = CoTaskMemAlloc(SysStringByteLen(request->user)+sizeof(WCHAR));
+ *password = CoTaskMemAlloc(SysStringByteLen(request->password)+sizeof(WCHAR));
+ if (!*username || !*password)
+ {
+ CoTaskMemFree(*username);
+ CoTaskMemFree(*password);
+ return E_OUTOFMEMORY;
+ }
+
+ memcpy(*username, request->user, SysStringByteLen(request->user)+sizeof(WCHAR));
+ memcpy(*password, request->password, SysStringByteLen(request->password)+sizeof(WCHAR));
+ }
+
+ return S_OK;
}
static const IAuthenticateVtbl AuthenticateVtbl = {
@@ -882,12 +901,6 @@ static HRESULT httprequest_open(httprequest *This, BSTR method, BSTR url,
return hr;
}
- This->uri = uri;
-
- VariantInit(&is_async);
- hr = VariantChangeType(&is_async, &async, 0, VT_BOOL);
- This->async = hr == S_OK && V_BOOL(&is_async);
-
VariantInit(&str);
hr = VariantChangeType(&str, &user, 0, VT_BSTR);
if (hr == S_OK)
@@ -898,6 +911,38 @@ static HRESULT httprequest_open(httprequest *This, BSTR method, BSTR url,
if (hr == S_OK)
This->password = V_BSTR(&str);
+ /* add authentication info */
+ if (This->user && *This->user)
+ {
+ IUriBuilder *builder;
+
+ hr = CreateIUriBuilder(uri, 0, 0, &builder);
+ if (hr == S_OK)
+ {
+ IUri *full_uri;
+
+ IUriBuilder_SetUserName(builder, This->user);
+ IUriBuilder_SetPassword(builder, This->password);
+ hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &full_uri);
+ if (hr == S_OK)
+ {
+ IUri_Release(uri);
+ uri = full_uri;
+ }
+ else
+ WARN("failed to create modified uri, 0x%08x\n", hr);
+ IUriBuilder_Release(builder);
+ }
+ else
+ WARN("IUriBuilder creation failed, 0x%08x\n", hr);
+ }
+
+ This->uri = uri;
+
+ VariantInit(&is_async);
+ hr = VariantChangeType(&is_async, &async, 0, VT_BOOL);
+ This->async = hr == S_OK && V_BOOL(&is_async);
+
httprequest_setreadystate(This, READYSTATE_LOADING);
return S_OK;
More information about the wine-cvs
mailing list