]> sourceware.org Git - newlib-cygwin.git/commitdiff
* cyglsa.c (LsaApLogonUserEx): Accommodate the fact that authinf->domain
authorCorinna Vinschen <corinna@vinschen.de>
Fri, 11 Jul 2008 10:00:38 +0000 (10:00 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Fri, 11 Jul 2008 10:00:38 +0000 (10:00 +0000)
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.

winsup/lsaauth/ChangeLog
winsup/lsaauth/cyglsa.c

index a562da2df5befb150bd3e988a566e8451878c07d..b01e292ea0c6b51c2477f968018663f3c9e3c1bb 100644 (file)
@@ -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>
 
        * cyglsa.c: Revamp debugging output.
index 35edc6fa1316714fbd1112b7fe8fb3ff75eaa4e8..acd271f93dc847571797c59b400fbe0e106f44ab 100644 (file)
@@ -17,6 +17,7 @@ Cygwin license.  Please consult the file "CYGWIN_LICENSE" for details. */
 #include <windows.h>
 #include <wininet.h>
 #include <lm.h>
+#include <iptypes.h>
 #include <ntsecapi.h>
 #include <ntddk.h>
 #include "../cygwin/cyglsa.h"
@@ -290,9 +291,7 @@ LsaApLogonUserEx (PLSA_CLIENT_REQUEST request, SECURITY_LOGON_TYPE logon_type,
                  PVOID *tok, PUNICODE_STRING *account,
                  PUNICODE_STRING *authority, PUNICODE_STRING *machine)
 {
-  WCHAR user[UNLEN + 1];
-  WCHAR domain[INTERNET_MAX_HOST_NAME_LENGTH + 1];
-  DWORD checksum, ulen, dlen, i;
+  DWORD checksum, i;
   PDWORD csp, csp_end;
   NTSTATUS stat;
   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
      is created from here as "authority\account". */
   authinf->username[UNLEN] = '\0';
-  ulen = mbstowcs (user, authinf->username, sizeof (user));
-  authinf->domain[INTERNET_MAX_HOST_NAME_LENGTH] = '\0';
-  dlen = mbstowcs (domain, authinf->domain, sizeof (domain));
-  if (account && !(*account = uni_alloc (user, ulen)))
+  authinf->domain[MAX_DOMAIN_NAME_LEN] = '\0';
+  if (account && !(*account = uni_alloc (authinf->username,
+                                        wcslen (authinf->username))))
     {
       printf ("No memory trying to create account.\n");
       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");
       return STATUS_NO_MEMORY;
@@ -369,7 +368,7 @@ LsaApLogonUserEx (PLSA_CLIENT_REQUEST request, SECURITY_LOGON_TYPE logon_type,
     {
 #ifdef JUST_ANOTHER_NONWORKING_SOLUTION
       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;
       PUCHAR user_auth;
       ULONG user_auth_size;
@@ -392,14 +391,14 @@ LsaApLogonUserEx (PLSA_CLIENT_REQUEST request, SECURITY_LOGON_TYPE logon_type,
 
 #if 0
       /* 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, user);
+      wcscat (sam_username, authinf->username);
 #else
       /* That's the only solution which worked, and then it only worked
          for machine local accounts.  No domain authentication possible.
         STATUS_NO_SUCH_USER galore! */
-      wcscpy (sam_username, user);
+      wcscpy (sam_username, authinf->username);
 #endif
       RtlInitUnicodeString (&sam_user, sam_username);
       RtlInitUnicodeString (&prefix, L"");
@@ -411,7 +410,7 @@ LsaApLogonUserEx (PLSA_CLIENT_REQUEST request, SECURITY_LOGON_TYPE logon_type,
                                        &user_auth_size, &flatnm);
       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));
          printf ("GetAuthDataForUser (%u,%u,%s) failed: 0x%08lx\n",
                  sam_user.Length, sam_user.MaximumLength, sam_u, stat);
This page took 0.110039 seconds and 5 git commands to generate.