From 0036737675d236294954c6e279983c280fb4a4a3 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 11 Mar 2015 17:57:01 +0100 Subject: [PATCH] Using new handle cleanup structure --- winpr/libwinpr/sspicli/sspicli.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/winpr/libwinpr/sspicli/sspicli.c b/winpr/libwinpr/sspicli/sspicli.c index c7273b2..ae26f34 100644 --- a/winpr/libwinpr/sspicli/sspicli.c +++ b/winpr/libwinpr/sspicli/sspicli.c @@ -69,10 +69,6 @@ #include "../security/security.h" -static pthread_once_t logon_user_initialized = PTHREAD_ONCE_INIT; - -static HANDLE_CLOSE_CB _LogonUserHandleCloseCb; - static BOOL LogonUserCloseHandle(HANDLE handle); static BOOL LogonUserIsHandled(HANDLE handle) @@ -88,11 +84,17 @@ static BOOL LogonUserIsHandled(HANDLE handle) return TRUE; } -static void LogonUserInitialize(void) +static int LogonUserGetFd(HANDLE handle) { - _LogonUserHandleCloseCb.IsHandled = LogonUserIsHandled; - _LogonUserHandleCloseCb.CloseHandle = LogonUserCloseHandle; - RegisterHandleCloseCb(&_LogonUserHandleCloseCb); + WINPR_ACCESS_TOKEN *pLogonUser = (WINPR_ACCESS_TOKEN *)handle; + + if (!LogonUserIsHandled(handle)) + return -1; + + /* TODO: File fd not supported */ + (void)pLogonUser; + + return -1; } BOOL LogonUserCloseHandle(HANDLE handle) { @@ -118,9 +120,6 @@ BOOL LogonUserA(LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, struct passwd* pw; WINPR_ACCESS_TOKEN* token; - if (pthread_once(&logon_user_initialized, LogonUserInitialize)) - return FALSE; - if (!lpszUsername) return FALSE; @@ -133,6 +132,10 @@ BOOL LogonUserA(LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, WINPR_HANDLE_SET_TYPE(token, HANDLE_TYPE_ACCESS_TOKEN); + token->cb.GetFd = LogonUserGetFd; + token->cb.CloseHandle = LogonUserCloseHandle; + token->cb.IsHandled = LogonUserIsHandled; + token->Username = _strdup(lpszUsername); if (lpszDomain) -- 2.7.4