* cyglsa.c: Don't include ntddk.h.
(RtlInitEmptyUnicodeString): Use Visual-C compatible "__inline" instead of "inline". (uni_alloc): Change second argument to USHORT. (printf): Move definition of ap to make Visual-C++ happy. (LsaApLogonUserEx): Compute size of datastructure returned to LSA on 64 bit systems correctly to avoid heap corruption. * cyglsa64.dll: Regenerate. * make-64bit-version-with-visual-c.bat: Accommodate newer Microsoft toolchains. Add more comment. * mslsa.def: Export LsaApLogonUserEx instead of LsaApLogonUser.
This commit is contained in:
parent
25dab6dc60
commit
5a0c7f1df9
|
@ -1,3 +1,17 @@
|
||||||
|
2008-07-13 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* cyglsa.c: Don't include ntddk.h.
|
||||||
|
(RtlInitEmptyUnicodeString): Use Visual-C compatible "__inline" instead
|
||||||
|
of "inline".
|
||||||
|
(uni_alloc): Change second argument to USHORT.
|
||||||
|
(printf): Move definition of ap to make Visual-C++ happy.
|
||||||
|
(LsaApLogonUserEx): Compute size of datastructure returned to
|
||||||
|
LSA on 64 bit systems correctly to avoid heap corruption.
|
||||||
|
* cyglsa64.dll: Regenerate.
|
||||||
|
* make-64bit-version-with-visual-c.bat: Accommodate newer Microsoft
|
||||||
|
toolchains. Add more comment.
|
||||||
|
* mslsa.def: Export LsaApLogonUserEx instead of LsaApLogonUser.
|
||||||
|
|
||||||
2008-07-11 Corinna Vinschen <corinna@vinschen.de>
|
2008-07-11 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* cyglsa.c (LsaApLogonUserEx): Accommodate the fact that authinf->domain
|
* cyglsa.c (LsaApLogonUserEx): Accommodate the fact that authinf->domain
|
||||||
|
|
|
@ -19,7 +19,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */
|
||||||
#include <lm.h>
|
#include <lm.h>
|
||||||
#include <iptypes.h>
|
#include <iptypes.h>
|
||||||
#include <ntsecapi.h>
|
#include <ntsecapi.h>
|
||||||
#include <ntddk.h>
|
|
||||||
#include "../cygwin/cyglsa.h"
|
#include "../cygwin/cyglsa.h"
|
||||||
#include "../cygwin/include/cygwin/version.h"
|
#include "../cygwin/include/cygwin/version.h"
|
||||||
|
|
||||||
|
@ -41,9 +40,8 @@ DllMain (HINSTANCE inst, DWORD reason, LPVOID res)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef RtlInitEmptyUnicodeString
|
#ifndef RtlInitEmptyUnicodeString
|
||||||
inline
|
__inline VOID NTAPI
|
||||||
VOID NTAPI RtlInitEmptyUnicodeString(PUNICODE_STRING dest, PCWSTR buf,
|
RtlInitEmptyUnicodeString(PUNICODE_STRING dest, PCWSTR buf, USHORT len)
|
||||||
USHORT len)
|
|
||||||
{
|
{
|
||||||
dest->Length = 0;
|
dest->Length = 0;
|
||||||
dest->MaximumLength = len;
|
dest->MaximumLength = len;
|
||||||
|
@ -52,7 +50,7 @@ VOID NTAPI RtlInitEmptyUnicodeString(PUNICODE_STRING dest, PCWSTR buf,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static PUNICODE_STRING
|
static PUNICODE_STRING
|
||||||
uni_alloc (PWCHAR src, DWORD len)
|
uni_alloc (PWCHAR src, USHORT len)
|
||||||
{
|
{
|
||||||
PUNICODE_STRING tgt;
|
PUNICODE_STRING tgt;
|
||||||
|
|
||||||
|
@ -80,10 +78,10 @@ printf (const char *format, ...)
|
||||||
char buf[256];
|
char buf[256];
|
||||||
DWORD wr;
|
DWORD wr;
|
||||||
int ret;
|
int ret;
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
if (fh == INVALID_HANDLE_VALUE)
|
if (fh == INVALID_HANDLE_VALUE)
|
||||||
return 0;
|
return 0;
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
va_start (ap, format);
|
va_start (ap, format);
|
||||||
ret = _vsnprintf (buf, 256, format, ap);
|
ret = _vsnprintf (buf, 256, format, ap);
|
||||||
|
@ -471,14 +469,17 @@ LsaApLogonUserEx (PLSA_CLIENT_REQUEST request, SECURITY_LOGON_TYPE logon_type,
|
||||||
base = (LONG_PTR) &authinf->inf;
|
base = (LONG_PTR) &authinf->inf;
|
||||||
|
|
||||||
newsize = authinf->inf_size;
|
newsize = authinf->inf_size;
|
||||||
newsize += sizeof (PSID) - sizeof (OFFSET); /* User SID */
|
newsize += sizeof (TOKEN_USER) - sizeof (CYG_TOKEN_USER); /* User SID */
|
||||||
newsize += sizeof (PTOKEN_GROUPS) - sizeof (OFFSET); /* Groups */
|
newsize += sizeof (PTOKEN_GROUPS) - sizeof (OFFSET); /* Groups */
|
||||||
src_grps = (PCYG_TOKEN_GROUPS) (base + authinf->inf.Groups);
|
src_grps = (PCYG_TOKEN_GROUPS) (base + authinf->inf.Groups);
|
||||||
newsize += src_grps->GroupCount /* Group SIDs */
|
newsize += src_grps->GroupCount /* Group SIDs */
|
||||||
* (sizeof (PSID) - sizeof (OFFSET));
|
* (sizeof (SID_AND_ATTRIBUTES)
|
||||||
|
- sizeof (CYG_SID_AND_ATTRIBUTES));
|
||||||
newsize += sizeof (PSID) - sizeof (OFFSET); /* Primary Group SID */
|
newsize += sizeof (PSID) - sizeof (OFFSET); /* Primary Group SID */
|
||||||
newsize += sizeof (PSID) - sizeof (OFFSET); /* Owner SID */
|
newsize += sizeof (PTOKEN_PRIVILEGES) - sizeof (OFFSET); /* Privileges */
|
||||||
|
newsize += 0; /* Owner SID */
|
||||||
newsize += sizeof (PACL) - sizeof (OFFSET); /* Default DACL */
|
newsize += sizeof (PACL) - sizeof (OFFSET); /* Default DACL */
|
||||||
|
|
||||||
if (!(tokinf = funcs->AllocateLsaHeap (newsize)))
|
if (!(tokinf = funcs->AllocateLsaHeap (newsize)))
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
tptr = (PBYTE)(tokinf + 1);
|
tptr = (PBYTE)(tokinf + 1);
|
||||||
|
|
Binary file not shown.
|
@ -5,6 +5,11 @@ rem
|
||||||
rem Note that you need not only the SDK headers and libs, but also the
|
rem Note that you need not only the SDK headers and libs, but also the
|
||||||
rem 64 bit ntdll.lib file from a DDK supporting 64 bit builds.
|
rem 64 bit ntdll.lib file from a DDK supporting 64 bit builds.
|
||||||
rem
|
rem
|
||||||
|
rem Make sure all necessary include paths are set in %Include% (inc\ddk,
|
||||||
|
rem inc\atl, inc\crt) and rem that %Lib% points to the 64 bit libs, not
|
||||||
|
rem the 32 bit libs. In the latter case the link stage will succeed,
|
||||||
|
rem but the resulting DLL is non-functional.
|
||||||
|
rem
|
||||||
rem This can be used as long as no x86_64-pe/coff capable gcc is available.
|
rem This can be used as long as no x86_64-pe/coff capable gcc is available.
|
||||||
rem Note that this is for building inside the source dir as not to interfere
|
rem Note that this is for building inside the source dir as not to interfere
|
||||||
rem with the "official" 32 bit build in the build directory.
|
rem with the "official" 32 bit build in the build directory.
|
||||||
|
@ -12,5 +17,13 @@ rem
|
||||||
rem Install the dll into /bin and use the cyglsa-config script to register it.
|
rem Install the dll into /bin and use the cyglsa-config script to register it.
|
||||||
rem Don't forget to reboot afterwards.
|
rem Don't forget to reboot afterwards.
|
||||||
rem
|
rem
|
||||||
cl /Wp64 /c cyglsa.c
|
rem Use "/DDEBUGGING" in the cl line to create debugging output to
|
||||||
link /nodefaultlib /dll /machine:x64 /entry:DllMain /out:cyglsa64.dll /def:mslsa.def cyglsa.obj runtmchk.lib advapi32.lib kernel32.lib ntdll.lib
|
rem C:\cyglsa.dbgout at runtime.
|
||||||
|
rem
|
||||||
|
rem No idea when that changed, but in the latest SDKs you have to disable
|
||||||
|
rem the security checks and there's apparently no runtmchk.lib anymore.
|
||||||
|
rem I leave the old statements in for reference.
|
||||||
|
rem cl /Wp64 /c cyglsa.c
|
||||||
|
rem link /nodefaultlib /dll /machine:x64 /entry:DllMain /out:cyglsa64.dll /def:mslsa.def cyglsa.obj runtmchk.lib advapi32.lib kernel32.lib ntdll.lib
|
||||||
|
cl /Wp64 /EHs-c- /GS- /GR- /GL- /c cyglsa.c
|
||||||
|
link /nodefaultlib /dll /machine:x64 /entry:DllMain /out:cyglsa64.dll /def:mslsa.def cyglsa.obj advapi32.lib kernel32.lib ntdll.lib
|
||||||
|
|
|
@ -2,7 +2,7 @@ LIBRARY "cyglsa64"
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
LsaApInitializePackage
|
LsaApInitializePackage
|
||||||
LsaApLogonUser
|
LsaApLogonUserEx
|
||||||
LsaApLogonTerminated
|
LsaApLogonTerminated
|
||||||
LsaApCallPackage
|
LsaApCallPackage
|
||||||
LsaApCallPackagePassthrough = LsaApCallPackage
|
LsaApCallPackagePassthrough = LsaApCallPackage
|
||||||
|
|
Loading…
Reference in New Issue