Skip to main content

Crate pavao

Crate pavao 

Source
Expand description

A safe SMB 1/2/3 client built on Samba’s libsmbclient.

SMB1 (NT1) is never negotiated unless both protocol bounds explicitly request it.

Pavão provides typed APIs for connecting to SMB shares, browsing directories, inspecting metadata, and reading or writing remote files.

§Thread safety

libsmbclient shares process-wide configuration state, so Pavão serializes every native call across all clients. Multiple clients with separate credentials and other per-context options may coexist, but they cannot perform SMB work in parallel. All simultaneously live clients must use the exact same minimum and maximum protocol bounds, including default or partial bounds. A different policy can be selected after every prior client is dropped.

Raw calls through SmbClient::ctx or pavao-sys bypass this synchronization and must not race Pavão operations or other raw native calls.

§Performance

The process-wide lock is held for each complete high-level operation. A blocking SMB request therefore delays every other Pavão SMB operation in the process.

§Installation

pavao = "0.3"

§Examples

use pavao::{SmbClient, SmbCredentials, SmbOptions};

let _client = SmbClient::new(
    SmbCredentials::default()
        .server("smb://server.example")
        .share("/documents")
        .username("alice")
        .password("secret")
        .workgroup("WORKGROUP"),
    SmbOptions::default(),
)?;

See the repository’s examples directory for directory-tree and file-transfer programs.

§Feature flags

namedescriptiondefault
debugForward verbose native Samba diagnostics to standard error.
no-logDisable log records from this crate at compile time.
vendoredBuild the bundled Samba source instead of using the system library.

Structs§

SmbClient
A client for accessing files and directories on an SMB share.
SmbCredentials
Authentication and share-selection settings for SmbClient.
SmbDirent
A directory entry returned by SmbClient::list_dir.
SmbDirentInfo
A directory entry with metadata returned by an extended listing.
SmbFile
An open remote file owned by an SmbClient.
SmbMode
A remote entry’s POSIX file type and permission bits.
SmbModeClass
POSIX read, write, and execute permissions for one user class.
SmbOpenOptions
Options controlling how a remote file is opened.
SmbOptions
Optional behavior applied when initializing a client’s SMB context.
SmbStat
POSIX-style metadata for a remote file or directory.
SmbStatVfs
Filesystem statistics returned by SmbClient::statvfs.

Enums§

SmbDialect
An SMB protocol dialect offered during negotiation.
SmbDirentType
The resource category reported for an SMB directory entry.
SmbEncryptionLevel
Encryption policy for SMB transport traffic.
SmbError
An error produced while configuring or using an SMB client.
SmbShareMode
Sharing restrictions applied when opening a remote file.

Type Aliases§

SmbResult
A result returned by Pavão operations.