msxml3: Embed user/password in uri used to create a moniker.

This commit is contained in:
Nikolay Sivov 2013-03-18 12:44:44 +04:00 committed by Alexandre Julliard
parent d8a86da66e
commit 448e939ebe

View file

@ -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;