Skip to content

Commit 42b453e

Browse files
authored
Merge pull request #39 from AvivNaaman/34-add-support-for-smb-specific-ioctls
34 add support for smb specific ioctls
2 parents 7d637c3 + c76e04f commit 42b453e

38 files changed

+767
-323
lines changed

smb-cli/src/info.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
use crate::{path::*, Cli};
22
use clap::Parser;
33
use maybe_async::*;
4-
use smb::{
5-
packets::smb2::{FileBasicInformation, FileIdBothDirectoryInformation},
6-
resource::Resource,
7-
};
4+
use smb::{packets::fscc::*, resource::Resource};
85
use std::error::Error;
96
#[derive(Parser, Debug)]
107
pub struct InfoCmd {

smb-cli/src/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::cli::Cli;
22
use maybe_async::*;
33
use smb::{
44
connection::{Connection, EncryptionMode},
5-
packets::smb2::*,
5+
packets::{fscc::*, smb2::*},
66
resource::Resource,
77
session::Session,
88
tree::Tree,

smb/src/packets.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
pub mod binrw_util;
2+
pub mod fscc;
23
pub mod guid;
34
pub mod netbios;
5+
pub mod security;
46
pub mod smb1;
57
pub mod smb2;

smb/src/packets/binrw_util/pos_marker.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,28 @@ where
287287
)
288288
}
289289

290+
/// Writer for value
291+
/// * fill absolute offset to offset location.
292+
/// * with value args.
293+
#[binrw::writer(writer, endian)]
294+
pub fn write_aoff_a<U>(
295+
value: &U,
296+
write_offset_to: &Self,
297+
value_args: U::Args<'_>,
298+
) -> BinResult<()>
299+
where
300+
U: BinWrite,
301+
{
302+
let no_size: Option<&PosMarker<T>> = None;
303+
let no_base: Option<&PosMarker<T>> = None;
304+
Self::write_hero(
305+
value,
306+
writer,
307+
endian,
308+
(no_size, Some(write_offset_to), no_base, value_args),
309+
)
310+
}
311+
290312
#[binrw::writer(writer, endian)]
291313
pub fn write_roff_size<U, S>(
292314
value: &U,
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::access_mask;
55
use binrw::{io::TakeSeekExt, meta::ReadEndian, prelude::*};
66
use modular_bitfield::prelude::*;
77

8-
use super::{super::binrw_util::prelude::*, SID};
8+
use super::{binrw_util::prelude::*, security::SID};
99
pub mod chained_item;
1010
pub mod common_info;
1111
pub mod directory_info;
@@ -198,7 +198,7 @@ macro_rules! file_info_classes {
198198
}
199199
}
200200

201-
impl crate::packets::smb2::fscc::FileInfoType for $name {
201+
impl crate::packets::fscc::FileInfoType for $name {
202202
type Class = [<$name Class>];
203203
fn class(&self) -> Self::Class {
204204
match self {
@@ -220,7 +220,7 @@ macro_rules! file_info_classes {
220220
type Error = crate::Error;
221221

222222
fn try_from(value: $name) -> Result<Self, Self::Error> {
223-
pub use crate::packets::smb2::fscc::FileInfoType;
223+
pub use crate::packets::fscc::FileInfoType;
224224
match value {
225225
$name::[<$field_name Information>](v) => Ok(v),
226226
_ => Err(crate::Error::UnexpectedInformationType(<Self as [<$name Value>]>::CLASS_ID as u8, value.class() as u8)),
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//!
77
use std::ops::Deref;
88

9-
use super::super::super::binrw_util::prelude::*;
9+
use crate::packets::binrw_util::prelude::*;
1010
use binrw::prelude::*;
1111

1212
#[binrw::binrw]
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)