Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 8 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Build smbprotocol
run: |
Expand All @@ -52,60 +52,23 @@ jobs:
os:
- ubuntu-latest
- macOS-latest
- windows-2019
- windows-2022
- windows-latest
python-version:
- 3.8
- 3.9
- '3.10'
- '3.11'
- '3.12'
- '3.13'
python-arch:
- x86
- x64
- arm64

exclude:
# Exclude OS and arch combinations that are not supported
- os: ubuntu-latest
python-arch: x86
- os: ubuntu-latest
python-arch: arm64
- os: windows-2019
python-arch: x86
- os: windows-2019
python-arch: arm64
- os: windows-2022
python-arch: arm64
- os: macOS-latest
python-arch: x86
- os: macOS-latest
python-arch: x64

# macOS arm64 is supported from 3.9
- os: macOS-latest
python-version: 3.8
- os: windows-2019
python-version: 3.8
- os: windows-2019
python-version: 3.9
- os: windows-2019
python-version: '3.10'
- os: windows-2019
python-version: '3.11'
- os: windows-2019
python-version: '3.12'
- '3.14'

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.python-arch }}

- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v5
with:
name: artifact
path: ./dist
Expand Down Expand Up @@ -145,7 +108,7 @@ jobs:

- name: Upload Coverage to codecov
if: always()
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
flags: ${{ steps.os.outputs.name }},py${{ matrix.python-version }},${{ matrix.python-arch }}
Expand All @@ -161,7 +124,7 @@ jobs:
id-token: write

steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v5
with:
name: artifact
path: ./dist
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
repos:
- repo: https://github.com/psf/black
rev: 24.8.0
rev: 25.9.0
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
rev: 6.1.0
hooks:
- id: isort
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.16.0 - TBD

* Drop support for Python 3.8, minimum version is now 3.9

## 1.15.0 - 2024-11-12

* Update session id lookup logic to comply with MS-SMB2 spec
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ backlog for features that would be nice to have in this library.

## Requirements

* Python 3.7+
* Python 3.9+
* For Kerberos auth on Linux
* [python-gssapi](https://github.com/pythongssapi/python-gssapi)
* [pykrb5](https://github.com/jborean93/pykrb5)
Expand Down
8 changes: 1 addition & 7 deletions build_helpers/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,8 @@ lib::setup::python_requirements() {
python -m pip install build
PACKAGE_VERSION="$( python -c "import build.util; print(build.util.project_wheel_metadata('.').get('Version'))" )"

if [ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]; then
DIST_LINK_PATH="$( echo "${PWD}/dist" | sed -e 's/^\///' -e 's/\//\\/g' -e 's/^./\0:/' )"
else
DIST_LINK_PATH="${PWD}/dist"
fi

python -m pip install smbprotocol=="${PACKAGE_VERSION}" \
--find-links "file://${DIST_LINK_PATH}" \
--find-links ./dist \
--verbose

echo "Installing dev dependencies"
Expand Down
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = [
"setuptools >= 61.0.0", # Support for setuptools config in pyproject.toml
"setuptools >= 77.0.0", # Support for SPDX license expressions
]
build-backend = "setuptools.build_meta"

Expand All @@ -9,22 +9,21 @@ name = "smbprotocol"
version = "1.16.0"
description = "Interact with a server using the SMB 2/3 Protocol"
readme = "README.md"
requires-python = ">=3.8"
license = {file = "LICENSE"}
requires-python = ">=3.9"
license = "MIT"
authors = [
{ name = "Jordan Borean", email = "jborean93@gmail.com" }
]
keywords = ["smb", "smb2", "smb3", "cifs", "python"]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13"
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dependencies = [
"cryptography >= 2.0",
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
black == 24.8.0
black == 25.9.0
build
cryptography >= 2.0
isort == 5.13.2
isort == 6.1.0
pre-commit
pyspnego
pytest
Expand Down
2 changes: 1 addition & 1 deletion src/smbclient/_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def dfs_request(tree: TreeConnect, path: str) -> DFSReferralResponse:

ioctl_req = SMB2IOCTLRequest()
ioctl_req["ctl_code"] = CtlCode.FSCTL_DFS_GET_REFERRALS
ioctl_req["file_id"] = b"\xFF" * 16
ioctl_req["file_id"] = b"\xff" * 16
ioctl_req["max_output_response"] = 56 * 1024
ioctl_req["flags"] = IOCTLFlags.SMB2_0_IOCTL_IS_FSCTL
ioctl_req["buffer"] = dfs_referral
Expand Down
8 changes: 6 additions & 2 deletions src/smbclient/shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import sys

from smbclient._io import SMBFileTransaction, SMBRawIO, query_info, set_info
from smbclient._os import SMBDirEntry
from smbclient._os import (
SMBDirEntry,
)
from smbclient._os import copyfile as smbclient_copyfile
from smbclient._os import (
is_remote_path,
Expand All @@ -22,7 +24,9 @@
scandir,
)
from smbclient._os import stat as smbclient_stat
from smbclient._os import symlink
from smbclient._os import (
symlink,
)
from smbclient.path import isdir, islink, samefile
from smbprotocol import MAX_PAYLOAD_SIZE
from smbprotocol.file_info import FileAttributes, FileBasicInformation
Expand Down
6 changes: 3 additions & 3 deletions src/smbprotocol/create_contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class CreateContextName:
SMB2_CREATE_REQUEST_LEASE_V2 = b"\x52\x71\x4c\x73"
SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 = b"\x44\x48\x32\x51"
SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 = b"\x44\x48\x32\x43"
SMB2_CREATE_APP_INSTANCE_ID = b"\x45\xBC\xA6\x6A\xEF\xA7\xF7\x4A" b"\x90\x08\xFA\x46\x2E\x14\x4D\x74"
SMB2_CREATE_APP_INSTANCE_VERSION = b"\xB9\x82\xD0\xB7\x3B\x56\x07\x4F" b"\xA0\x7B\x52\x4A\x81\x16\xA0\x10"
SVHDX_OPEN_DEVICE_CONTEXT = b"\x9C\xCB\xCF\x9E\x04\xC1\xE6\x43" b"\x98\x0E\x15\x8D\xA1\xF6\xEC\x83"
SMB2_CREATE_APP_INSTANCE_ID = b"\x45\xbc\xa6\x6a\xef\xa7\xf7\x4a" b"\x90\x08\xfa\x46\x2e\x14\x4d\x74"
SMB2_CREATE_APP_INSTANCE_VERSION = b"\xb9\x82\xd0\xb7\x3b\x56\x07\x4f" b"\xa0\x7b\x52\x4a\x81\x16\xa0\x10"
SVHDX_OPEN_DEVICE_CONTEXT = b"\x9c\xcb\xcf\x9e\x04\xc1\xe6\x43" b"\x98\x0e\x15\x8d\xa1\xf6\xec\x83"

@staticmethod
def get_response_structure(name, size=None):
Expand Down
96 changes: 48 additions & 48 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
b"\x22\x00"
b"\x00\x00"
b"\x00\x00"
b"\x5C\x00\x44\x00\x4F\x00\x4D\x00"
b"\x41\x00\x49\x00\x4E\x00\x00\x00"
b"\x5C\x00\x64\x00\x6F\x00\x6D\x00"
b"\x61\x00\x69\x00\x6E\x00\x2E\x00"
b"\x5c\x00\x44\x00\x4f\x00\x4d\x00"
b"\x41\x00\x49\x00\x4e\x00\x00\x00"
b"\x5c\x00\x64\x00\x6f\x00\x6d\x00"
b"\x61\x00\x69\x00\x6e\x00\x2e\x00"
b"\x74\x00\x65\x00\x73\x00\x74\x00"
b"\x00\x00"
)
Expand All @@ -52,20 +52,20 @@
b"\x58\x02\x00\x00"
b"\x12\x00"
b"\x02\x00"
b"\x2C\x00"
b"\x5C\x00\x64\x00\x6F\x00\x6D\x00"
b"\x61\x00\x69\x00\x6E\x00\x2E\x00"
b"\x2c\x00"
b"\x5c\x00\x64\x00\x6f\x00\x6d\x00"
b"\x61\x00\x69\x00\x6e\x00\x2e\x00"
b"\x74\x00\x65\x00\x73\x00\x74\x00"
b"\x00\x00"
b"\x5C\x00\x44\x00\x43\x00\x30\x00"
b"\x31\x00\x2E\x00\x64\x00\x6F\x00"
b"\x6D\x00\x61\x00\x69\x00\x6E\x00"
b"\x2E\x00\x74\x00\x65\x00\x73\x00"
b"\x5c\x00\x44\x00\x43\x00\x30\x00"
b"\x31\x00\x2e\x00\x64\x00\x6f\x00"
b"\x6d\x00\x61\x00\x69\x00\x6e\x00"
b"\x2e\x00\x74\x00\x65\x00\x73\x00"
b"\x74\x00\x00\x00"
b"\x5C\x00\x44\x00\x43\x00\x30\x00"
b"\x31\x00\x2E\x00\x64\x00\x6F\x00"
b"\x6D\x00\x61\x00\x69\x00\x6E\x00"
b"\x2E\x00\x74\x00\x65\x00\x73\x00"
b"\x5c\x00\x44\x00\x43\x00\x30\x00"
b"\x31\x00\x2e\x00\x64\x00\x6f\x00"
b"\x6d\x00\x61\x00\x69\x00\x6e\x00"
b"\x2e\x00\x74\x00\x65\x00\x73\x00"
b"\x74\x00\x32\x00\x00\x00"
)

Expand All @@ -79,27 +79,27 @@
b"\x22\x00"
b"\x01\x00"
b"\x04\x00"
b"\x2C\x01\x00\x00"
b"\x2c\x01\x00\x00"
b"\x22\x00"
b"\x44\x00"
b"\x66\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x5C\x00\x64\x00\x6F\x00\x6D\x00"
b"\x61\x00\x69\x00\x6E\x00\x2E\x00"
b"\x5c\x00\x64\x00\x6f\x00\x6d\x00"
b"\x61\x00\x69\x00\x6e\x00\x2e\x00"
b"\x74\x00\x65\x00\x73\x00\x74\x00"
b"\x5C\x00\x64\x00\x66\x00\x73\x00"
b"\x00\x00\x5C\x00\x64\x00\x6F\x00"
b"\x6D\x00\x61\x00\x69\x00\x6E\x00"
b"\x2E\x00\x74\x00\x65\x00\x73\x00"
b"\x74\x00\x5C\x00\x64\x00\x66\x00"
b"\x73\x00\x00\x00\x5C\x00\x53\x00"
b"\x5c\x00\x64\x00\x66\x00\x73\x00"
b"\x00\x00\x5c\x00\x64\x00\x6f\x00"
b"\x6d\x00\x61\x00\x69\x00\x6e\x00"
b"\x2e\x00\x74\x00\x65\x00\x73\x00"
b"\x74\x00\x5c\x00\x64\x00\x66\x00"
b"\x73\x00\x00\x00\x5c\x00\x53\x00"
b"\x45\x00\x52\x00\x56\x00\x45\x00"
b"\x52\x00\x32\x00\x30\x00\x31\x00"
b"\x32\x00\x52\x00\x32\x00\x2E\x00"
b"\x44\x00\x4F\x00\x4D\x00\x41\x00"
b"\x49\x00\x4E\x00\x2E\x00\x54\x00"
b"\x45\x00\x53\x00\x54\x00\x5C\x00"
b"\x32\x00\x52\x00\x32\x00\x2e\x00"
b"\x44\x00\x4f\x00\x4d\x00\x41\x00"
b"\x49\x00\x4e\x00\x2e\x00\x54\x00"
b"\x45\x00\x53\x00\x54\x00\x5c\x00"
b"\x64\x00\x66\x00\x73\x00\x00\x00"
)

Expand All @@ -115,7 +115,7 @@
b"\x04\x00"
b"\x08\x07\x00\x00"
b"\x44\x00"
b"\x6C\x00"
b"\x6c\x00"
b"\x94\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
Expand All @@ -125,32 +125,32 @@
b"\x00\x00"
b"\x08\x07\x00\x00"
b"\x22\x00"
b"\x4A\x00"
b"\x9C\x00"
b"\x4a\x00"
b"\x9c\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x5C\x00\x64\x00\x6F\x00\x6D\x00"
b"\x61\x00\x69\x00\x6E\x00\x2E\x00"
b"\x5c\x00\x64\x00\x6f\x00\x6d\x00"
b"\x61\x00\x69\x00\x6e\x00\x2e\x00"
b"\x74\x00\x65\x00\x73\x00\x74\x00"
b"\x5C\x00\x64\x00\x66\x00\x73\x00"
b"\x5C\x00\x64\x00\x63\x00\x00\x00"
b"\x5C\x00\x64\x00\x6F\x00\x6D\x00"
b"\x61\x00\x69\x00\x6E\x00\x2E\x00"
b"\x5c\x00\x64\x00\x66\x00\x73\x00"
b"\x5c\x00\x64\x00\x63\x00\x00\x00"
b"\x5c\x00\x64\x00\x6f\x00\x6d\x00"
b"\x61\x00\x69\x00\x6e\x00\x2e\x00"
b"\x74\x00\x65\x00\x73\x00\x74\x00"
b"\x5C\x00\x64\x00\x66\x00\x73\x00"
b"\x5C\x00\x64\x00\x63\x00\x00\x00"
b"\x5C\x00\x64\x00\x63\x00\x30\x00"
b"\x31\x00\x2E\x00\x64\x00\x6F\x00"
b"\x6D\x00\x61\x00\x69\x00\x6E\x00"
b"\x2E\x00\x74\x00\x65\x00\x73\x00"
b"\x74\x00\x5C\x00\x63\x00\x24\x00"
b"\x00\x00\x5C\x00\x73\x00\x65\x00"
b"\x5c\x00\x64\x00\x66\x00\x73\x00"
b"\x5c\x00\x64\x00\x63\x00\x00\x00"
b"\x5c\x00\x64\x00\x63\x00\x30\x00"
b"\x31\x00\x2e\x00\x64\x00\x6f\x00"
b"\x6d\x00\x61\x00\x69\x00\x6e\x00"
b"\x2e\x00\x74\x00\x65\x00\x73\x00"
b"\x74\x00\x5c\x00\x63\x00\x24\x00"
b"\x00\x00\x5c\x00\x73\x00\x65\x00"
b"\x72\x00\x76\x00\x65\x00\x72\x00"
b"\x32\x00\x30\x00\x31\x00\x39\x00"
b"\x2E\x00\x64\x00\x6F\x00\x6D\x00"
b"\x61\x00\x69\x00\x6E\x00\x2E\x00"
b"\x2e\x00\x64\x00\x6f\x00\x6d\x00"
b"\x61\x00\x69\x00\x6e\x00\x2e\x00"
b"\x74\x00\x65\x00\x73\x00\x74\x00"
b"\x5C\x00\x63\x00\x24\x00\x00\x00"
b"\x5c\x00\x63\x00\x24\x00\x00\x00"
)


Expand Down
Loading