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
ea930bec
Commit
ea930bec
authored
Jul 12, 2022
by
Hans Leidekker
Committed by
Alexandre Julliard
Jul 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
secur32: Simplify lsa_AcquireCredentialsHandleA().
parent
4c9d30a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
41 deletions
+27
-41
lsa.c
dlls/secur32/lsa.c
+27
-41
No files found.
dlls/secur32/lsa.c
View file @
ea930bec
...
...
@@ -349,13 +349,12 @@ static SECURITY_STATUS WINAPI lsa_AcquireCredentialsHandleA(
void
*
get_key_arg
,
CredHandle
*
credential
,
TimeStamp
*
ts_expiry
)
{
SECURITY_STATUS
status
=
SEC_E_INSUFFICIENT_MEMORY
;
int
len_user
=
0
,
len_domain
=
0
,
len_passwd
=
0
;
SEC_WCHAR
*
principalW
=
NULL
,
*
packageW
=
NULL
,
*
user
=
NULL
,
*
domain
=
NULL
,
*
passwd
=
NULL
;
SEC_WINNT_AUTH_IDENTITY_W
*
auth_dataW
=
NULL
;
SEC_WINNT_AUTH_IDENTITY_A
*
id
=
NULL
;
SEC_WCHAR
*
principalW
=
NULL
,
*
packageW
=
NULL
;
SEC_WINNT_AUTH_IDENTITY_A
*
id
=
auth_data
;
SEC_WINNT_AUTH_IDENTITY_W
idW
=
{};
TRACE
(
"%s %s %#lx %p %p %p %p %p
\n
"
,
debugstr_a
(
principal
),
debugstr_a
(
package
),
credentials_use
,
auth_data
,
get_key_fn
,
get_key_arg
,
credential
,
ts_expiry
);
credentials_use
,
auth_data
,
get_key_fn
,
get_key_arg
,
credential
,
ts_expiry
);
if
(
principal
)
{
...
...
@@ -369,51 +368,38 @@ static SECURITY_STATUS WINAPI lsa_AcquireCredentialsHandleA(
if
(
!
(
packageW
=
malloc
(
len
*
sizeof
(
SEC_WCHAR
)
)))
goto
done
;
MultiByteToWideChar
(
CP_ACP
,
0
,
package
,
-
1
,
packageW
,
len
);
}
if
(
auth_data
)
if
(
id
&&
(
id
->
Flags
==
SEC_WINNT_AUTH_IDENTITY_ANSI
)
)
{
id
=
(
PSEC_WINNT_AUTH_IDENTITY_A
)
auth_data
;
if
(
id
->
Flags
==
SEC_WINNT_AUTH_IDENTITY_ANSI
)
if
(
id
->
UserLength
)
{
if
(
!
(
auth_dataW
=
malloc
(
sizeof
(
SEC_WINNT_AUTH_IDENTITY_W
)
)))
goto
done
;
if
(
id
->
UserLength
)
{
len_user
=
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
id
->
User
,
id
->
UserLength
,
NULL
,
0
);
if
(
!
(
user
=
malloc
(
len_user
*
sizeof
(
SEC_WCHAR
)
)))
goto
done
;
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
id
->
User
,
id
->
UserLength
,
user
,
len_user
);
}
if
(
id
->
DomainLength
)
{
len_domain
=
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
id
->
Domain
,
id
->
DomainLength
,
NULL
,
0
);
if
(
!
(
domain
=
malloc
(
len_domain
*
sizeof
(
SEC_WCHAR
)
)))
goto
done
;
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
id
->
Domain
,
id
->
DomainLength
,
domain
,
len_domain
);
}
if
(
id
->
PasswordLength
)
{
len_passwd
=
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
id
->
Password
,
id
->
PasswordLength
,
NULL
,
0
);
if
(
!
(
passwd
=
malloc
(
len_passwd
*
sizeof
(
SEC_WCHAR
)
)))
goto
done
;
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
id
->
Password
,
id
->
PasswordLength
,
passwd
,
len_passwd
);
}
auth_dataW
->
Flags
=
SEC_WINNT_AUTH_IDENTITY_UNICODE
;
auth_dataW
->
User
=
user
;
auth_dataW
->
UserLength
=
len_user
;
auth_dataW
->
Domain
=
domain
;
auth_dataW
->
DomainLength
=
len_domain
;
auth_dataW
->
Password
=
passwd
;
auth_dataW
->
PasswordLength
=
len_passwd
;
idW
.
UserLength
=
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
id
->
User
,
id
->
UserLength
,
NULL
,
0
);
if
(
!
(
idW
.
User
=
malloc
(
idW
.
UserLength
*
sizeof
(
SEC_WCHAR
)
)))
goto
done
;
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
id
->
User
,
id
->
UserLength
,
idW
.
User
,
idW
.
UserLength
);
}
if
(
id
->
DomainLength
)
{
idW
.
DomainLength
=
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
id
->
Domain
,
id
->
DomainLength
,
NULL
,
0
);
if
(
!
(
idW
.
Domain
=
malloc
(
idW
.
DomainLength
*
sizeof
(
SEC_WCHAR
)
)))
goto
done
;
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
id
->
Domain
,
id
->
DomainLength
,
idW
.
Domain
,
idW
.
DomainLength
);
}
if
(
id
->
PasswordLength
)
{
idW
.
PasswordLength
=
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
id
->
Password
,
id
->
PasswordLength
,
NULL
,
0
);
if
(
!
(
idW
.
Password
=
malloc
(
idW
.
PasswordLength
*
sizeof
(
SEC_WCHAR
)
)))
goto
done
;
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
id
->
Password
,
id
->
PasswordLength
,
idW
.
Password
,
idW
.
PasswordLength
);
}
else
auth_dataW
=
(
PSEC_WINNT_AUTH_IDENTITY_W
)
auth_data
;
idW
.
Flags
=
SEC_WINNT_AUTH_IDENTITY_UNICODE
;
auth_data
=
&
idW
;
}
status
=
lsa_AcquireCredentialsHandleW
(
principalW
,
packageW
,
credentials_use
,
logon_id
,
auth_data
W
,
get_key_fn
,
status
=
lsa_AcquireCredentialsHandleW
(
principalW
,
packageW
,
credentials_use
,
logon_id
,
auth_data
,
get_key_fn
,
get_key_arg
,
credential
,
ts_expiry
);
done:
if
(
auth_dataW
!=
(
SEC_WINNT_AUTH_IDENTITY_W
*
)
id
)
free
(
auth_dataW
);
free
(
packageW
);
free
(
principalW
);
free
(
u
ser
);
free
(
d
omain
);
free
(
passw
d
);
free
(
idW
.
U
ser
);
free
(
idW
.
D
omain
);
free
(
idW
.
Passwor
d
);
return
status
;
}
...
...
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