Files
markbase/vendor/smb-server/src/lib.rs
Warren 614275f77a
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
Add SMB Client Restrictions (Phase 1-3): access control for SMB clients
Features:
- IpSpec: IP address specification (Single/Cidr/Range/Any)
- TimeSpec: Time-based restrictions (HourRange/DayOfWeek/DayHour)
- ClientRule: Allow/Deny rules with IP/user/time/share
- ClientAcl: Priority-based rule matching
- ClientRestrictionManager: Global/Share/User ACLs

Security:
- Restrict SMB client access by IP address
- Time-based access control (business hours only)
- User-specific and share-specific ACLs
- CIDR notation support (192.168.1.0/24)

Files:
- vendor/smb-server/src/client_restrictions.rs (443 lines)
- vendor/smb-server/src/lib.rs (+1 line)

Tests: 7 passed (smb-server), 317 passed (markbase-core)
2026-06-21 12:51:37 +08:00

57 lines
1.4 KiB
Rust

//! SMB2/3 file-sharing server with pluggable storage backends.
//!
//! See `docs/superpowers/specs/2026-04-27-rust-smb-server-design.md` for the
//! v1 design. The public API is small on purpose:
//!
//! ```no_run
//! use smb_server::{SmbServer, Share, Access, ShareBackend};
//! # async fn run<B: ShareBackend>(backend: B) -> Result<(), Box<dyn std::error::Error>> {
//! SmbServer::builder()
//! .listen("0.0.0.0:4445".parse()?)
//! .user("alice", "password")
//! .share(Share::new("home", backend).user("alice", Access::ReadWrite))
//! .build()?
//! .serve()
//! .await?;
//! # Ok(()) }
//! ```
mod backend;
mod builder;
pub(crate) mod conn;
mod dispatch;
mod durable_handle;
mod error;
#[cfg(feature = "localfs")]
mod fs;
mod handlers;
pub(crate) mod info_class;
pub mod ntstatus;
mod oplock;
mod path;
mod proto;
mod server;
mod snapshot;
mod client_restrictions;
mod utils;
pub use backend::{BackendCapabilities, DirEntry, FileInfo, FileTimes, Handle, NullHandle, OpenIntent, OpenOptions, ShareBackend};
pub use error::SmbError;
pub use path::SmbPath;
pub use builder::{Access, Share};
#[cfg(feature = "localfs")]
pub use fs::LocalFsBackend;
pub use proto::auth::ntlm::Identity;
pub use server::{ConfigHandle, ShareMode, ShutdownHandle, SmbServer};
pub mod wire {
pub use crate::proto::header;
pub use crate::proto::messages;
}
#[cfg(test)]
mod tests {
mod dynamic_config;
mod memfs;
}