Skip to content

tmthecoder/smb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

220 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smb

A Rust implementation of the Server Message Block (SMB) Protocol Versions 2 and 3, built from the ground up following the official Microsoft specification.

Workspace

Crate Description
smb Protocol types, async server, networking, authentication, and cryptography
smb-core Core traits (SMBFromBytes, SMBToBytes, SMBByteSize) and error types
smb-derive Procedural derive macros for wire-format serialization/deserialization

Building

Requires Rust 1.85+ (edition 2024).

# Library check
cargo check --workspace --features server

# Build the server binary
cargo build -p smb_reader --features server,anyhow

# Build with tracing enabled
cargo build -p smb_reader --features server,tracing,anyhow

Running

# Default port (50122)
cargo run -p smb_reader --features server,anyhow

# Custom port
SMB_PORT=4450 cargo run -p smb_reader --features server,anyhow

# With tracing (default level: info, override with RUST_LOG)
RUST_LOG=debug cargo run -p smb_reader --features server,tracing,anyhow

The server listens on 127.0.0.1:<port> and exposes a filesystem share (test) and an IPC share.

Testing

# Unit tests
cargo test --lib --features server

# Integration tests (message serialization round-trips)
cargo test --test message --features server,anyhow

# Integration tests with smbclient (requires smbclient installed)
cargo test --test smbclient --features server,anyhow -- --ignored

CI

GitHub Actions runs on every push:

Workflow What it does
check.yml cargo check + cargo clippy -- -D warnings
unit-tests.yml cargo test --lib --features server
integration-tests.yml Message round-trip tests + smbclient integration tests
docs.yml cargo doc --workspace --features server --no-deps

Feature Flags

Defined in the smb crate:

Feature Effect
server Enables async server (implies async)
async Enables tokio runtime
tracing Opt-in distributed tracing via the tracing crate
logging Enables tracing + log crate compatibility bridge
anyhow Required for the spin_server_up binary

Specification

This implementation follows the MS-SMB2 specification. Related specs:

About

Rust-based SMB message reader & writer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages