Skip to content

Commit

Permalink
Add 0xc000007f to mapping (#245)
Browse files Browse the repository at this point in the history
* Add 0xc000007f to mapping

* Use STATUS_DISK_FULL, not STATUS_LOW_DISK_SPACE

* Use DiskFull, not NotEnoughSpaceOnTheDisk

* Remove comment
  • Loading branch information
rsdoherty authored Nov 1, 2023
1 parent 942b005 commit e99ee98
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 DiskFull(SMBResponseException):
_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

0 comments on commit e99ee98

Please sign in to comment.