Skip to content

Commit

Permalink
Add 0xc000007f to mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Doherty authored and Ryan Doherty committed Nov 1, 2023
1 parent 942b005 commit b0d7688
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
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):
_BASE_MESSAGE = "There is not enough space on the disk."
_STATUS_CODE = NtStatus.STATUS_LOW_DISK_SPACE


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_LOW_DISK_SPACE = 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_LOW_DISK_SPACE)
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_LOW_DISK_SPACE: 0xc000007f"
)
assert exc.message == exp_resp
assert str(exc) == exp_resp
assert exc.status == NtStatus.STATUS_LOW_DISK_SPACE

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

0 comments on commit b0d7688

Please sign in to comment.