* security.h (open_local_policy): Remove declaration.
(lsa_open_policy): Declare. (lsa_close_policy): Declare. * sec_auth.cc (lsa_open_policy): Rename from open_local_policy. Take server name as parameter. Return NULL in case of error, rather than INVALID_HANDLE_VALUE. (lsa_close_policy): Rename from close_local_policy. Make externally available. Get handle by value. (create_token): Convert call to open_local_policy/close_local_policy according to aforementioned changes. (lsaauth): Ditto. (lsaprivkeyauth): Ditto. * setlsapwd.cc (setlsapwd): Ditto.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* setlsapwd.cc: Set LSA private data password for current user.
|
||||
|
||||
Copyright 2008, 2009, 2011 Red Hat, Inc.
|
||||
Copyright 2008, 2009, 2011, 2014 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
@@ -71,8 +71,7 @@ setlsapwd (const char *passwd, const char *username)
|
||||
if (data_buf)
|
||||
RtlInitUnicodeString (&data, data_buf);
|
||||
/* First try it locally. Works for admin accounts. */
|
||||
if ((lsa = open_local_policy (POLICY_CREATE_SECRET))
|
||||
!= INVALID_HANDLE_VALUE)
|
||||
if (!(lsa = lsa_open_policy (NULL, POLICY_CREATE_SECRET)))
|
||||
{
|
||||
NTSTATUS status = LsaStorePrivateData (lsa, &key,
|
||||
data.Length ? &data : NULL);
|
||||
@@ -83,7 +82,7 @@ setlsapwd (const char *passwd, const char *username)
|
||||
ret = 0;
|
||||
else
|
||||
__seterrno_from_nt_status (status);
|
||||
LsaClose (lsa);
|
||||
lsa_close_policy (lsa);
|
||||
}
|
||||
else if (ret && !username)
|
||||
{
|
||||
|
Reference in New Issue
Block a user