tests/smbserver.py: fix compatibility with impacket 0.9.23+

impacket now performs sanity checks if the requested and to
be served file path actually is inside the real share path.

Ref: https://github.com/SecureAuthCorp/impacket/pull/1066

Fixes #7924
Closes #7935
This commit is contained in:
Marc Hoersken 2021-11-01 12:06:07 +01:00
parent 92efb3db7e
commit d52316e460
No known key found for this signature in database
GPG Key ID: 61E03CBED7BC859E

View File

@ -21,8 +21,8 @@
# #
"""Server for testing SMB""" """Server for testing SMB"""
from __future__ import absolute_import, division, print_function from __future__ import (absolute_import, division, print_function,
# NOTE: the impacket configuration is not unicode_literals compatible! unicode_literals)
import argparse import argparse
import logging import logging
@ -201,7 +201,8 @@ class TestSmbServer(imp_smbserver.SMBSERVER):
# Get this file's information # Get this file's information
resp_info, error_code = imp_smbserver.queryPathInformation( resp_info, error_code = imp_smbserver.queryPathInformation(
"", full_path, level=imp_smb.SMB_QUERY_FILE_ALL_INFO) os.path.dirname(full_path), os.path.basename(full_path),
level=imp_smb.SMB_QUERY_FILE_ALL_INFO)
if error_code != STATUS_SUCCESS: if error_code != STATUS_SUCCESS:
raise SmbException(error_code, "Failed to query path info") raise SmbException(error_code, "Failed to query path info")