Skip to content

Commit e99ee98

Browse files
authored
Add 0xc000007f to mapping (#245)
* Add 0xc000007f to mapping * Use STATUS_DISK_FULL, not STATUS_LOW_DISK_SPACE * Use DiskFull, not NotEnoughSpaceOnTheDisk * Remove comment
1 parent 942b005 commit e99ee98

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/smbprotocol/exceptions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,11 @@ class ServerUnavailable(SMBResponseException):
612612
_STATUS_CODE = NtStatus.STATUS_SERVER_UNAVAILABLE
613613

614614

615+
class DiskFull(SMBResponseException):
616+
_BASE_MESSAGE = "There is not enough space on the disk."
617+
_STATUS_CODE = NtStatus.STATUS_DISK_FULL
618+
619+
615620
class ErrorContextId:
616621
"""
617622
[MS-SMB2] v53.0 2017-09-15

src/smbprotocol/header.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ class NtStatus:
108108
STATUS_DFS_UNAVAILABLE = 0xC000026D
109109
STATUS_NOT_A_REPARSE_POINT = 0xC0000275
110110
STATUS_SERVER_UNAVAILABLE = 0xC0000466
111+
STATUS_DISK_FULL = 0xC000007F
111112

112113

113114
class Smb2Flags:

tests/test_exceptions.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,21 @@ def test_throw_default_exception(self):
126126
assert str(exc) == exp_resp
127127
assert exc.status == NtStatus.STATUS_INVALID_PARAMETER
128128

129+
def test_throw_low_disk(self):
130+
error_resp = SMB2ErrorResponse()
131+
header = self._get_header(error_resp, NtStatus.STATUS_DISK_FULL)
132+
try:
133+
raise SMBResponseException(header)
134+
except SMBResponseException as exc:
135+
assert exc.error_details == []
136+
exp_resp = (
137+
"Received unexpected status from the server: There is not enough space on the disk. "
138+
"(3221225599) STATUS_DISK_FULL: 0xc000007f"
139+
)
140+
assert exc.message == exp_resp
141+
assert str(exc) == exp_resp
142+
assert exc.status == NtStatus.STATUS_DISK_FULL
143+
129144
def test_throw_exception_without_header(self):
130145
actual = NetworkNameDelegated()
131146
assert isinstance(actual, NetworkNameDelegated)

0 commit comments

Comments
 (0)