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 <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
This commit is contained in:
Jeffrey Altman 2012-02-14 15:35:07 -05:00 committed by Jeffrey Altman
parent da17eb6c86
commit 9a394780ab
2 changed files with 14 additions and 12 deletions

View File

@ -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

View File

@ -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 */