Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
39944dc
feat: implement Close, Read, and QueryInfo handlers for E2E file read
tejas-claude-bot[bot] Feb 8, 2026
f2fe296
fix: resolve file read integration test failures
tejas-claude-bot[bot] Feb 10, 2026
09ea922
refactor: replace raw Vec<u8> info buffers with typed MS-FSCC structs
tejas-claude-bot[bot] Feb 10, 2026
56eb98e
refactor: split file_info structs into separate files per project con…
tejas-claude-bot[bot] Feb 12, 2026
27765c8
fix: correct FileId construction, close cleanup, and DurableFileId ve…
tejas-claude-bot[bot] Mar 29, 2026
f04b7b4
refactor: replace manual FileAllInformation::to_bytes() with SMBToByt…
tejas-claude-bot[bot] Mar 29, 2026
a806452
refactor: replace raw u32 fields with typed bitflags/enums in file_info
tejas-claude-bot[bot] Mar 31, 2026
73e40d1
fix: address security bugs and encapsulate struct fields
tejas-claude-bot[bot] Apr 4, 2026
2fa3140
fix: resolve clippy warnings from rebase
tejas-claude-bot[bot] Apr 5, 2026
7ccb0b1
fix: create response after open registration, handle short reads, and…
tejas-claude-bot[bot] Apr 7, 2026
d19dd86
fix(clippy): gate SMBByteSize import and suppress unused variable war…
tejas-claude-bot[bot] Apr 7, 2026
96adf53
feat: implement Write handler for E2E file write
tejas-claude-bot[bot] Apr 5, 2026
d85e689
test: add E2E smbclient tests for Write handler
tejas-claude-bot[bot] Apr 5, 2026
f72b568
test: remove #[ignore] from smbclient integration tests
tejas-claude-bot[bot] Apr 5, 2026
8e7cbea
fix: use write_all to prevent short writes and add write_data tests
tejas-claude-bot[bot] Apr 7, 2026
1a1c606
fix: truncate existing files on FILE_OVERWRITE_IF create disposition
claude Jul 16, 2026
7e2a15a
test: skip smbclient E2E tests when prerequisites are missing
claude Jul 16, 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
Prev Previous commit
Next Next commit
refactor: split file_info structs into separate files per project con…
…vention

Move each MS-FSCC file information struct out of mod.rs into its own
file (access.rs, alignment.rs, basic.rs, ea.rs, internal.rs, mode.rs,
name.rs, network_open.rs, position.rs, standard.rs). mod.rs now only
contains module declarations, re-exports, and the composite
FileAllInformation type.

All 80 unit tests and 10 integration tests pass.
  • Loading branch information
tejas-claude-bot[bot] committed Apr 4, 2026
commit 56eb98e9048f2ead0a832da49bf35c15c084d82c
12 changes: 12 additions & 0 deletions smb/src/protocol/body/file_info/access.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use serde::{Deserialize, Serialize};

use smb_derive::{SMBByteSize, SMBFromBytes, SMBToBytes};

/// FILE_ACCESS_INFORMATION (MS-FSCC 2.4.1) — 4 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileAccessInformation {
#[smb_direct(start(fixed = 0))]
pub access_flags: u32,
}
12 changes: 12 additions & 0 deletions smb/src/protocol/body/file_info/alignment.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use serde::{Deserialize, Serialize};

use smb_derive::{SMBByteSize, SMBFromBytes, SMBToBytes};

/// FILE_ALIGNMENT_INFORMATION (MS-FSCC 2.4.3) — 4 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileAlignmentInformation {
#[smb_direct(start(fixed = 0))]
pub alignment_requirement: u32,
}
25 changes: 25 additions & 0 deletions smb/src/protocol/body/file_info/basic.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use serde::{Deserialize, Serialize};

use smb_derive::{SMBByteSize, SMBFromBytes, SMBToBytes};

use crate::protocol::body::create::file_attributes::SMBFileAttributes;
use crate::protocol::body::filetime::FileTime;

/// FILE_BASIC_INFORMATION (MS-FSCC 2.4.7) — 40 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileBasicInformation {
#[smb_direct(start(fixed = 0))]
pub creation_time: FileTime,
#[smb_direct(start(fixed = 8))]
pub last_access_time: FileTime,
#[smb_direct(start(fixed = 16))]
pub last_write_time: FileTime,
#[smb_direct(start(fixed = 24))]
pub change_time: FileTime,
#[smb_direct(start(fixed = 32))]
pub file_attributes: SMBFileAttributes,
#[smb_direct(start(fixed = 36))]
pub reserved: u32,
}
12 changes: 12 additions & 0 deletions smb/src/protocol/body/file_info/ea.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use serde::{Deserialize, Serialize};

use smb_derive::{SMBByteSize, SMBFromBytes, SMBToBytes};

/// FILE_EA_INFORMATION (MS-FSCC 2.4.12) — 4 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileEaInformation {
#[smb_direct(start(fixed = 0))]
pub ea_size: u32,
}
12 changes: 12 additions & 0 deletions smb/src/protocol/body/file_info/internal.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use serde::{Deserialize, Serialize};

use smb_derive::{SMBByteSize, SMBFromBytes, SMBToBytes};

/// FILE_INTERNAL_INFORMATION (MS-FSCC 2.4.20) — 8 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileInternalInformation {
#[smb_direct(start(fixed = 0))]
pub index_number: u64,
}
158 changes: 22 additions & 136 deletions smb/src/protocol/body/file_info/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,143 +3,27 @@
//! Typed representations of the file information structures defined in
//! [MS-FSCC] sections 2.4.x, used in QueryInfo / SetInfo responses.

use serde::{Deserialize, Serialize};
mod access;
mod alignment;
mod basic;
mod ea;
mod internal;
mod mode;
mod name;
mod network_open;
mod position;
mod standard;

use smb_derive::{SMBByteSize, SMBFromBytes, SMBToBytes};

use crate::protocol::body::create::file_attributes::SMBFileAttributes;
use crate::protocol::body::filetime::FileTime;

/// FILE_BASIC_INFORMATION (MS-FSCC 2.4.7) — 40 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileBasicInformation {
#[smb_direct(start(fixed = 0))]
pub creation_time: FileTime,
#[smb_direct(start(fixed = 8))]
pub last_access_time: FileTime,
#[smb_direct(start(fixed = 16))]
pub last_write_time: FileTime,
#[smb_direct(start(fixed = 24))]
pub change_time: FileTime,
#[smb_direct(start(fixed = 32))]
pub file_attributes: SMBFileAttributes,
#[smb_direct(start(fixed = 36))]
pub reserved: u32,
}

/// FILE_STANDARD_INFORMATION (MS-FSCC 2.4.41) — 24 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileStandardInformation {
#[smb_direct(start(fixed = 0))]
pub allocation_size: u64,
#[smb_direct(start(fixed = 8))]
pub end_of_file: u64,
#[smb_direct(start(fixed = 16))]
pub number_of_links: u32,
#[smb_direct(start(fixed = 20))]
pub delete_pending: u8,
#[smb_direct(start(fixed = 21))]
pub directory: u8,
#[smb_direct(start(fixed = 22))]
pub reserved: u16,
}

/// FILE_INTERNAL_INFORMATION (MS-FSCC 2.4.20) — 8 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileInternalInformation {
#[smb_direct(start(fixed = 0))]
pub index_number: u64,
}

/// FILE_EA_INFORMATION (MS-FSCC 2.4.12) — 4 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileEaInformation {
#[smb_direct(start(fixed = 0))]
pub ea_size: u32,
}

/// FILE_ACCESS_INFORMATION (MS-FSCC 2.4.1) — 4 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileAccessInformation {
#[smb_direct(start(fixed = 0))]
pub access_flags: u32,
}

/// FILE_POSITION_INFORMATION (MS-FSCC 2.4.35) — 8 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FilePositionInformation {
#[smb_direct(start(fixed = 0))]
pub current_byte_offset: u64,
}

/// FILE_MODE_INFORMATION (MS-FSCC 2.4.26) — 4 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileModeInformation {
#[smb_direct(start(fixed = 0))]
pub mode: u32,
}

/// FILE_ALIGNMENT_INFORMATION (MS-FSCC 2.4.3) — 4 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileAlignmentInformation {
#[smb_direct(start(fixed = 0))]
pub alignment_requirement: u32,
}

/// FILE_NAME_INFORMATION (MS-FSCC 2.4.28) — variable length
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileNameInformation {
#[smb_direct(start(fixed = 0))]
pub file_name_length: u32,
#[smb_string(
order = 0,
start(fixed = 4),
length(inner(start = 0, num_type = "u32")),
underlying = "u16"
)]
pub file_name: String,
}

/// FILE_NETWORK_OPEN_INFORMATION (MS-FSCC 2.4.29) — 56 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileNetworkOpenInformation {
#[smb_direct(start(fixed = 0))]
pub creation_time: FileTime,
#[smb_direct(start(fixed = 8))]
pub last_access_time: FileTime,
#[smb_direct(start(fixed = 16))]
pub last_write_time: FileTime,
#[smb_direct(start(fixed = 24))]
pub change_time: FileTime,
#[smb_direct(start(fixed = 32))]
pub allocation_size: u64,
#[smb_direct(start(fixed = 40))]
pub end_of_file: u64,
#[smb_direct(start(fixed = 48))]
pub file_attributes: SMBFileAttributes,
#[smb_direct(start(fixed = 52))]
pub reserved: u32,
}
pub use access::FileAccessInformation;
pub use alignment::FileAlignmentInformation;
pub use basic::FileBasicInformation;
pub use ea::FileEaInformation;
pub use internal::FileInternalInformation;
pub use mode::FileModeInformation;
pub use name::FileNameInformation;
pub use network_open::FileNetworkOpenInformation;
pub use position::FilePositionInformation;
pub use standard::FileStandardInformation;

/// FILE_ALL_INFORMATION (MS-FSCC 2.4.2) — composite structure
///
Expand Down Expand Up @@ -180,6 +64,8 @@ impl FileAllInformation {
#[cfg(test)]
mod tests {
use super::*;
use crate::protocol::body::create::file_attributes::SMBFileAttributes;
use crate::protocol::body::filetime::FileTime;
use smb_core::{SMBByteSize, SMBFromBytes, SMBToBytes};

#[test]
Expand Down
12 changes: 12 additions & 0 deletions smb/src/protocol/body/file_info/mode.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use serde::{Deserialize, Serialize};

use smb_derive::{SMBByteSize, SMBFromBytes, SMBToBytes};

/// FILE_MODE_INFORMATION (MS-FSCC 2.4.26) — 4 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileModeInformation {
#[smb_direct(start(fixed = 0))]
pub mode: u32,
}
19 changes: 19 additions & 0 deletions smb/src/protocol/body/file_info/name.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use serde::{Deserialize, Serialize};

use smb_derive::{SMBByteSize, SMBFromBytes, SMBToBytes};

/// FILE_NAME_INFORMATION (MS-FSCC 2.4.28) — variable length
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileNameInformation {
#[smb_direct(start(fixed = 0))]
pub file_name_length: u32,
#[smb_string(
order = 0,
start(fixed = 4),
length(inner(start = 0, num_type = "u32")),
underlying = "u16"
)]
pub file_name: String,
}
29 changes: 29 additions & 0 deletions smb/src/protocol/body/file_info/network_open.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
use serde::{Deserialize, Serialize};

use smb_derive::{SMBByteSize, SMBFromBytes, SMBToBytes};

use crate::protocol::body::create::file_attributes::SMBFileAttributes;
use crate::protocol::body::filetime::FileTime;

/// FILE_NETWORK_OPEN_INFORMATION (MS-FSCC 2.4.29) — 56 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileNetworkOpenInformation {
#[smb_direct(start(fixed = 0))]
pub creation_time: FileTime,
#[smb_direct(start(fixed = 8))]
pub last_access_time: FileTime,
#[smb_direct(start(fixed = 16))]
pub last_write_time: FileTime,
#[smb_direct(start(fixed = 24))]
pub change_time: FileTime,
#[smb_direct(start(fixed = 32))]
pub allocation_size: u64,
#[smb_direct(start(fixed = 40))]
pub end_of_file: u64,
#[smb_direct(start(fixed = 48))]
pub file_attributes: SMBFileAttributes,
#[smb_direct(start(fixed = 52))]
pub reserved: u32,
}
12 changes: 12 additions & 0 deletions smb/src/protocol/body/file_info/position.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use serde::{Deserialize, Serialize};

use smb_derive::{SMBByteSize, SMBFromBytes, SMBToBytes};

/// FILE_POSITION_INFORMATION (MS-FSCC 2.4.35) — 8 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FilePositionInformation {
#[smb_direct(start(fixed = 0))]
pub current_byte_offset: u64,
}
22 changes: 22 additions & 0 deletions smb/src/protocol/body/file_info/standard.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use serde::{Deserialize, Serialize};

use smb_derive::{SMBByteSize, SMBFromBytes, SMBToBytes};

/// FILE_STANDARD_INFORMATION (MS-FSCC 2.4.41) — 24 bytes
#[derive(
Debug, PartialEq, Eq, Clone, Serialize, Deserialize, SMBByteSize, SMBFromBytes, SMBToBytes,
)]
pub struct FileStandardInformation {
#[smb_direct(start(fixed = 0))]
pub allocation_size: u64,
#[smb_direct(start(fixed = 8))]
pub end_of_file: u64,
#[smb_direct(start(fixed = 16))]
pub number_of_links: u32,
#[smb_direct(start(fixed = 20))]
pub delete_pending: u8,
#[smb_direct(start(fixed = 21))]
pub directory: u8,
#[smb_direct(start(fixed = 22))]
pub reserved: u16,
}