[newlib-cygwin] Cygwin: authentication: Always initialize domain info

Corinna Vinschen corinna@sourceware.org
Fri Mar 1 20:09:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=166913fb23dd7ac0c63976a2f4e40a9e44ca41ca

commit 166913fb23dd7ac0c63976a2f4e40a9e44ca41ca
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri Mar 1 21:08:09 2019 +0100

    Cygwin: authentication: Always initialize domain info
    
    ...before calling any of its method.  It's no safe bet that
    it's already initialized when calling s4uauth and adding it
    to load_user_profile certainly doesn't hurt.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/sec_auth.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/winsup/cygwin/sec_auth.cc b/winsup/cygwin/sec_auth.cc
index ee740fa..2f04801 100644
--- a/winsup/cygwin/sec_auth.cc
+++ b/winsup/cygwin/sec_auth.cc
@@ -234,6 +234,10 @@ load_user_profile (HANDLE token, struct passwd *pw, cygpsid &usersid)
   WCHAR userpath[MAX_PATH];
   PROFILEINFOW pi;
 
+  /* Initialize */
+  if (!cygheap->dom.init ())
+    return NULL;
+
   extract_nt_dom_user (pw, domain, username);
   usersid.string (sid);
   debug_printf ("user: <%W> <%W> <%W>", username, domain, sid);
@@ -1533,6 +1537,10 @@ s4uauth (bool logon, PCWSTR domain, PCWSTR user, NTSTATUS &ret_status)
   QUOTA_LIMITS quota;
   HANDLE token = NULL;
 
+  /* Initialize */
+  if (!cygheap->dom.init ())
+    return NULL;
+
   push_self_privilege (SE_TCB_PRIVILEGE, true);
 
   if (logon)



More information about the Cygwin-cvs mailing list