* cyglsa.c (LsaApLogonUserEx): Accommodate the fact that authinf->domain
and authinf->username are now of type WCHAR. Change sam_username and sam_u size to be deifned in terms of MAX_DOMAIN_NAME_LEN instead of INTERNET_MAX_HOST_NAME_LENGTH.
This commit is contained in:
parent
9a51257715
commit
824fe06cbe
|
@ -1,3 +1,10 @@
|
||||||
|
2008-07-11 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* cyglsa.c (LsaApLogonUserEx): Accommodate the fact that authinf->domain
|
||||||
|
and authinf->username are now of type WCHAR. Change sam_username and
|
||||||
|
sam_u size to be deifned in terms of MAX_DOMAIN_NAME_LEN instead of
|
||||||
|
INTERNET_MAX_HOST_NAME_LENGTH.
|
||||||
|
|
||||||
2008-07-10 Corinna Vinschen <corinna@vinschen.de>
|
2008-07-10 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* cyglsa.c: Revamp debugging output.
|
* cyglsa.c: Revamp debugging output.
|
||||||
|
|
|
@ -17,6 +17,7 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <wininet.h>
|
#include <wininet.h>
|
||||||
#include <lm.h>
|
#include <lm.h>
|
||||||
|
#include <iptypes.h>
|
||||||
#include <ntsecapi.h>
|
#include <ntsecapi.h>
|
||||||
#include <ntddk.h>
|
#include <ntddk.h>
|
||||||
#include "../cygwin/cyglsa.h"
|
#include "../cygwin/cyglsa.h"
|
||||||
|
@ -290,9 +291,7 @@ LsaApLogonUserEx (PLSA_CLIENT_REQUEST request, SECURITY_LOGON_TYPE logon_type,
|
||||||
PVOID *tok, PUNICODE_STRING *account,
|
PVOID *tok, PUNICODE_STRING *account,
|
||||||
PUNICODE_STRING *authority, PUNICODE_STRING *machine)
|
PUNICODE_STRING *authority, PUNICODE_STRING *machine)
|
||||||
{
|
{
|
||||||
WCHAR user[UNLEN + 1];
|
DWORD checksum, i;
|
||||||
WCHAR domain[INTERNET_MAX_HOST_NAME_LENGTH + 1];
|
|
||||||
DWORD checksum, ulen, dlen, i;
|
|
||||||
PDWORD csp, csp_end;
|
PDWORD csp, csp_end;
|
||||||
NTSTATUS stat;
|
NTSTATUS stat;
|
||||||
SECPKG_CLIENT_INFO clinf;
|
SECPKG_CLIENT_INFO clinf;
|
||||||
|
@ -338,15 +337,15 @@ LsaApLogonUserEx (PLSA_CLIENT_REQUEST request, SECURITY_LOGON_TYPE logon_type,
|
||||||
The name of the logon account name as returned by LookupAccountSid
|
The name of the logon account name as returned by LookupAccountSid
|
||||||
is created from here as "authority\account". */
|
is created from here as "authority\account". */
|
||||||
authinf->username[UNLEN] = '\0';
|
authinf->username[UNLEN] = '\0';
|
||||||
ulen = mbstowcs (user, authinf->username, sizeof (user));
|
authinf->domain[MAX_DOMAIN_NAME_LEN] = '\0';
|
||||||
authinf->domain[INTERNET_MAX_HOST_NAME_LENGTH] = '\0';
|
if (account && !(*account = uni_alloc (authinf->username,
|
||||||
dlen = mbstowcs (domain, authinf->domain, sizeof (domain));
|
wcslen (authinf->username))))
|
||||||
if (account && !(*account = uni_alloc (user, ulen)))
|
|
||||||
{
|
{
|
||||||
printf ("No memory trying to create account.\n");
|
printf ("No memory trying to create account.\n");
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
if (authority && !(*authority = uni_alloc (domain, dlen)))
|
if (authority && !(*authority = uni_alloc (authinf->domain,
|
||||||
|
wcslen (authinf->domain))))
|
||||||
{
|
{
|
||||||
printf ("No memory trying to create authority.\n");
|
printf ("No memory trying to create authority.\n");
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
|
@ -369,7 +368,7 @@ LsaApLogonUserEx (PLSA_CLIENT_REQUEST request, SECURITY_LOGON_TYPE logon_type,
|
||||||
{
|
{
|
||||||
#ifdef JUST_ANOTHER_NONWORKING_SOLUTION
|
#ifdef JUST_ANOTHER_NONWORKING_SOLUTION
|
||||||
cygprf_t prf;
|
cygprf_t prf;
|
||||||
WCHAR sam_username[INTERNET_MAX_HOST_NAME_LENGTH + UNLEN + 2];
|
WCHAR sam_username[MAX_DOMAIN_NAME_LEN + UNLEN + 2];
|
||||||
SECURITY_STRING sam_user, prefix;
|
SECURITY_STRING sam_user, prefix;
|
||||||
PUCHAR user_auth;
|
PUCHAR user_auth;
|
||||||
ULONG user_auth_size;
|
ULONG user_auth_size;
|
||||||
|
@ -392,14 +391,14 @@ LsaApLogonUserEx (PLSA_CLIENT_REQUEST request, SECURITY_LOGON_TYPE logon_type,
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* That's how it was supposed to work according to MSDN... */
|
/* That's how it was supposed to work according to MSDN... */
|
||||||
wcscpy (sam_username, domain);
|
wcscpy (sam_username, authinf->domain);
|
||||||
wcscat (sam_username, L"\\");
|
wcscat (sam_username, L"\\");
|
||||||
wcscat (sam_username, user);
|
wcscat (sam_username, authinf->username);
|
||||||
#else
|
#else
|
||||||
/* That's the only solution which worked, and then it only worked
|
/* That's the only solution which worked, and then it only worked
|
||||||
for machine local accounts. No domain authentication possible.
|
for machine local accounts. No domain authentication possible.
|
||||||
STATUS_NO_SUCH_USER galore! */
|
STATUS_NO_SUCH_USER galore! */
|
||||||
wcscpy (sam_username, user);
|
wcscpy (sam_username, authinf->username);
|
||||||
#endif
|
#endif
|
||||||
RtlInitUnicodeString (&sam_user, sam_username);
|
RtlInitUnicodeString (&sam_user, sam_username);
|
||||||
RtlInitUnicodeString (&prefix, L"");
|
RtlInitUnicodeString (&prefix, L"");
|
||||||
|
@ -411,7 +410,7 @@ LsaApLogonUserEx (PLSA_CLIENT_REQUEST request, SECURITY_LOGON_TYPE logon_type,
|
||||||
&user_auth_size, &flatnm);
|
&user_auth_size, &flatnm);
|
||||||
if (!NT_SUCCESS (stat))
|
if (!NT_SUCCESS (stat))
|
||||||
{
|
{
|
||||||
char sam_u[INTERNET_MAX_HOST_NAME_LENGTH + UNLEN + 2];
|
char sam_u[MAX_DOMAIN_NAME_LEN + UNLEN + 2];
|
||||||
wcstombs (sam_u, sam_user.Buffer, sizeof (sam_u));
|
wcstombs (sam_u, sam_user.Buffer, sizeof (sam_u));
|
||||||
printf ("GetAuthDataForUser (%u,%u,%s) failed: 0x%08lx\n",
|
printf ("GetAuthDataForUser (%u,%u,%s) failed: 0x%08lx\n",
|
||||||
sam_user.Length, sam_user.MaximumLength, sam_u, stat);
|
sam_user.Length, sam_user.MaximumLength, sam_u, stat);
|
||||||
|
|
Loading…
Reference in New Issue