From: Jeffrey Altman Date: Thu, 15 Oct 2009 02:06:38 +0000 (-0400) Subject: Windows: Adjust error return values X-Git-Tag: openafs-devel-1_5_66~29 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=7673b2450c9e7449d8165a0be5bbd8e0c063dfd2;p=packages%2Fo%2Fopenafs.git Windows: Adjust error return values Do not return STATUS_TIMEOUT to the smb redirector, doing so results in an undesireable disconnect. Map RXKADNOAUTH to STATUS_CLOCK_SKEW as that is the most frequent cause of rx level authorization failures. Map CM_ERROR_UNKNOWN to access denied since there is no better error choice. LICENSE MIT Reviewed-on: http://gerrit.openafs.org/661 Reviewed-by: Asanka Herath Tested-by: Asanka Herath Tested-by: Jeffrey Altman Reviewed-by: Jeffrey Altman --- diff --git a/src/WINNT/afsd/cm_utils.c b/src/WINNT/afsd/cm_utils.c index 7875ad8bd..11defd01c 100644 --- a/src/WINNT/afsd/cm_utils.c +++ b/src/WINNT/afsd/cm_utils.c @@ -208,8 +208,12 @@ long cm_MapRPCError(long error, cm_req_t *reqp) error = et_to_sys_error(error); - if (error < 0) - error = CM_ERROR_TIMEDOUT; + if (error == RX_CALL_DEAD || + error == RX_CALL_TIMEOUT || + error == RX_RESTARTING) + error = CM_ERROR_RETRY; + else if (error < 0) + error = CM_ERROR_UNKNOWN; else if (error == EROFS) error = CM_ERROR_READONLY; else if (error == EACCES) @@ -264,8 +268,12 @@ long cm_MapRPCErrorRmdir(long error, cm_req_t *reqp) error = et_to_sys_error(error); - if (error < 0) - error = CM_ERROR_TIMEDOUT; + if (error == RX_CALL_DEAD || + error == RX_CALL_TIMEOUT || + error == RX_RESTARTING) + error = CM_ERROR_RETRY; + else if (error < 0) + error = CM_ERROR_UNKNOWN; else if (error == EROFS) error = CM_ERROR_READONLY; else if (error == ENOTDIR) @@ -300,8 +308,12 @@ long cm_MapVLRPCError(long error, cm_req_t *reqp) error = et_to_sys_error(error); - if (error < 0) - error = CM_ERROR_TIMEDOUT; + if (error == RX_CALL_DEAD || + error == RX_CALL_TIMEOUT || + error == RX_RESTARTING) + error = CM_ERROR_RETRY; + else if (error < 0) + error = CM_ERROR_UNKNOWN; else if (error == VL_NOENT || error == VL_BADNAME) error = CM_ERROR_NOSUCHVOLUME; return error; diff --git a/src/WINNT/afsd/smb.c b/src/WINNT/afsd/smb.c index 0d3733290..d89401bb4 100644 --- a/src/WINNT/afsd/smb.c +++ b/src/WINNT/afsd/smb.c @@ -3007,8 +3007,12 @@ void smb_MapNTError(long code, unsigned long *NTStatusp) else if (code == CM_ERROR_TIMEDOUT) { #ifdef COMMENT NTStatus = 0xC00000CFL; /* Sharing Paused */ -#else + + /* Do not send Timeout to the SMB redirector. + * It causes the redirector to drop the connection */ NTStatus = 0x00000102L; /* Timeout */ +#else + NTStatus = 0xC000022DL; /* Retry */ #endif } else if (code == CM_ERROR_RETRY) { @@ -3039,6 +3043,9 @@ void smb_MapNTError(long code, unsigned long *NTStatusp) else if (code == CM_ERROR_BADFDOP) { NTStatus = 0xC0000022L; /* Access denied */ } + else if (code == CM_ERROR_UNKNOWN) { + NTStatus = 0xC0000022L; /* Access denied */ + } else if (code == CM_ERROR_EXISTS) { NTStatus = 0xC0000035L; /* Object name collision */ } @@ -3072,7 +3079,8 @@ void smb_MapNTError(long code, unsigned long *NTStatusp) NTStatus = 0xC000013DL; /* Remote Resources */ #endif } - else if (code == CM_ERROR_CLOCKSKEW) { + else if (code == CM_ERROR_CLOCKSKEW || + code == RXKADNOAUTH) { NTStatus = 0xC0000133L; /* Time difference at DC */ } else if (code == CM_ERROR_BADTID) { @@ -3218,6 +3226,9 @@ void smb_MapWin32Error(long code, unsigned long *Win32Ep) else if (code == CM_ERROR_BADFDOP) { Win32E = ERROR_ACCESS_DENIED; /* Access denied */ } + else if (code == CM_ERROR_UNKNOWN) { + Win32E = ERROR_ACCESS_DENIED; /* Access denied */ + } else if (code == CM_ERROR_EXISTS) { Win32E = ERROR_ALREADY_EXISTS; /* Object name collision */ } @@ -3246,7 +3257,8 @@ void smb_MapWin32Error(long code, unsigned long *Win32Ep) Win32E = ERROR_REM_NOT_LIST; /* Remote Resources */ #endif } - else if (code == CM_ERROR_CLOCKSKEW) { + else if (code == CM_ERROR_CLOCKSKEW || + code == RXKADNOAUTH) { Win32E = ERROR_TIME_SKEW; /* Time difference at DC */ } else if (code == CM_ERROR_BADTID) {