Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1d10531
Rework into safe, flexible bindings for Windows SMB operations (0.2.0)
samvdst Jul 9, 2026
13b27d7
add code-review skill
samvdst Jul 9, 2026
0170f94
fix(strings): reject interior NUL before allocating the wide buffer
samvdst Jul 9, 2026
394b011
refactor(error): user-level display messages, FFI detail into rustdoc
samvdst Jul 9, 2026
173365a
refactor(share): extract ConnectArgs from connect_raw / connect_auto_raw
samvdst Jul 9, 2026
04b2d2d
fix(enumerate): bound both retry loops in Resources::fill
samvdst Jul 9, 2026
2cc5ef0
feat(server): require a filter in delete_session, add delete_all_sess…
samvdst Jul 9, 2026
3eba4b8
fix(server): normalize empty strings to None in all optional fields
samvdst Jul 9, 2026
3c86b2a
test(integration): fail loudly when the open file is not enumerated
samvdst Jul 9, 2026
adbea0e
chore(package): allowlist the crates.io package contents
samvdst Jul 9, 2026
3ab2e90
fix(server): treat empty strings as no filter in delete_session
samvdst Jul 9, 2026
6f63ea0
docs(error): document the synthesized InvalidParameter code
samvdst Jul 9, 2026
0df828e
fix gpt 5.6 findings
samvdst Jul 10, 2026
b7c4491
fix(share): make the Connection guard own a unique local device
samvdst Jul 10, 2026
075bd31
fix(error): keep provider details when converting ExtendedError to io…
samvdst Jul 10, 2026
7c123b5
fix(share): never retry connect_auto on ERROR_MORE_DATA
samvdst Jul 10, 2026
7fe0c43
feat(error): resolve NERR_* messages from netmsg.dll
samvdst Jul 10, 2026
17d6fa7
refactor(enumerate): make NetResource::from_raw an unsafe fn
samvdst Jul 10, 2026
a49f36d
perf(enumerate): reuse the enumeration buffer across fill batches
samvdst Jul 10, 2026
8465b06
ci: pin actions to commit SHAs
samvdst Jul 10, 2026
be83717
add matt pocock agent guides
samvdst Jul 11, 2026
6cb88c4
remove project local skills
samvdst Jul 11, 2026
66c0970
refactor(connect): simplify options and guards
samvdst Jul 11, 2026
131bf4d
refactor: simplify enumeration and internal helpers
samvdst Jul 11, 2026
cd08f39
chore: remove stale metadata and duplicate test docs
samvdst Jul 11, 2026
0afe79f
refactor(share): inline credential pointer helpers
samvdst Jul 11, 2026
ad98323
refactor: remove redundant complexity
samvdst Jul 11, 2026
c25e688
refactor: deduplicate crate documentation
samvdst Jul 11, 2026
41d1e53
refactor: simplify share configuration
samvdst Jul 12, 2026
eb40c17
refactor: rename SMB share to target
samvdst Jul 12, 2026
262e18e
test: remove redundant mounted-drive smoke test
samvdst Jul 12, 2026
11a966f
test: remove redundant guard-drop smoke test
samvdst Jul 12, 2026
0f0cf8f
refactor: collapse Windows error variants
samvdst Jul 12, 2026
5523b2c
refactor: inline option flag conversion
samvdst Jul 12, 2026
ced2a13
test: deduplicate integration environment lookup
samvdst Jul 12, 2026
b2c137a
build: disable unused tracing attributes
samvdst Jul 12, 2026
68aaf99
refactor: inline Windows error construction
samvdst Jul 12, 2026
0026ca4
build: drop duplicate docs.rs target
samvdst Jul 12, 2026
b5daf39
build: rely on automatic docs link
samvdst Jul 12, 2026
fc1f545
refactor: focus crate on SMB client operations
samvdst Jul 12, 2026
a754aa2
Simplify internal plumbing
samvdst Jul 12, 2026
bd27bc6
Remove unused SMB API surface
samvdst Jul 12, 2026
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
2 changes: 0 additions & 2 deletions .cargo/config.toml

This file was deleted.

69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI

on:
push:
branches: [main]
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
test:
name: Integration tests (Windows, real SMB share)
runs-on: windows-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: dtolnay/rust-toolchain@fa04a1451ff1842e2626ccb99004d0195b455a88 # 2026-07
with:
toolchain: stable

- name: Provision a local user and SMB share
shell: pwsh
run: |
$password = ConvertTo-SecureString 'Sambrs-CI-Pass-1!' -AsPlainText -Force
New-LocalUser -Name 'smbtest' -Password $password -PasswordNeverExpires | Out-Null
New-Item -ItemType Directory -Path 'C:\sambrs-share' | Out-Null
New-SmbShare -Name 'sambrs-test' -Path 'C:\sambrs-share' -FullAccess 'smbtest' | Out-Null
icacls 'C:\sambrs-share' /grant 'smbtest:(OI)(CI)F' | Out-Null
"SAMBRS_TEST_USERNAME=$env:COMPUTERNAME\smbtest" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8

- name: Unit + integration tests
run: cargo test -- --include-ignored --test-threads=1
env:
SAMBRS_TEST_SHARE: \\localhost\sambrs-test
SAMBRS_TEST_PASSWORD: Sambrs-CI-Pass-1!

msrv:
name: MSRV check (Rust 1.85, Windows target)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: dtolnay/rust-toolchain@fa04a1451ff1842e2626ccb99004d0195b455a88 # 2026-07
with:
toolchain: '1.85'
targets: x86_64-pc-windows-msvc

- name: crate (incl. tests) compiles on the declared MSRV
run: cargo check --target x86_64-pc-windows-msvc --all-targets

lint:
name: Lint and docs (Windows target)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: dtolnay/rust-toolchain@fa04a1451ff1842e2626ccb99004d0195b455a88 # 2026-07
with:
toolchain: stable
targets: x86_64-pc-windows-msvc

- name: rustfmt
run: cargo fmt --check

- name: clippy (pedantic is enforced in the crate root)
run: cargo clippy --target x86_64-pc-windows-msvc --all-targets -- -D warnings

- name: rustdoc
run: cargo doc --target x86_64-pc-windows-msvc --no-deps
env:
RUSTDOCFLAGS: -D warnings
9 changes: 9 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Agent skills

### Issue tracker

Issues and PRDs are tracked in GitHub Issues. See `docs/agents/issue-tracker.md`.

### Domain docs

This is a single-context repository. See `docs/agents/domain.md`.
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Changelog

## 0.2.0 (unreleased)

A breaking rework into a safe, opinionated Windows client for existing SMB
disk shares.

### Added

- `SmbTarget` connections using the logged-on identity, paired credentials, or
partial username/password credentials.
- Deviceless, explicit-drive, and automatically assigned connections.
- Persistent drive mappings and explicit `force`/`forget` disconnect options.
- `ConnectOptions::require_integrity` for SMB signing and
`require_privacy` for SMB encryption.
- RAII `Connection` guards for temporary drive mappings, with explicit
disconnection.
- Focused queries for mapped-drive targets, connection users, and universal
UNC paths.
- Disk-focused enumeration of active connections, remembered mappings, and a
server's existing shares.
- Provider-specific extended errors from `WNetGetLastErrorW`.
- Unconditional detailed `tracing` events. Usernames and targets are logged;
passwords never are.
- Unconditional zeroization of stored and transient UTF-16 password buffers.

### Changed

- All Windows calls use Unicode (`W`) APIs.
- Windows statuses are preserved as `Error::Windows(code)` while
crate-originated validation and provider-specific errors remain typed.
- Persistence requires a drive mapping; guarded connections cannot persist;
forgetting requires a drive mapping. Invalid combinations fail before a
Windows call.
- Deviceless connections are kept out of Windows' recent-connections list.
- Dependencies and API are Windows-only; cross-platform consumers must gate
the dependency and usage with `cfg(windows)`.
- `windows-sys` 0.52 → 0.60; MSRV is Rust 1.85.

### Removed

- Server administration and share creation.
- Printer resources, arbitrary local devices, and custom provider selection.
- Raw WNet enumeration and metadata.
- Interactive authentication, connection-wide write-through, and other raw
`CONNECT_*` controls outside persistence, signing, and encryption.
- `Error::raw_os_error` and conversion into `std::io::Error`.

## 0.1.2

- Description and examples; edition 2024; initial `WNetAddConnection2A` /
`WNetCancelConnection2A` wrapper with typed errors.
29 changes: 29 additions & 0 deletions CONTEXT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Existing SMB Resource Access

This context describes client-side access to existing SMB shares: authenticating, mapping drives, remembering mappings, and inspecting available or active resources.

## Language

**SMB target**:
A reusable description of an existing remote SMB resource, its credentials, and an optional desired drive letter. It exists independently of whether access is active.
_Avoid_: New share, connection

**Deviceless connection**:
Active authenticated access to an SMB target through its UNC path, without assigning a local drive letter.
_Avoid_: Drive mapping

**Drive mapping**:
An active association between a Windows drive letter and an SMB target. It may be temporary or remembered.
_Avoid_: Share, deviceless connection

**Remembered mapping**:
A drive mapping recorded in the Windows user profile so Windows can restore it at logon.
_Avoid_: Active connection, recent connection

**Connection**:
An owned temporary drive mapping whose lifetime controls when the mapping is disconnected.
_Avoid_: SMB target, remembered mapping

**Server share**:
An existing disk resource exposed by an SMB server for clients to inspect or access.
_Avoid_: Local directory, newly created share
120 changes: 33 additions & 87 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading