From adc07b999f83cd7b0de785245e80a364d7449e3f Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 2 Dec 2014 10:04:53 +0000 Subject: [PATCH] * sec_auth.cc (str2lsa): Remove. (str2buf2lsa): Remove. (lsaauth): Call RtlInitAnsiString instead of str2lsa and str2buf2lsa. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/sec_auth.cc | 24 ++++-------------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e8210988e..03b5f2183 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2014-12-02 Corinna Vinschen + + * sec_auth.cc (str2lsa): Remove. + (str2buf2lsa): Remove. + (lsaauth): Call RtlInitAnsiString instead of str2lsa and str2buf2lsa. + 2014-12-02 Corinna Vinschen * cygheap.cc (init_cygheap::init_installation_root): Fix typo in diff --git a/winsup/cygwin/sec_auth.cc b/winsup/cygwin/sec_auth.cc index 3615588ef..b616c45e2 100644 --- a/winsup/cygwin/sec_auth.cc +++ b/winsup/cygwin/sec_auth.cc @@ -172,23 +172,6 @@ cygwin_logon_user (const struct passwd *pw, const char *password) return hToken; } -static void -str2lsa (LSA_STRING &tgt, const char *srcstr) -{ - tgt.Length = strlen (srcstr); - tgt.MaximumLength = tgt.Length + 1; - tgt.Buffer = (PCHAR) srcstr; -} - -static void -str2buf2lsa (LSA_STRING &tgt, char *buf, const char *srcstr) -{ - tgt.Length = strlen (srcstr); - tgt.MaximumLength = tgt.Length + 1; - tgt.Buffer = (PCHAR) buf; - memcpy (buf, srcstr, tgt.MaximumLength); -} - HANDLE lsa_open_policy (PWCHAR server, ACCESS_MASK access) { @@ -971,7 +954,7 @@ lsaauth (cygsid &usersid, user_groups &new_groups, struct passwd *pw) push_self_privilege (SE_TCB_PRIVILEGE, true); /* Register as logon process. */ - str2lsa (name, "Cygwin"); + RtlInitAnsiString (&name, "Cygwin"); SetLastError (0); status = LsaRegisterLogonProcess (&name, &lsa_hdl, &sec_mode); if (status != STATUS_SUCCESS) @@ -986,7 +969,7 @@ lsaauth (cygsid &usersid, user_groups &new_groups, struct passwd *pw) goto out; } /* Get handle to our own LSA package. */ - str2lsa (name, CYG_LSA_PKGNAME); + RtlInitAnsiString (&name, CYG_LSA_PKGNAME); status = LsaLookupAuthenticationPackage (lsa_hdl, &name, &package_id); if (status != STATUS_SUCCESS) { @@ -1000,7 +983,8 @@ lsaauth (cygsid &usersid, user_groups &new_groups, struct passwd *pw) goto out; /* Create origin. */ - str2buf2lsa (origin.str, origin.buf, "Cygwin"); + stpcpy (origin.buf, "Cygwin"); + RtlInitAnsiString (&origin.str, origin.buf); /* Create token source. */ memcpy (ts.SourceName, "Cygwin.1", 8); ts.SourceIdentifier.HighPart = 0;