ReactOS 0.4.17-dev-769-g1500a35
main.c File Reference
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "rpc.h"
#include "sspi.h"
#include "wincred.h"
#include "wine/debug.h"
Include dependency graph for main.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (sspicli)
 
SECURITY_STATUS SEC_ENTRY SspiEncodeStringsAsAuthIdentity (const WCHAR *username, const WCHAR *domainname, const WCHAR *creds, PSEC_WINNT_AUTH_IDENTITY_OPAQUE *opaque_id)
 
void SEC_ENTRY SspiZeroAuthIdentity (PSEC_WINNT_AUTH_IDENTITY_OPAQUE opaque_id)
 
SECURITY_STATUS SEC_ENTRY SspiEncodeAuthIdentityAsStrings (PSEC_WINNT_AUTH_IDENTITY_OPAQUE opaque_id, PCWSTR *username, PCWSTR *domainname, PCWSTR *creds)
 
void SEC_ENTRY SspiFreeAuthIdentity (PSEC_WINNT_AUTH_IDENTITY_OPAQUE opaque_id)
 
void SEC_ENTRY SspiLocalFree (void *ptr)
 
SECURITY_STATUS SEC_ENTRY SspiPrepareForCredWrite (PSEC_WINNT_AUTH_IDENTITY_OPAQUE opaque_id, PCWSTR target, PULONG type, PCWSTR *targetname, PCWSTR *username, PUCHAR *blob, PULONG size)
 

Function Documentation

◆ SspiEncodeAuthIdentityAsStrings()

SECURITY_STATUS SEC_ENTRY SspiEncodeAuthIdentityAsStrings ( PSEC_WINNT_AUTH_IDENTITY_OPAQUE  opaque_id,
PCWSTR username,
PCWSTR domainname,
PCWSTR creds 
)

Definition at line 103 of file main.c.

106{
108
109 FIXME("%p %p %p %p\n", opaque_id, username, domainname, creds);
110
111 *username = wcsdup( id->User );
112 *domainname = wcsdup( id->Domain );
113 *creds = wcsdup( id->Password );
114
115 return SEC_E_OK;
116}
#define FIXME(fmt,...)
Definition: precomp.h:53
static wchar_t * wcsdup(const wchar_t *str)
Definition: string.h:94
GLuint id
Definition: glext.h:5910
static WCHAR username[]
Definition: url.c:32
#define SEC_E_OK
Definition: winerror.h:3450

◆ SspiEncodeStringsAsAuthIdentity()

SECURITY_STATUS SEC_ENTRY SspiEncodeStringsAsAuthIdentity ( const WCHAR username,
const WCHAR domainname,
const WCHAR creds,
PSEC_WINNT_AUTH_IDENTITY_OPAQUE opaque_id 
)

Definition at line 35 of file main.c.

38{
40 DWORD len_username = 0, len_domainname = 0, len_password = 0, size;
41 WCHAR *ptr;
42
43 FIXME( "%s %s %s %p\n", debugstr_w(username), debugstr_w(domainname),
44 debugstr_w(creds), opaque_id );
45
46 if (!username && !domainname && !creds) return SEC_E_INVALID_TOKEN;
47
48 if (username) len_username = lstrlenW( username );
49 if (domainname) len_domainname = lstrlenW( domainname );
50 if (creds) len_password = lstrlenW( creds );
51
52 size = sizeof(*id);
53 if (username) size += (len_username + 1) * sizeof(WCHAR);
54 if (domainname) size += (len_domainname + 1) * sizeof(WCHAR);
55 if (creds) size += (len_password + 1) * sizeof(WCHAR);
56 if (!(id = calloc( 1, size ))) return ERROR_OUTOFMEMORY;
57 ptr = (WCHAR *)(id + 1);
58
59 if (username)
60 {
61 memcpy( ptr, username, (len_username + 1) * sizeof(WCHAR) );
62 id->User = ptr;
63 id->UserLength = len_username;
64 ptr += len_username + 1;
65 }
66 if (domainname)
67 {
68 memcpy( ptr, domainname, (len_domainname + 1) * sizeof(WCHAR) );
69 id->Domain = ptr;
70 id->DomainLength = len_domainname;
71 ptr += len_domainname + 1;
72 }
73 if (creds)
74 {
75 memcpy( ptr, creds, (len_password + 1) * sizeof(WCHAR) );
76 id->Password = ptr;
77 id->PasswordLength = len_password;
78 }
79
80 *opaque_id = id;
81 return SEC_E_OK;
82}
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define lstrlenW
Definition: compat.h:750
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
#define debugstr_w
Definition: kernel32.h:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
short WCHAR
Definition: pedump.c:58
#define calloc
Definition: rosglue.h:14
#define SEC_E_INVALID_TOKEN
Definition: winerror.h:4314

◆ SspiFreeAuthIdentity()

void SEC_ENTRY SspiFreeAuthIdentity ( PSEC_WINNT_AUTH_IDENTITY_OPAQUE  opaque_id)

Definition at line 121 of file main.c.

122{
123 TRACE( "%p\n", opaque_id );
124 free( opaque_id );
125}
#define free
Definition: debug_ros.c:5
#define TRACE(s)
Definition: solgame.cpp:4

◆ SspiLocalFree()

void SEC_ENTRY SspiLocalFree ( void ptr)

Definition at line 130 of file main.c.

131{
132 TRACE( "%p\n", ptr );
133 free( ptr );
134}

◆ SspiPrepareForCredWrite()

SECURITY_STATUS SEC_ENTRY SspiPrepareForCredWrite ( PSEC_WINNT_AUTH_IDENTITY_OPAQUE  opaque_id,
PCWSTR  target,
PULONG  type,
PCWSTR targetname,
PCWSTR username,
PUCHAR blob,
PULONG  size 
)

Definition at line 139 of file main.c.

141{
143 WCHAR *str, *str2;
145 ULONG len;
146
147 FIXME( "%p %s %p %p %p %p %p\n", opaque_id, debugstr_w(target), type, targetname, username,
148 blob, size );
149
150 if (id->DomainLength)
151 {
152 len = (id->DomainLength + id->UserLength + 2) * sizeof(WCHAR);
153 if (!(str = malloc( len ))) return SEC_E_INSUFFICIENT_MEMORY;
154 memcpy( str, id->Domain, id->DomainLength * sizeof(WCHAR) );
155 str[id->DomainLength] = '\\';
156 memcpy( str + id->DomainLength + 1, id->User, id->UserLength * sizeof(WCHAR) );
157 str[id->DomainLength + 1 + id->UserLength] = 0;
158 }
159 else
160 {
161 len = (id->UserLength + 1) * sizeof(WCHAR);
162 if (!(str = malloc( len ))) return SEC_E_INSUFFICIENT_MEMORY;
163 memcpy( str, id->User, id->UserLength * sizeof(WCHAR) );
164 str[id->UserLength] = 0;
165 }
166
167 str2 = target ? wcsdup( target ) : wcsdup( str );
168 if (!str2)
169 {
170 free( str );
172 }
173
174 len = id->PasswordLength * sizeof(WCHAR);
175 if (!(password = malloc( len )))
176 {
177 free( str );
178 free( str2 );
180 }
181 memcpy( password, id->Password, len );
182
184 *username = str;
185 *targetname = str2;
186 *blob = password;
187 *size = len;
188
189 return SEC_E_OK;
190}
static UCHAR password[]
Definition: bcrypt.c:520
#define malloc
Definition: debug_ros.c:4
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum GLsizei len
Definition: glext.h:6722
const WCHAR * str
XML_HIDDEN void xmlParserErrors const char const xmlChar const xmlChar * str2
Definition: parser.h:35
Definition: image.c:134
Definition: tools.h:99
unsigned char UCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define CRED_TYPE_DOMAIN_PASSWORD
Definition: wincred.h:205
#define SEC_E_INSUFFICIENT_MEMORY
Definition: winerror.h:4306

◆ SspiZeroAuthIdentity()

void SEC_ENTRY SspiZeroAuthIdentity ( PSEC_WINNT_AUTH_IDENTITY_OPAQUE  opaque_id)

Definition at line 87 of file main.c.

88{
90
91 TRACE( "%p\n", opaque_id );
92
93 if (!id) return;
94 if (id->User) memset( id->User, 0, id->UserLength * sizeof(WCHAR) );
95 if (id->Domain) memset( id->Domain, 0, id->DomainLength * sizeof(WCHAR) );
96 if (id->Password) memset( id->Password, 0, id->PasswordLength * sizeof(WCHAR) );
97 memset( id, 0, sizeof(*id) );
98}
#define memset(x, y, z)
Definition: compat.h:39

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( sspicli  )