Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 0xc000007f to mapping #245

Merged
merged 4 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/smbprotocol/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,11 @@ class ServerUnavailable(SMBResponseException):
_STATUS_CODE = NtStatus.STATUS_SERVER_UNAVAILABLE


class NotEnoughSpaceOnTheDisk(SMBResponseException):
rsdoherty marked this conversation as resolved.
Show resolved Hide resolved
_BASE_MESSAGE = "There is not enough space on the disk."
_STATUS_CODE = NtStatus.STATUS_DISK_FULL


class ErrorContextId:
"""
[MS-SMB2] v53.0 2017-09-15
Expand Down
1 change: 1 addition & 0 deletions src/smbprotocol/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class NtStatus:
STATUS_DFS_UNAVAILABLE = 0xC000026D
STATUS_NOT_A_REPARSE_POINT = 0xC0000275
STATUS_SERVER_UNAVAILABLE = 0xC0000466
STATUS_DISK_FULL = 0xC000007F


class Smb2Flags:
Expand Down
15 changes: 15 additions & 0 deletions tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ def test_throw_default_exception(self):
assert str(exc) == exp_resp
assert exc.status == NtStatus.STATUS_INVALID_PARAMETER

def test_throw_low_disk(self):
error_resp = SMB2ErrorResponse()
header = self._get_header(error_resp, NtStatus.STATUS_DISK_FULL)
try:
raise SMBResponseException(header)
except SMBResponseException as exc:
assert exc.error_details == []
exp_resp = (
"Received unexpected status from the server: There is not enough space on the disk. "
"(3221225599) STATUS_DISK_FULL: 0xc000007f"
)
assert exc.message == exp_resp
assert str(exc) == exp_resp
assert exc.status == NtStatus.STATUS_DISK_FULL

def test_throw_exception_without_header(self):
actual = NetworkNameDelegated()
assert isinstance(actual, NetworkNameDelegated)
Expand Down