Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
78fc21cd
Commit
78fc21cd
authored
Aug 19, 2013
by
Hans Leidekker
Committed by
Alexandre Julliard
Aug 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Allow setting NULL username and password for NTLM, Passport and Negotiate.
parent
368cff7a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
5 deletions
+33
-5
request.c
dlls/winhttp/request.c
+12
-5
winhttp.c
dlls/winhttp/tests/winhttp.c
+21
-0
No files found.
dlls/winhttp/request.c
View file @
78fc21cd
...
...
@@ -1668,7 +1668,8 @@ static BOOL do_authorization( request_t *request, DWORD target, DWORD scheme_fla
static
BOOL
set_credentials
(
request_t
*
request
,
DWORD
target
,
DWORD
scheme
,
const
WCHAR
*
username
,
const
WCHAR
*
password
)
{
if
(
!
username
||
!
password
)
if
((
scheme
==
WINHTTP_AUTH_SCHEME_BASIC
||
scheme
==
WINHTTP_AUTH_SCHEME_DIGEST
)
&&
(
!
username
||
!
password
))
{
set_last_error
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
...
...
@@ -1678,17 +1679,23 @@ static BOOL set_credentials( request_t *request, DWORD target, DWORD scheme, con
case
WINHTTP_AUTH_TARGET_SERVER
:
{
heap_free
(
request
->
connect
->
username
);
if
(
!
(
request
->
connect
->
username
=
strdupW
(
username
)))
return
FALSE
;
if
(
!
username
)
request
->
connect
->
username
=
NULL
;
else
if
(
!
(
request
->
connect
->
username
=
strdupW
(
username
)))
return
FALSE
;
heap_free
(
request
->
connect
->
password
);
if
(
!
(
request
->
connect
->
password
=
strdupW
(
password
)))
return
FALSE
;
if
(
!
password
)
request
->
connect
->
password
=
NULL
;
else
if
(
!
(
request
->
connect
->
password
=
strdupW
(
password
)))
return
FALSE
;
break
;
}
case
WINHTTP_AUTH_TARGET_PROXY
:
{
heap_free
(
request
->
connect
->
session
->
proxy_username
);
if
(
!
(
request
->
connect
->
session
->
proxy_username
=
strdupW
(
username
)))
return
FALSE
;
if
(
!
username
)
request
->
connect
->
session
->
proxy_username
=
NULL
;
else
if
(
!
(
request
->
connect
->
session
->
proxy_username
=
strdupW
(
username
)))
return
FALSE
;
heap_free
(
request
->
connect
->
session
->
proxy_password
);
if
(
!
(
request
->
connect
->
session
->
proxy_password
=
strdupW
(
password
)))
return
FALSE
;
if
(
!
password
)
request
->
connect
->
session
->
proxy_password
=
NULL
;
else
if
(
!
(
request
->
connect
->
session
->
proxy_password
=
strdupW
(
password
)))
return
FALSE
;
break
;
}
default:
...
...
dlls/winhttp/tests/winhttp.c
View file @
78fc21cd
...
...
@@ -1959,6 +1959,27 @@ static void test_basic_authentication(int port)
ok
(
ret
,
"failed to query status code %u
\n
"
,
GetLastError
());
ok
(
status
==
401
,
"request failed unexpectedly %u
\n
"
,
status
);
ret
=
WinHttpSetCredentials
(
req
,
WINHTTP_AUTH_TARGET_SERVER
,
WINHTTP_AUTH_SCHEME_NTLM
,
NULL
,
NULL
,
NULL
);
ok
(
ret
,
"failed to set credentials %u
\n
"
,
GetLastError
());
ret
=
WinHttpSetCredentials
(
req
,
WINHTTP_AUTH_TARGET_SERVER
,
WINHTTP_AUTH_SCHEME_PASSPORT
,
NULL
,
NULL
,
NULL
);
ok
(
ret
,
"failed to set credentials %u
\n
"
,
GetLastError
());
ret
=
WinHttpSetCredentials
(
req
,
WINHTTP_AUTH_TARGET_SERVER
,
WINHTTP_AUTH_SCHEME_NEGOTIATE
,
NULL
,
NULL
,
NULL
);
ok
(
ret
,
"failed to set credentials %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSetCredentials
(
req
,
WINHTTP_AUTH_TARGET_SERVER
,
WINHTTP_AUTH_SCHEME_DIGEST
,
NULL
,
NULL
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSetCredentials
(
req
,
WINHTTP_AUTH_TARGET_SERVER
,
WINHTTP_AUTH_SCHEME_BASIC
,
NULL
,
NULL
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSetCredentials
(
req
,
WINHTTP_AUTH_TARGET_SERVER
,
WINHTTP_AUTH_SCHEME_BASIC
,
userW
,
NULL
,
NULL
);
error
=
GetLastError
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment