Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
0ba79248
Commit
0ba79248
authored
Nov 15, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sspicli: Use standard C functions for memory allocation.
parent
d222341f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
22 deletions
+14
-22
main.c
dlls/sspicli/main.c
+14
-22
No files found.
dlls/sspicli/main.c
View file @
0ba79248
...
...
@@ -17,6 +17,7 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
...
...
@@ -52,7 +53,7 @@ SECURITY_STATUS SEC_ENTRY SspiEncodeStringsAsAuthIdentity(
if
(
username
)
size
+=
(
len_username
+
1
)
*
sizeof
(
WCHAR
);
if
(
domainname
)
size
+=
(
len_domainname
+
1
)
*
sizeof
(
WCHAR
);
if
(
creds
)
size
+=
(
len_password
+
1
)
*
sizeof
(
WCHAR
);
if
(
!
(
id
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
)))
return
ERROR_OUTOFMEMORY
;
if
(
!
(
id
=
calloc
(
1
,
size
)))
return
ERROR_OUTOFMEMORY
;
ptr
=
(
WCHAR
*
)(
id
+
1
);
if
(
username
)
...
...
@@ -96,15 +97,6 @@ void SEC_ENTRY SspiZeroAuthIdentity( PSEC_WINNT_AUTH_IDENTITY_OPAQUE opaque_id )
memset
(
id
,
0
,
sizeof
(
*
id
)
);
}
static
inline
WCHAR
*
strdupW
(
const
WCHAR
*
src
)
{
WCHAR
*
dst
;
if
(
!
src
)
return
NULL
;
if
((
dst
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
src
)
+
1
)
*
sizeof
(
WCHAR
)
)))
lstrcpyW
(
dst
,
src
);
return
dst
;
}
/***********************************************************************
* SspiEncodeAuthIdentityAsStrings (SECUR32.0)
*/
...
...
@@ -116,9 +108,9 @@ SECURITY_STATUS SEC_ENTRY SspiEncodeAuthIdentityAsStrings(
FIXME
(
"%p %p %p %p
\n
"
,
opaque_id
,
username
,
domainname
,
creds
);
*
username
=
strdupW
(
id
->
User
);
*
domainname
=
strdupW
(
id
->
Domain
);
*
creds
=
strdupW
(
id
->
Password
);
*
username
=
wcsdup
(
id
->
User
);
*
domainname
=
wcsdup
(
id
->
Domain
);
*
creds
=
wcsdup
(
id
->
Password
);
return
SEC_E_OK
;
}
...
...
@@ -129,7 +121,7 @@ SECURITY_STATUS SEC_ENTRY SspiEncodeAuthIdentityAsStrings(
void
SEC_ENTRY
SspiFreeAuthIdentity
(
PSEC_WINNT_AUTH_IDENTITY_OPAQUE
opaque_id
)
{
TRACE
(
"%p
\n
"
,
opaque_id
);
HeapFree
(
GetProcessHeap
(),
0
,
opaque_id
);
free
(
opaque_id
);
}
/***********************************************************************
...
...
@@ -138,7 +130,7 @@ void SEC_ENTRY SspiFreeAuthIdentity( PSEC_WINNT_AUTH_IDENTITY_OPAQUE opaque_id )
void
SEC_ENTRY
SspiLocalFree
(
void
*
ptr
)
{
TRACE
(
"%p
\n
"
,
ptr
);
HeapFree
(
GetProcessHeap
(),
0
,
ptr
);
free
(
ptr
);
}
/***********************************************************************
...
...
@@ -158,7 +150,7 @@ SECURITY_STATUS SEC_ENTRY SspiPrepareForCredWrite( PSEC_WINNT_AUTH_IDENTITY_OPAQ
if
(
id
->
DomainLength
)
{
len
=
(
id
->
DomainLength
+
id
->
UserLength
+
2
)
*
sizeof
(
WCHAR
);
if
(
!
(
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
)))
return
SEC_E_INSUFFICIENT_MEMORY
;
if
(
!
(
str
=
malloc
(
len
)))
return
SEC_E_INSUFFICIENT_MEMORY
;
memcpy
(
str
,
id
->
Domain
,
id
->
DomainLength
*
sizeof
(
WCHAR
)
);
str
[
id
->
DomainLength
]
=
'\\'
;
memcpy
(
str
+
id
->
DomainLength
+
1
,
id
->
User
,
id
->
UserLength
*
sizeof
(
WCHAR
)
);
...
...
@@ -167,23 +159,23 @@ SECURITY_STATUS SEC_ENTRY SspiPrepareForCredWrite( PSEC_WINNT_AUTH_IDENTITY_OPAQ
else
{
len
=
(
id
->
UserLength
+
1
)
*
sizeof
(
WCHAR
);
if
(
!
(
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
)))
return
SEC_E_INSUFFICIENT_MEMORY
;
if
(
!
(
str
=
malloc
(
len
)))
return
SEC_E_INSUFFICIENT_MEMORY
;
memcpy
(
str
,
id
->
User
,
id
->
UserLength
*
sizeof
(
WCHAR
)
);
str
[
id
->
UserLength
]
=
0
;
}
str2
=
target
?
strdupW
(
target
)
:
strdupW
(
str
);
str2
=
target
?
wcsdup
(
target
)
:
wcsdup
(
str
);
if
(
!
str2
)
{
HeapFree
(
GetProcessHeap
(),
0
,
str
);
free
(
str
);
return
SEC_E_INSUFFICIENT_MEMORY
;
}
len
=
id
->
PasswordLength
*
sizeof
(
WCHAR
);
if
(
!
(
password
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
)))
if
(
!
(
password
=
malloc
(
len
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
str
);
HeapFree
(
GetProcessHeap
(),
0
,
str2
);
free
(
str
);
free
(
str2
);
return
SEC_E_INSUFFICIENT_MEMORY
;
}
memcpy
(
password
,
id
->
Password
,
len
);
...
...
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