Windows: tailor smb_MapNTError output for redirector

Separate mappings apply for the afs redirector.  Add a boolean
parameter to the function signature that is set true when the
call requires the redirector mapping.

Change-Id: Ib2892b6c78047f3f1d289e31c4236ea90d8026ab
Reviewed-on: http://gerrit.openafs.org/5351
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
Jeffrey Altman 2011-09-03 20:09:20 -04:00 committed by Jeffrey Altman
parent 9b0cb61438
commit 3e3400e422
3 changed files with 23 additions and 15 deletions

View File

@ -3078,7 +3078,7 @@ void smb_SendPacket(smb_vc_t *vcp, smb_packet_t *inp)
smb_FreeNCB(ncbp); smb_FreeNCB(ncbp);
} }
void smb_MapNTError(long code, unsigned long *NTStatusp) void smb_MapNTError(long code, unsigned long *NTStatusp, afs_uint32 redir)
{ {
unsigned long NTStatus; unsigned long NTStatus;
@ -3094,6 +3094,9 @@ void smb_MapNTError(long code, unsigned long *NTStatusp)
NTStatus = 0xC0000034L; /* Name not found */ NTStatus = 0xC0000034L; /* Name not found */
} }
else if (code == CM_ERROR_TIMEDOUT) { else if (code == CM_ERROR_TIMEDOUT) {
if (redir)
NTStatus = 0xC0020052L; /* RPC_NT_COMM_FAILURE */
else {
#ifdef COMMENT #ifdef COMMENT
NTStatus = 0xC00000CFL; /* Sharing Paused */ NTStatus = 0xC00000CFL; /* Sharing Paused */
@ -3108,12 +3111,17 @@ void smb_MapNTError(long code, unsigned long *NTStatusp)
NTStatus = 0xC00000B5L; /* I/O Timeout */ NTStatus = 0xC00000B5L; /* I/O Timeout */
#endif #endif
} }
}
else if (code == CM_ERROR_RETRY) { else if (code == CM_ERROR_RETRY) {
if (redir)
NTStatus = 0xC000022DL; /* Retry */
else {
#ifdef COMMENT #ifdef COMMENT
NTStatus = 0xC000022DL; /* Retry */ NTStatus = 0xC000022DL; /* Retry */
#else #else
NTStatus = 0xC00000B5L; /* I/O Timeout */ NTStatus = 0xC00000B5L; /* I/O Timeout */
#endif #endif
}
} }
else if (code == CM_ERROR_NOACCESS) { else if (code == CM_ERROR_NOACCESS) {
NTStatus = 0xC0000022L; /* Access denied */ NTStatus = 0xC0000022L; /* Access denied */
@ -8691,7 +8699,7 @@ void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp,
*/ */
if (code) { if (code) {
if (vcp->flags & SMB_VCFLAG_STATUS32) { if (vcp->flags & SMB_VCFLAG_STATUS32) {
smb_MapNTError(code, &NTStatus); smb_MapNTError(code, &NTStatus, FALSE);
outWctp = outp->wctp; outWctp = outp->wctp;
smbp = (smb_t *) &outp->data; smbp = (smb_t *) &outp->data;
if (code != CM_ERROR_PARTIALWRITE if (code != CM_ERROR_PARTIALWRITE
@ -9892,7 +9900,7 @@ void smb_Listener(void *parmp)
if (vcp->flags & SMB_VCFLAG_STATUS32) { if (vcp->flags & SMB_VCFLAG_STATUS32) {
unsigned long NTStatus; unsigned long NTStatus;
smb_MapNTError(code, &NTStatus); smb_MapNTError(code, &NTStatus, FALSE);
outWctp = outp->wctp; outWctp = outp->wctp;
smbp = (smb_t *) &outp->data; smbp = (smb_t *) &outp->data;
*outWctp++ = 0; *outWctp++ = 0;

View File

@ -733,7 +733,7 @@ extern void smb_SendPacket(smb_vc_t *vcp, smb_packet_t *inp);
extern void smb_MapCoreError(long code, smb_vc_t *vcp, unsigned short *scodep, extern void smb_MapCoreError(long code, smb_vc_t *vcp, unsigned short *scodep,
unsigned char *classp); unsigned char *classp);
extern void smb_MapNTError(long code, unsigned long *NTStatusp); extern void smb_MapNTError(long code, unsigned long *NTStatusp, afs_uint32 redir);
extern void smb_MapWin32Error(long code, unsigned long *Win32Ep); extern void smb_MapWin32Error(long code, unsigned long *Win32Ep);

View File

@ -1499,7 +1499,7 @@ void smb_SendTran2Error(smb_vc_t *vcp, smb_tran2Packet_t *t2p,
unsigned long NTStatus; unsigned long NTStatus;
if (vcp->flags & SMB_VCFLAG_STATUS32) if (vcp->flags & SMB_VCFLAG_STATUS32)
smb_MapNTError(code, &NTStatus); smb_MapNTError(code, &NTStatus, FALSE);
else else
smb_MapCoreError(code, vcp, &errCode, &errClass); smb_MapCoreError(code, vcp, &errCode, &errClass);
@ -1562,7 +1562,7 @@ void smb_SendTran2Packet(smb_vc_t *vcp, smb_tran2Packet_t *t2p, smb_packet_t *tp
if (vcp->flags & SMB_VCFLAG_STATUS32) { if (vcp->flags & SMB_VCFLAG_STATUS32) {
unsigned long NTStatus; unsigned long NTStatus;
smb_MapNTError(t2p->error_code, &NTStatus); smb_MapNTError(t2p->error_code, &NTStatus, FALSE);
smbp->rcls = (unsigned char) (NTStatus & 0xff); smbp->rcls = (unsigned char) (NTStatus & 0xff);
smbp->reh = (unsigned char) ((NTStatus >> 8) & 0xff); smbp->reh = (unsigned char) ((NTStatus >> 8) & 0xff);