GetStatusByCode() static private method

static private GetStatusByCode ( int errcode ) : int
errcode int
return int
Example #1
0
        /// <exception cref="SharpCifs.Smb.SmbException"></exception>
        internal virtual void CheckStatus(ServerMessageBlock req, ServerMessageBlock resp
                                          )
        {
            resp.ErrorCode = SmbException.GetStatusByCode(resp.ErrorCode);
            switch (resp.ErrorCode)
            {
            case NtStatus.NtStatusOk:
            {
                break;
            }

            case NtStatus.NtStatusAccessDenied:
            case NtStatus.NtStatusWrongPassword:
            case NtStatus.NtStatusLogonFailure:
            case NtStatus.NtStatusAccountRestriction:
            case NtStatus.NtStatusInvalidLogonHours:
            case NtStatus.NtStatusInvalidWorkstation:
            case NtStatus.NtStatusPasswordExpired:
            case NtStatus.NtStatusAccountDisabled:
            case NtStatus.NtStatusAccountLockedOut:
            case NtStatus.NtStatusTrustedDomainFailure:
            {
                throw new SmbAuthException(resp.ErrorCode);
            }

            case NtStatus.NtStatusPathNotCovered:
            {
                if (req.Auth == null)
                {
                    throw new SmbException(resp.ErrorCode, null);
                }
                DfsReferral dr = GetDfsReferrals(req.Auth, req.Path, 1);
                if (dr == null)
                {
                    throw new SmbException(resp.ErrorCode, null);
                }
                SmbFile.Dfs.Insert(req.Path, dr);
                throw dr;
            }

            case unchecked ((int)(0x80000005)):
            {
                break;
            }

            case NtStatus.NtStatusMoreProcessingRequired:
            {
                break;
            }

            default:
            {
                throw new SmbException(resp.ErrorCode, null);
            }
            }
            if (resp.VerifyFailed)
            {
                throw new SmbException("Signature verification failed.");
            }
        }