[2/7] sspicli: Implement SspiEncodeStringsAsAuthIdentity.
Hans Leidekker
hans at codeweavers.com
Wed Jul 13 03:28:30 CDT 2016
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
dlls/sspicli/Makefile.in | 3 ++
dlls/sspicli/main.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++
dlls/sspicli/sspicli.spec | 2 +-
3 files changed, 85 insertions(+), 1 deletion(-)
create mode 100644 dlls/sspicli/main.c
diff --git a/dlls/sspicli/Makefile.in b/dlls/sspicli/Makefile.in
index 24e8d43..ceef844 100644
--- a/dlls/sspicli/Makefile.in
+++ b/dlls/sspicli/Makefile.in
@@ -1 +1,4 @@
MODULE = sspicli.dll
+
+C_SRCS = \
+ main.c
diff --git a/dlls/sspicli/main.c b/dlls/sspicli/main.c
new file mode 100644
index 0000000..a5313cb
--- /dev/null
+++ b/dlls/sspicli/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;
+}
diff --git a/dlls/sspicli/sspicli.spec b/dlls/sspicli/sspicli.spec
index acd8b70..7b92102 100644
--- a/dlls/sspicli/sspicli.spec
+++ b/dlls/sspicli/sspicli.spec
@@ -84,7 +84,7 @@
@ stub SspiDecryptAuthIdentity
@ stub SspiDecryptAuthIdentityEx
@ stub SspiEncodeAuthIdentityAsStrings
-@ stub SspiEncodeStringsAsAuthIdentity
+@ stdcall SspiEncodeStringsAsAuthIdentity(wstr wstr wstr ptr)
@ stub SspiEncryptAuthIdentity
@ stub SspiEncryptAuthIdentityEx
@ stub SspiExcludePackage
--
2.8.1
More information about the wine-patches
mailing list