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
860c335b
Commit
860c335b
authored
Oct 18, 2012
by
Hans Leidekker
Committed by
Alexandre Julliard
Oct 18, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Only require a domain in the username for CRED_PERSIST_ENTERPRISE credentials.
parent
9d95d331
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
cred.c
dlls/advapi32/cred.c
+7
-1
cred.c
dlls/advapi32/tests/cred.c
+41
-0
No files found.
dlls/advapi32/cred.c
View file @
860c335b
...
...
@@ -1804,13 +1804,19 @@ BOOL WINAPI CredWriteW(PCREDENTIALW Credential, DWORD Flags)
return
FALSE
;
}
TRACE
(
"Credential->Flags = 0x%08x
\n
"
,
Credential
->
Flags
);
TRACE
(
"Credential->Type = %u
\n
"
,
Credential
->
Type
);
TRACE
(
"Credential->TargetName = %s
\n
"
,
debugstr_w
(
Credential
->
TargetName
));
TRACE
(
"Credential->Comment = %s
\n
"
,
debugstr_w
(
Credential
->
Comment
));
TRACE
(
"Credential->Persist = %u
\n
"
,
Credential
->
Persist
);
TRACE
(
"Credential->TargetAlias = %s
\n
"
,
debugstr_w
(
Credential
->
TargetAlias
));
TRACE
(
"Credential->UserName = %s
\n
"
,
debugstr_w
(
Credential
->
UserName
));
if
(
Credential
->
Type
==
CRED_TYPE_DOMAIN_PASSWORD
)
{
if
(
!
Credential
->
UserName
||
(
!
strchrW
(
Credential
->
UserName
,
'\\'
)
&&
!
strchrW
(
Credential
->
UserName
,
'@'
)))
(
Credential
->
Persist
==
CRED_PERSIST_ENTERPRISE
&&
(
!
strchrW
(
Credential
->
UserName
,
'\\'
)
&&
!
strchrW
(
Credential
->
UserName
,
'@'
))))
{
ERR
(
"bad username %s
\n
"
,
debugstr_w
(
Credential
->
UserName
));
SetLastError
(
ERROR_BAD_USERNAME
);
...
...
dlls/advapi32/tests/cred.c
View file @
860c335b
...
...
@@ -121,6 +121,47 @@ static void test_CredWriteA(void)
ok
(
!
ret
&&
GetLastError
()
==
ERROR_BAD_USERNAME
,
"CredWriteA with NULL username should have failed with ERROR_BAD_USERNAME instead of %d
\n
"
,
GetLastError
());
new_cred
.
UserName
=
(
char
*
)
"winetest"
;
new_cred
.
Persist
=
CRED_PERSIST_LOCAL_MACHINE
;
SetLastError
(
0xdeadbeef
);
ret
=
pCredWriteA
(
&
new_cred
,
0
);
ok
(
ret
||
broken
(
!
ret
),
"CredWriteA failed with error %u
\n
"
,
GetLastError
());
if
(
ret
)
{
ret
=
pCredDeleteA
(
TEST_TARGET_NAME
,
CRED_TYPE_DOMAIN_PASSWORD
,
0
);
ok
(
ret
,
"CredDeleteA failed with error %u
\n
"
,
GetLastError
());
}
new_cred
.
Type
=
CRED_TYPE_GENERIC
;
SetLastError
(
0xdeadbeef
);
ret
=
pCredWriteA
(
&
new_cred
,
0
);
ok
(
ret
||
broken
(
!
ret
),
"CredWriteA failed with error %u
\n
"
,
GetLastError
());
if
(
ret
)
{
ret
=
pCredDeleteA
(
TEST_TARGET_NAME
,
CRED_TYPE_GENERIC
,
0
);
ok
(
ret
,
"CredDeleteA failed with error %u
\n
"
,
GetLastError
());
}
new_cred
.
Persist
=
CRED_PERSIST_SESSION
;
ret
=
pCredWriteA
(
&
new_cred
,
0
);
ok
(
ret
,
"CredWriteA failed with error %u
\n
"
,
GetLastError
());
ret
=
pCredDeleteA
(
TEST_TARGET_NAME
,
CRED_TYPE_GENERIC
,
0
);
ok
(
ret
,
"CredDeleteA failed with error %u
\n
"
,
GetLastError
());
new_cred
.
Type
=
CRED_TYPE_DOMAIN_PASSWORD
;
SetLastError
(
0xdeadbeef
);
ret
=
pCredWriteA
(
&
new_cred
,
0
);
ok
(
ret
||
broken
(
!
ret
),
"CredWriteA failed with error %u
\n
"
,
GetLastError
());
if
(
ret
)
{
ret
=
pCredDeleteA
(
TEST_TARGET_NAME
,
CRED_TYPE_DOMAIN_PASSWORD
,
0
);
ok
(
ret
,
"CredDeleteA failed with error %u
\n
"
,
GetLastError
());
}
new_cred
.
UserName
=
NULL
;
SetLastError
(
0xdeadbeef
);
ret
=
pCredWriteA
(
&
new_cred
,
0
);
ok
(
!
ret
,
"CredWriteA succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_BAD_USERNAME
,
"got %u
\n
"
,
GetLastError
());
}
static
void
test_CredDeleteA
(
void
)
...
...
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