OSDN Git Service

* sec_auth.cc (open_local_policy): Set lsa handle to
authorcorinna <corinna>
Mon, 15 Dec 2008 20:25:44 +0000 (20:25 +0000)
committercorinna <corinna>
Mon, 15 Dec 2008 20:25:44 +0000 (20:25 +0000)
INVALID_HANDLE_VALUE when LsaOpenPolicy fails.  Explain why.

winsup/cygwin/ChangeLog
winsup/cygwin/sec_auth.cc

index fdaaf2b..2909ce1 100644 (file)
@@ -1,5 +1,10 @@
 2008-12-15  Corinna Vinschen  <corinna@vinschen.de>
 
+       * sec_auth.cc (open_local_policy): Set lsa handle to
+       INVALID_HANDLE_VALUE when LsaOpenPolicy fails.  Explain why.
+
+2008-12-15  Corinna Vinschen  <corinna@vinschen.de>
+
        * setlsapwd.cc (setlsapwd): Simplify code.  Only try to call cygserver
        if opening local policy fails.  Don't treat removing non-existant
        private data as error.
index f01abf9..0e2dde6 100644 (file)
@@ -159,7 +159,12 @@ open_local_policy (ACCESS_MASK access)
 
   NTSTATUS ret = LsaOpenPolicy (NULL, &oa, access, &lsa);
   if (ret != STATUS_SUCCESS)
-    __seterrno_from_win_error (LsaNtStatusToWinError (ret));
+    {
+      __seterrno_from_win_error (LsaNtStatusToWinError (ret));
+      /* Some versions of Windows set the lsa handle to NULL when
+         LsaOpenPolicy fails. */
+      lsa = INVALID_HANDLE_VALUE;
+    }
   return lsa;
 }