Hello community,

here is the log from the commit of package python-smbprotocol for 
openSUSE:Factory checked in at 2019-09-23 12:37:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-smbprotocol (Old)
 and      /work/SRC/openSUSE:Factory/.python-smbprotocol.new.7948 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-smbprotocol"

Mon Sep 23 12:37:54 2019 rev:4 rq:732117 version:0.2.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-smbprotocol/python-smbprotocol.changes    
2019-01-03 18:09:27.579989461 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-smbprotocol.new.7948/python-smbprotocol.changes
  2019-09-23 12:38:42.473597223 +0200
@@ -1,0 +2,9 @@
+Thu Sep 19 18:50:13 UTC 2019 - Martin Hauke <[email protected]>
+
+- Update to version 0.2.0
+  * Fix issue where timeout was not being applied to the new
+    connection
+  * Fix various deprecated regex escape patterns
+  * Simplified the fallback NTLM context object
+
+-------------------------------------------------------------------

Old:
----
  python-smbprotocol-0.1.1.tar.gz

New:
----
  python-smbprotocol-0.2.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-smbprotocol.spec ++++++
--- /var/tmp/diff_new_pack.qxPlZu/_old  2019-09-23 12:38:42.809597168 +0200
+++ /var/tmp/diff_new_pack.qxPlZu/_new  2019-09-23 12:38:42.813597167 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-smbprotocol
-Version:        0.1.1
+Version:        0.2.0
 Release:        0
 Summary:        SMBv2/v3 client for Python 2 and 3
 License:        MIT
@@ -26,7 +26,12 @@
 URL:            https://github.com/jborean93/smbprotocol
 #Source:         
https://files.pythonhosted.org/packages/source/s/smbprotocol/smbprotocol-%%{version}.tar.gz
 Source:         
https://github.com/jborean93/smbprotocol/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
+BuildRequires:  %{python_module cryptography >= 2.0}
+BuildRequires:  %{python_module ntlm-auth}
+BuildRequires:  %{python_module pyasn1}
+BuildRequires:  %{python_module pytest}
 BuildRequires:  %{python_module setuptools}
+BuildRequires:  %{python_module six}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
 Requires:       python-cryptography >= 2.0
@@ -36,11 +41,6 @@
 Suggests:       python-gssapi >= 1.4.1
 Suggests:       python-ordereddict
 BuildArch:      noarch
-BuildRequires:  %{python_module cryptography >= 2.0}
-BuildRequires:  %{python_module ntlm-auth}
-BuildRequires:  %{python_module pyasn1}
-BuildRequires:  %{python_module pytest}
-BuildRequires:  %{python_module six}
 %python_subpackages
 
 %description
@@ -71,7 +71,7 @@
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
 %check
-%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} 
py.test-%{$python_version}
+%pytest
 
 %files %{python_files}
 %license LICENSE

++++++ python-smbprotocol-0.1.1.tar.gz -> python-smbprotocol-0.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smbprotocol-0.1.1/.travis.yml 
new/smbprotocol-0.2.0/.travis.yml
--- old/smbprotocol-0.1.1/.travis.yml   2018-09-14 02:25:45.000000000 +0200
+++ new/smbprotocol-0.2.0/.travis.yml   2019-09-19 04:18:09.000000000 +0200
@@ -2,19 +2,25 @@
 
 language: python
 
-python:
-- 2.6
-- 2.7
-- 3.4
-- 3.5
-- 3.6
+dist: xenial
 
-# Python 3.7 requires 16.04 (Xenial), this is a hack to get that specific
-# distro running that version until I can swap the rest over officially
 matrix:
   include:
+  - python: 2.6
+    dist: trusty
+  - python: 2.7
+  - python: 3.4
+    dist: trusty
+  - python: 3.5
+    dist: trusty
+  - python: 3.6
   - python: 3.7
-    dist: xenial
+  - python: 3.8-dev
+
+  # 3.8 is still a beta and I'm running it to see if anything breaks but
+  # don't want it to stop the build
+  allow_failures:
+  - python: 3.8-dev
 
 services:
 - docker
@@ -30,14 +36,14 @@
 install:
 - docker run -d -p $SMB_PORT:445 -v $(pwd)/build-scripts:/app -w /app -e 
SMB_USER=$SMB_USER -e SMB_PASSWORD=$SMB_PASSWORD -e SMB_SHARE=$SMB_SHARE 
centos:7 /bin/bash /app/setup_samba.sh;
 - pip install --upgrade pip setuptools
-- pip install .
 - pip install -r requirements-test.txt
+- pip install .
 - pip install coveralls
 # make sure the Samba service on the container is up and running
 - python ./build-scripts/check_samba.py
 
 script:
-- py.test -v --instafail --pep8 --cov smbprotocol --cov-report term-missing
+- py.test -v --pep8 --cov smbprotocol --cov-report term-missing
 
 after_success:
 - coveralls
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smbprotocol-0.1.1/CHANGELOG.md 
new/smbprotocol-0.2.0/CHANGELOG.md
--- old/smbprotocol-0.1.1/CHANGELOG.md  2018-09-14 02:25:45.000000000 +0200
+++ new/smbprotocol-0.2.0/CHANGELOG.md  2019-09-19 04:18:09.000000000 +0200
@@ -1,5 +1,13 @@
 # Changelog
 
+## 0.2.0 - 2019-09-19
+
+* Fix issue where timeout was not being applied to the new connection
+* Fix various deprecated regex escape patterns
+* Added support for Windows Kerberos and implicit credential support through 
the optional extra library [pywin32](https://github.com/mhammond/pywin32)
+* Simplified the fallback NTLM context object
+
+
 ## 0.1.1 - 2018-09-14
 
 * Fix initial negotiate message not setting connection timeout value
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smbprotocol-0.1.1/README.md 
new/smbprotocol-0.2.0/README.md
--- old/smbprotocol-0.1.1/README.md     2018-09-14 02:25:45.000000000 +0200
+++ new/smbprotocol-0.2.0/README.md     2019-09-19 04:18:09.000000000 +0200
@@ -31,7 +31,9 @@
 ## Requirements
 
 * Python 2.6, 2.7, 3.4+
-* For Kerberos auth 
[python-gssapi](https://github.com/pythongssapi/python-gssapi)
+* For Kerberos auth
+    * [python-gssapi](https://github.com/pythongssapi/python-gssapi) on Linux
+    * [pywin32](https://github.com/mhammond/pywin32) on Windows
 
 To use Kerberos authentication, further dependencies are required, to install
 these dependencies run
@@ -46,12 +48,13 @@
 pip install smbprotocol[kerberos]
 ```
 
-Currently Kerberos authentication is not supported on Windows. As part of this
-optional extra, the python-gssapi library is installed and smbprotocol requires
-a particular GSSAPI extension to be available to work. This extension should
-be installed on the majority of MIT or Heimdall Kerberos installs but it isn't
-guaranteed. To verify that Kerberos is available you can run the following
-check in a Python console
+Kerberos auth with Windows just requires the `pywin32` package to be installed
+and the Windows host to be joined to that domain. On Linux the python-gssapi
+library must be installed and smbprotocol requires a particular GSSAPI
+extension to be available to work. This extension should be installed on the
+majority of MIT or Heimdal Kerberos installs but it isn't guaranteed. To
+verify that Kerberos is available on Linux you can run the following check in
+a Python console:
 
 ```
 try:
@@ -73,7 +76,7 @@
 ```
 pip install smbprotocol
 
-# on a non Windows host, to install with Kerberos support
+# To install with Kerberos support
 pip install smbprotocol[kerberos]
 ```
 
@@ -204,7 +207,6 @@
 Here is a list of features that I would like to incorporate, PRs are welcome
 if you want to implement them yourself;
 
-* SSPI integration for Windows and Kerberos authentication
 * Test and support DFS mounts and not just server shares
 * Multiple channel support to speed up large data transfers
 * Create an easier API on top of the `raw` SMB calls that currently exist
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smbprotocol-0.1.1/appveyor.yml 
new/smbprotocol-0.2.0/appveyor.yml
--- old/smbprotocol-0.1.1/appveyor.yml  2018-09-14 02:25:45.000000000 +0200
+++ new/smbprotocol-0.2.0/appveyor.yml  2019-09-19 04:18:09.000000000 +0200
@@ -42,10 +42,18 @@
 install:
 - cmd: python -m pip install --upgrade pip
 - cmd: pip install --upgrade setuptools
-- cmd: pip install .
 - cmd: pip install -r requirements-test.txt
+- cmd: pip install .
+
+# test out pywin32 on some matrixes
+- ps: |
+    $ErrorActionPreference = "SilentlyContinue"
+    if ($env:PYTHON -in @("Python27", "Python27-x64", "Python36", 
"Python36-x64")) {
+        pip install .[kerberos]
+    }
+    $ErrorActionPreference = "Stop"
 
 build: off  # Do not run MSBuild, build stuff at install step
 
 test_script:
-- cmd: py.test -v --instafail --pep8 --cov smbprotocol --cov-report 
term-missing
+- cmd: py.test -v --pep8 --cov smbprotocol --cov-report term-missing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smbprotocol-0.1.1/requirements-test.txt 
new/smbprotocol-0.2.0/requirements-test.txt
--- old/smbprotocol-0.1.1/requirements-test.txt 2018-09-14 02:25:45.000000000 
+0200
+++ new/smbprotocol-0.2.0/requirements-test.txt 2019-09-19 04:18:09.000000000 
+0200
@@ -1,4 +1,6 @@
-pytest<=3.2.5
+cryptography<2.2; python_version<"2.7"
+idna<2.8; python_version<"2.7"
+pytest==3.2.5; python_version<"2.7"
+pytest>=3.6; python_version>"2.7"
 pytest-cov
-pytest-pep8
-pytest-instafail
\ No newline at end of file
+pytest-pep8
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smbprotocol-0.1.1/setup.cfg 
new/smbprotocol-0.2.0/setup.cfg
--- old/smbprotocol-0.1.1/setup.cfg     2018-09-14 02:25:45.000000000 +0200
+++ new/smbprotocol-0.2.0/setup.cfg     2019-09-19 04:18:09.000000000 +0200
@@ -2,6 +2,7 @@
 universal = 1
 
 [tool:pytest]
+pep8maxlinelength = 119
 pep8ignore = setup.py E501
 
 [metadata]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smbprotocol-0.1.1/setup.py 
new/smbprotocol-0.2.0/setup.py
--- old/smbprotocol-0.1.1/setup.py      2018-09-14 02:25:45.000000000 +0200
+++ new/smbprotocol-0.2.0/setup.py      2019-09-19 04:18:09.000000000 +0200
@@ -14,11 +14,11 @@
 
 setup(
     name='smbprotocol',
-    version='0.1.1',
+    version='0.2.0',
     packages=['smbprotocol'],
     install_requires=[
         'cryptography>=2.0',
-        'ntlm-auth',
+        'ntlm-auth>=1.2.0',
         'pyasn1',
         'six',
     ],
@@ -26,7 +26,9 @@
         ':python_version<"2.7"': [
             'ordereddict'
         ],
-        'kerberos:sys_platform=="win32"': [],
+        'kerberos:sys_platform=="win32"': [
+            'pywin32'
+        ],
         'kerberos:sys_platform!="win32"': [
             'gssapi>=1.4.1'
         ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smbprotocol-0.1.1/smbprotocol/connection.py 
new/smbprotocol-0.2.0/smbprotocol/connection.py
--- old/smbprotocol-0.1.1/smbprotocol/connection.py     2018-09-14 
02:25:45.000000000 +0200
+++ new/smbprotocol-0.2.0/smbprotocol/connection.py     2019-09-19 
04:18:09.000000000 +0200
@@ -832,7 +832,7 @@
             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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smbprotocol-0.1.1/smbprotocol/open.py 
new/smbprotocol-0.2.0/smbprotocol/open.py
--- old/smbprotocol-0.1.1/smbprotocol/open.py   2018-09-14 02:25:45.000000000 
+0200
+++ new/smbprotocol-0.2.0/smbprotocol/open.py   2019-09-19 04:18:09.000000000 
+0200
@@ -883,8 +883,7 @@
         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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smbprotocol-0.1.1/smbprotocol/session.py 
new/smbprotocol-0.2.0/smbprotocol/session.py
--- old/smbprotocol-0.1.1/smbprotocol/session.py        2018-09-14 
02:25:45.000000000 +0200
+++ new/smbprotocol-0.2.0/smbprotocol/session.py        2019-09-19 
04:18:09.000000000 +0200
@@ -1,11 +1,10 @@
-import base64
 import logging
 
 from cryptography.hazmat.backends import default_backend
 from cryptography.hazmat.primitives import hashes
 from cryptography.hazmat.primitives.kdf.kbkdf import CounterLocation, \
     KBKDFHMAC, Mode
-from ntlm_auth.ntlm import Ntlm
+from ntlm_auth.ntlm import NtlmContext as Ntlm
 from pyasn1.codec.der import decoder
 
 from smbprotocol.connection import Capabilities, Commands, Dialects, \
@@ -17,7 +16,15 @@
     Structure
 from smbprotocol.structure import _bytes_to_hex
 
-HAVE_SSPI = False  # TODO: add support for Windows and SSPI
+HAVE_SSPI = False
+try:  # pragma: no cover
+    import sspi
+    import sspicon
+    import win32security
+    HAVE_SSPI = True
+except ImportError:  # pragma: no cover
+    pass
+
 HAVE_GSSAPI = False
 try:  # pragma: no cover
     import gssapi
@@ -154,17 +161,21 @@
 
         3.2.1.3 Per Session
         The Session object that is used to store the details for an
-        authenticated SMB session. There are 3 forms of authentication that are
+        authenticated SMB session. There are 4 forms of authentication that are
         supported;
 
-        1. NTLM Auth, requires the username and password
-        2. Kerberos Auth, only available in certain circumstances
-        3. Guest Auth, the credentials were rejected but the server allows a
+        1. SSPI Auth, Windows only if pywin32 is installed. Uses either
+            Kerberos or NTLM auth depending on the environment setup and can
+            use the current user's credentials if none are provided here.
+        2. NTLM Auth, requires the username and password
+        3. Kerberos Auth, only available in certain circumstances
+        4. Guest Auth, the credentials were rejected but the server allows a
             fallback to guest authentication (insecure and non-default)
 
         NTLM Auth is the fallback as it should be available in most scenarios
         while Kerberos only works on a system where python-gssapi is installed
-        and the GGF extension for inquire_sec_context_by_oid is available.
+        and the GGF extension for inquire_sec_context_by_oid is available
+        (Linux), or pywin32 is installed (Windows).
 
         If using Kerberos Auth, the username and password can be omitted which
         means the default user kerb ticket (if available) is used. If the
@@ -379,8 +390,9 @@
                                     server=self.connection.server_name)
         elif mech in [MechTypes.KRB5, MechTypes.MS_KRB5, MechTypes.NTLMSSP] \
                 and HAVE_SSPI:
-            raise NotImplementedError("SSPI on Windows for authentication is "
-                                      "not yet implemented")
+            context = SSPIContext(username=self.username,
+                                  password=self.password,
+                                  server=self.connection.server_name)
         elif mech == MechTypes.NTLMSSP:
             context = NtlmContext(username=self.username,
                                   password=self.password)
@@ -388,7 +400,10 @@
             raise NotImplementedError("Mech Type %s is not yet supported"
                                       % mech)
 
-        for out_token in context.step():
+        response = None
+        token_gen = context.step()
+        out_token = next(token_gen)
+        while not context.complete or out_token is not None:
             session_setup = SMB2SessionSetupRequest()
             session_setup['security_mode'] = \
                 self.connection.client_security_mode
@@ -414,7 +429,11 @@
             session_resp = SMB2SessionSetupResponse()
             session_resp.unpack(response['data'].get_value())
 
-            context.in_token = session_resp['buffer'].get_value()
+            in_token = session_resp['buffer'].get_value()
+            if not in_token:
+                break
+
+            out_token = token_gen.send(in_token)
             status = response['status'].get_value()
             if status == NtStatus.STATUS_MORE_PROCESSING_REQUIRED:
                 log.info("More processing is required for SMB2_SESSION_SETUP")
@@ -452,6 +471,14 @@
         return kdf.derive(ki)
 
 
+def _split_username_and_domain(username):
+    try:
+        domain, username = username.split("\\", 1)
+        return domain, username
+    except ValueError:
+        return "", username
+
+
 class NtlmContext(object):
 
     def __init__(self, username, password):
@@ -462,39 +489,33 @@
             raise SMBAuthenticationError("The password must be set when using "
                                          "NTLM authentication")
 
-        # try and get the domain part from the username
         log.info("Setting up NTLM Security Context for user %s" % username)
-        try:
-            self.domain, self.username = username.split("\\", 1)
-        except ValueError:
-            self.username = username
-            self.domain = ''
-        self.password = password
-        self.context = Ntlm()
-        self.in_token = None
+        self.domain, self.username = _split_username_and_domain(username)
+        self.context = Ntlm(self.username, password, domain=self.domain)
+
+    @property
+    def complete(self):
+        return self.context.complete
 
     def step(self):
         log.info("NTLM: Generating Negotiate message")
-        msg1 = self.context.create_negotiate_message(self.domain)
-        msg1 = base64.b64decode(msg1)
+        msg1 = self.context.step()
         log.debug("NTLM: Negotiate message: %s" % _bytes_to_hex(msg1))
-        yield msg1
+        msg2 = yield msg1
 
-        log.info("NTLM: Parsing Challenge message")
-        msg2 = base64.b64encode(self.in_token)
-        log.debug("NTLM: Challenge message: %s" % _bytes_to_hex(self.in_token))
-        self.context.parse_challenge_message(msg2)
-
-        log.info("NTLM: Generating Authenticate message")
-        msg3 = self.context.create_authenticate_message(
-            user_name=self.username,
-            password=self.password,
-            domain_name=self.domain
-        )
-        yield base64.b64decode(msg3)
+        log.info("NTLM: Parsing Challenge message and generating 
Authentication message")
+        log.debug("NTLM: Challenge message: %s" % _bytes_to_hex(msg2))
+        msg3 = self.context.step(input_token=msg2)
+
+        yield msg3
 
     def get_session_key(self):
-        return self.context.authenticate_message.exported_session_key
+        # The session_key was only recently added in ntlm-auth, we have the
+        # fallback to the non-public interface for older versions where we
+        # know this still works. This should be removed once ntlm-auth no
+        # longer requires these older versions (>=1.4.0).
+        return getattr(self.context, 'session_key',
+                       self.context._session_security.exported_session_key)
 
 
 class GSSAPIContext(object):
@@ -510,16 +531,17 @@
         self.context = gssapi.SecurityContext(name=server_name,
                                               creds=self.creds,
                                               usage='initiate')
-        self.in_token = None
+
+    @property
+    def complete(self):
+        return self.context.complete
 
     def step(self):
+        in_token = None
         while not self.context.complete:
             log.info("GSSAPI: gss_init_sec_context called")
-            out_token = self.context.step(self.in_token)
-            if out_token:
-                yield out_token
-            else:
-                log.info("GSSAPI: gss_init_sec_context complete")
+            out_token = self.context.step(in_token)
+            in_token = yield out_token
 
     def get_session_key(self):
         # GSS_C_INQ_SSPI_SESSION_KEY
@@ -530,7 +552,7 @@
         return context_data[0]
 
     def _acquire_creds(self, username, password):
-        # 3 use cases with Kerberos AUth
+        # 3 use cases with Kerberos Auth
         #   1. Both the user and pass is supplied so we want to create a new
         #      ticket with the pass
         #   2. Only the user is supplied so we will attempt to get the cred
@@ -585,3 +607,77 @@
 
         log.info("GSSAPI: Acquired credentials for user %s" % str(user))
         return creds
+
+
+class SSPIContext(object):
+
+    def __init__(self, username, password, server):
+        log.info("Setting up SSPI Security Context for Windows auth")
+        self._call_counter = 0
+
+        flags = sspicon.ISC_REQ_INTEGRITY | \
+            sspicon.ISC_REQ_CONFIDENTIALITY | \
+            sspicon.ISC_REQ_REPLAY_DETECT | \
+            sspicon.ISC_REQ_SEQUENCE_DETECT | \
+            sspicon.ISC_REQ_MUTUAL_AUTH
+
+        domain, username = _split_username_and_domain(username)
+        # We could use the MECH to derive the package name but we are just
+        # better off using Negotiate and lettings Windows do all the heavy
+        # lifting.
+        self._context = sspi.ClientAuth(
+            pkg_name='Negotiate',
+            auth_info=(username, domain, password),
+            targetspn="cifs/%s" % server,
+            scflags=flags
+        )
+
+    @property
+    def complete(self):
+        return self._context.authenticated
+
+    def step(self):
+        in_token = None
+        while not self.complete:
+            log.info("SSPI: InitializeSecurityContext called")
+            out_token = self._step(in_token)
+            in_token = yield out_token if out_token != b"" else None
+
+    def get_session_key(self):
+        return 
self._context.ctxt.QueryContextAttributes(sspicon.SECPKG_ATTR_SESSION_KEY)
+
+    def _step(self, token):
+        success_codes = [
+            sspicon.SEC_E_OK,
+            sspicon.SEC_I_COMPLETE_AND_CONTINUE,
+            sspicon.SEC_I_COMPLETE_NEEDED,
+            sspicon.SEC_I_CONTINUE_NEEDED
+        ]
+
+        if token:
+            sec_token = win32security.PySecBufferType(
+                self._context.pkg_info['MaxToken'],
+                sspicon.SECBUFFER_TOKEN
+            )
+            sec_token.Buffer = token
+
+            sec_buffer = win32security.PySecBufferDescType()
+            sec_buffer.append(sec_token)
+        else:
+            sec_buffer = None
+
+        rc, out_buffer = self._context.authorize(sec_buffer_in=sec_buffer)
+        self._call_counter += 1
+        if rc not in success_codes:
+            rc_name = "Unknown Error"
+            for name, value in vars(sspicon).items():
+                if isinstance(value, int) and name.startswith("SEC_") and \
+                        value == rc:
+                    rc_name = name
+                    break
+            raise SMBAuthenticationError(
+                "InitializeSecurityContext failed on call %d: (%d) %s 0x%s"
+                % (self._call_counter, rc, rc_name, format(rc, 'x'))
+            )
+
+        return out_buffer[0].Buffer
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smbprotocol-0.1.1/smbprotocol/transport.py 
new/smbprotocol-0.2.0/smbprotocol/transport.py
--- old/smbprotocol-0.1.1/smbprotocol/transport.py      2018-09-14 
02:25:45.000000000 +0200
+++ new/smbprotocol-0.2.0/smbprotocol/transport.py      2019-09-19 
04:18:09.000000000 +0200
@@ -54,9 +54,10 @@
         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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smbprotocol-0.1.1/smbprotocol/tree.py 
new/smbprotocol-0.2.0/smbprotocol/tree.py
--- old/smbprotocol-0.1.1/smbprotocol/tree.py   2018-09-14 02:25:45.000000000 
+0200
+++ new/smbprotocol-0.2.0/smbprotocol/tree.py   2019-09-19 04:18:09.000000000 
+0200
@@ -177,9 +177,8 @@
         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 = {}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smbprotocol-0.1.1/tests/test_session.py 
new/smbprotocol-0.2.0/tests/test_session.py
--- old/smbprotocol-0.1.1/tests/test_session.py 2018-09-14 02:25:45.000000000 
+0200
+++ new/smbprotocol-0.2.0/tests/test_session.py 2019-09-19 04:18:09.000000000 
+0200
@@ -122,19 +122,16 @@
         actual = NtlmContext("username", "password")
         assert actual.domain == ""
         assert actual.username == "username"
-        assert actual.password == "password"
 
     def test_username_in_netlogon_form(self):
         actual = NtlmContext("DOMAIN\\username", "password")
         assert actual.domain == "DOMAIN"
         assert actual.username == "username"
-        assert actual.password == "password"
 
     def test_username_in_upn_form(self):
         actual = NtlmContext("[email protected]", "password")
         assert actual.domain == ""
         assert actual.username == "[email protected]"
-        assert actual.password == "password"
 
 
 class TestSession(object):


Reply via email to