diff --git a/CHANGELOG.md b/CHANGELOG.md index 32376b37..2dc549d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.2.0 - TBD + +* Fix issue where timeout was not being applied to the new connection +* Fix various deprecated regex escape patterns + + ## 0.1.1 - 2018-09-14 * Fix initial negotiate message not setting connection timeout value diff --git a/setup.py b/setup.py index eec8526c..f277e5c4 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ setup( name='smbprotocol', - version='0.1.1', + version='0.2.0', packages=['smbprotocol'], install_requires=[ 'cryptography>=2.0', diff --git a/smbprotocol/connection.py b/smbprotocol/connection.py index e8fe242c..5e3f62b4 100644 --- a/smbprotocol/connection.py +++ b/smbprotocol/connection.py @@ -832,7 +832,7 @@ def connect(self, dialect=None, timeout=60): negotiation process to complete """ log.info("Setting up transport connection") - self.transport.connect() + self.transport.connect(timeout=timeout) log.info("Starting negotiation with SMB server") smb_response = self._send_smb2_negotiate(dialect, timeout) diff --git a/smbprotocol/open.py b/smbprotocol/open.py index d47709df..e3f1d96e 100644 --- a/smbprotocol/open.py +++ b/smbprotocol/open.py @@ -883,8 +883,7 @@ def __init__(self, tree, name): Directory, or Printer :param tree: The Tree (share) the file is located in. - :param name: The name of the file, excluding the share path, e.g. - \\server\share\folder\file.txt would be folder\file.txt + :param name: The name of the file, excluding the share path. """ # properties available based on the file itself self._connected = False diff --git a/smbprotocol/transport.py b/smbprotocol/transport.py index 679a1de3..ba341f09 100644 --- a/smbprotocol/transport.py +++ b/smbprotocol/transport.py @@ -54,9 +54,10 @@ def __init__(self, server, port): self._connected = False self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - def connect(self): + def connect(self, timeout=None): if not self._connected: log.info("Connecting to DirectTcp socket") + self._sock.settimeout(timeout) self._sock.connect((self.server, self.port)) self._sock.setblocking(0) self._connected = True diff --git a/smbprotocol/tree.py b/smbprotocol/tree.py index 68d4582d..1d69c9eb 100644 --- a/smbprotocol/tree.py +++ b/smbprotocol/tree.py @@ -177,9 +177,8 @@ def __init__(self, session, share_name): 3.2.1.4 Per Tree Connect Attributes per Tree Connect (share connections) - :param session: The Session to connect to the tree with - :param share_name: The name of the share, including the server name, - e.g. \\server\share + :param session: The Session to connect to the tree with. + :param share_name: The name of the share, including the server name. """ self._connected = False self.open_table = {}