From 9a394780abb782f7a4f8b6095b6faf46b8e819a6 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 14 Feb 2012 15:35:07 -0500 Subject: [PATCH] Windows: add KTC_TOKEN_MUTEX_FAIL error code If acquisition of the Global\AFS_KTC_Mutex fails, return a different error code from a pioctl failure since the pioctl was never issued. Change-Id: I001227f87e97a06bf419c68d6579843e4f93f032 Reviewed-on: http://gerrit.openafs.org/6710 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/auth/ktc_errors.et | 2 ++ src/auth/ktc_nt.c | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/auth/ktc_errors.et b/src/auth/ktc_errors.et index e010d50..9d7b9a8 100644 --- a/src/auth/ktc_errors.et +++ b/src/auth/ktc_errors.et @@ -20,4 +20,6 @@ error_table KTC ec KTC_NOCM, "Cache Manager is not initialized / afsd is not running" ec KTC_RPC, "failed to send or receive session key via remote procedure call" ec KTC_NOCMRPC, "Cache Manager RPC server is not responding" + ec KTC_TOKEN_MUTEX_FAIL, "AFS_KTC_Mutex failure" + end diff --git a/src/auth/ktc_nt.c b/src/auth/ktc_nt.c index bb65eda..0b0500f 100644 --- a/src/auth/ktc_nt.c +++ b/src/auth/ktc_nt.c @@ -374,11 +374,11 @@ ktc_SetToken(struct ktc_principal *server, struct ktc_token *token, #ifndef AFS_WIN95_ENV ktcMutex = CreateMutex(NULL, TRUE, AFSGlobalKTCMutexName); if (ktcMutex == NULL) - return KTC_PIOCTLFAIL; + return KTC_TOKEN_MUTEX_FAIL; if (GetLastError() == ERROR_ALREADY_EXISTS) { if (WaitForSingleObject(ktcMutex, INFINITE) != WAIT_OBJECT_0) { CloseHandle(ktcMutex); - return KTC_PIOCTLFAIL; + return KTC_TOKEN_MUTEX_FAIL; } } @@ -486,11 +486,11 @@ ktc_GetToken(struct ktc_principal *server, struct ktc_token *token, #ifndef AFS_WIN95_ENV ktcMutex = CreateMutex(NULL, TRUE, AFSGlobalKTCMutexName); if (ktcMutex == NULL) - return KTC_PIOCTLFAIL; + return KTC_TOKEN_MUTEX_FAIL; if (GetLastError() == ERROR_ALREADY_EXISTS) { if (WaitForSingleObject(ktcMutex, INFINITE) != WAIT_OBJECT_0) { CloseHandle(ktcMutex); - return KTC_PIOCTLFAIL; + return KTC_TOKEN_MUTEX_FAIL; } } #endif /* AFS_WIN95_ENV */ @@ -651,11 +651,11 @@ ktc_GetTokenEx(char *cellName, struct ktc_setTokenData **tokenSet) { #ifndef AFS_WIN95_ENV ktcMutex = CreateMutex(NULL, TRUE, AFSGlobalKTCMutexName); if (ktcMutex == NULL) - return KTC_PIOCTLFAIL; + return KTC_TOKEN_MUTEX_FAIL; if (GetLastError() == ERROR_ALREADY_EXISTS) { if (WaitForSingleObject(ktcMutex, INFINITE) != WAIT_OBJECT_0) { CloseHandle(ktcMutex); - return KTC_PIOCTLFAIL; + return KTC_TOKEN_MUTEX_FAIL; } } #endif /* AFS_WIN95_ENV */ @@ -745,11 +745,11 @@ ktc_ListTokens(int cellNum, int *cellNumP, struct ktc_principal *server) #ifndef AFS_WIN95_ENV ktcMutex = CreateMutex(NULL, TRUE, AFSGlobalKTCMutexName); if (ktcMutex == NULL) - return KTC_PIOCTLFAIL; + return KTC_TOKEN_MUTEX_FAIL; if (GetLastError() == ERROR_ALREADY_EXISTS) { if (WaitForSingleObject(ktcMutex, INFINITE) != WAIT_OBJECT_0) { CloseHandle(ktcMutex); - return KTC_PIOCTLFAIL; + return KTC_TOKEN_MUTEX_FAIL; } } #endif /* AFS_WIN95_ENV */ @@ -858,11 +858,11 @@ ktc_ForgetToken(struct ktc_principal *server) #ifndef AFS_WIN95_ENV ktcMutex = CreateMutex(NULL, TRUE, AFSGlobalKTCMutexName); if (ktcMutex == NULL) - return KTC_PIOCTLFAIL; + return KTC_TOKEN_MUTEX_FAIL; if (GetLastError() == ERROR_ALREADY_EXISTS) { if (WaitForSingleObject(ktcMutex, INFINITE) != WAIT_OBJECT_0) { CloseHandle(ktcMutex); - return KTC_PIOCTLFAIL; + return KTC_TOKEN_MUTEX_FAIL; } } #endif /* AFS_WIN95_ENV */ @@ -913,11 +913,11 @@ ktc_ForgetAllTokens() #ifndef AFS_WIN95_ENV ktcMutex = CreateMutex(NULL, TRUE, AFSGlobalKTCMutexName); if (ktcMutex == NULL) - return KTC_PIOCTLFAIL; + return KTC_TOKEN_MUTEX_FAIL; if (GetLastError() == ERROR_ALREADY_EXISTS) { if (WaitForSingleObject(ktcMutex, INFINITE) != WAIT_OBJECT_0) { CloseHandle(ktcMutex); - return KTC_PIOCTLFAIL; + return KTC_TOKEN_MUTEX_FAIL; } } #endif /* AFS_WIN95_ENV */ -- 1.9.4