sspicli: Implement SspiEncodeStringsAsAuthIdentity.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b342ef95db
commit
765f1b237f
|
@ -1 +1,4 @@
|
||||||
MODULE = sspicli.dll
|
MODULE = sspicli.dll
|
||||||
|
|
||||||
|
C_SRCS = \
|
||||||
|
main.c
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2016 Hans Leidekker for CodeWeavers
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#include "windef.h"
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "rpc.h"
|
||||||
|
#include "sspi.h"
|
||||||
|
|
||||||
|
#include "wine/debug.h"
|
||||||
|
#include "wine/unicode.h"
|
||||||
|
|
||||||
|
WINE_DEFAULT_DEBUG_CHANNEL(sspicli);
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* SspiEncodeStringsAsAuthIdentity (SECUR32.0)
|
||||||
|
*/
|
||||||
|
SECURITY_STATUS SEC_ENTRY SspiEncodeStringsAsAuthIdentity(
|
||||||
|
const WCHAR *username, const WCHAR *domainname, const WCHAR *creds,
|
||||||
|
PSEC_WINNT_AUTH_IDENTITY_OPAQUE *opaque_id )
|
||||||
|
{
|
||||||
|
SEC_WINNT_AUTH_IDENTITY_W *id;
|
||||||
|
DWORD len_username = 0, len_domainname = 0, len_password = 0, size;
|
||||||
|
WCHAR *ptr;
|
||||||
|
|
||||||
|
FIXME( "%s %s %s %p\n", debugstr_w(username), debugstr_w(domainname),
|
||||||
|
debugstr_w(creds), opaque_id );
|
||||||
|
|
||||||
|
if (!username && !domainname && !creds) return SEC_E_INVALID_TOKEN;
|
||||||
|
|
||||||
|
if (username) len_username = strlenW( username );
|
||||||
|
if (domainname) len_domainname = strlenW( domainname );
|
||||||
|
if (creds) len_password = strlenW( creds );
|
||||||
|
|
||||||
|
size = sizeof(*id);
|
||||||
|
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;
|
||||||
|
ptr = (WCHAR *)(id + 1);
|
||||||
|
|
||||||
|
if (username)
|
||||||
|
{
|
||||||
|
memcpy( ptr, username, (len_username + 1) * sizeof(WCHAR) );
|
||||||
|
id->User = ptr;
|
||||||
|
id->UserLength = len_username;
|
||||||
|
ptr += len_username + 1;
|
||||||
|
}
|
||||||
|
if (domainname)
|
||||||
|
{
|
||||||
|
memcpy( ptr, domainname, (len_domainname + 1) * sizeof(WCHAR) );
|
||||||
|
id->Domain = ptr;
|
||||||
|
id->DomainLength = len_domainname;
|
||||||
|
ptr += len_domainname + 1;
|
||||||
|
}
|
||||||
|
if (creds)
|
||||||
|
{
|
||||||
|
memcpy( ptr, creds, (len_password + 1) * sizeof(WCHAR) );
|
||||||
|
id->Password = ptr;
|
||||||
|
id->PasswordLength = len_password;
|
||||||
|
}
|
||||||
|
|
||||||
|
*opaque_id = id;
|
||||||
|
return SEC_E_OK;
|
||||||
|
}
|
|
@ -84,7 +84,7 @@
|
||||||
@ stub SspiDecryptAuthIdentity
|
@ stub SspiDecryptAuthIdentity
|
||||||
@ stub SspiDecryptAuthIdentityEx
|
@ stub SspiDecryptAuthIdentityEx
|
||||||
@ stub SspiEncodeAuthIdentityAsStrings
|
@ stub SspiEncodeAuthIdentityAsStrings
|
||||||
@ stub SspiEncodeStringsAsAuthIdentity
|
@ stdcall SspiEncodeStringsAsAuthIdentity(wstr wstr wstr ptr)
|
||||||
@ stub SspiEncryptAuthIdentity
|
@ stub SspiEncryptAuthIdentity
|
||||||
@ stub SspiEncryptAuthIdentityEx
|
@ stub SspiEncryptAuthIdentityEx
|
||||||
@ stub SspiExcludePackage
|
@ stub SspiExcludePackage
|
||||||
|
|
Loading…
Reference in New Issue