summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/sec_auth.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/sec_auth.cc')
-rw-r--r--winsup/cygwin/sec_auth.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/winsup/cygwin/sec_auth.cc b/winsup/cygwin/sec_auth.cc
index f01abf912..0e2dde689 100644
--- a/winsup/cygwin/sec_auth.cc
+++ b/winsup/cygwin/sec_auth.cc
@@ -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;
}