Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: remove unused #9020

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 0 additions & 25 deletions rust/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ use nom7::{

extern {
fn ConfGet(key: *const c_char, res: *mut *const c_char) -> i8;
fn ConfGetChildValue(conf: *const c_void, key: *const c_char,
vptr: *mut *const c_char) -> i8;
fn ConfGetChildValueBool(conf: *const c_void, key: *const c_char,
vptr: *mut c_int) -> i8;
fn ConfGetNode(key: *const c_char) -> *const c_void;
Expand Down Expand Up @@ -103,29 +101,6 @@ impl ConfNode {
return Self { conf }
}

pub fn get_child_value(&self, key: &str) -> Option<&str> {
let mut vptr: *const c_char = ptr::null_mut();

unsafe {
let s = CString::new(key).unwrap();
if ConfGetChildValue(self.conf,
s.as_ptr(),
&mut vptr) != 1 {
return None;
}
}

if vptr.is_null() {
return None;
}

let value = str::from_utf8(unsafe{
CStr::from_ptr(vptr).to_bytes()
}).unwrap();

return Some(value);
}

pub fn get_child_bool(&self, key: &str) -> bool {
let mut vptr: c_int = 0;

Expand Down
42 changes: 0 additions & 42 deletions rust/src/dcerpc/dcerpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,54 +38,12 @@ pub const DCERPC_UUID_ENTRY_FLAG_FF: u16 = 0x0001;
pub const PFC_FIRST_FRAG: u8 = 0x01;
// Value to indicate last fragment
pub const PFC_LAST_FRAG: u8 = 0x02;
// Cancel was pending at sender
pub const PFC_PENDING_CANCEL: u8 = 0x04;
pub const PFC_RESERVED_1: u8 = 0x08;
// supports concurrent multiplexing of a single connection.
pub const PFC_CONC_MPX: u8 = 0x10;
// only meaningful on `fault' packet; if true, guaranteed
// call did not execute.
pub const PFC_DID_NOT_EXECUTE: u8 = 0x20;
// `maybe' call semantics requested
pub const PFC_MAYBE: u8 = 0x40;
// if true, a non-nil object UUID was specified in the handle, and
// is present in the optional object field. If false, the object field
// is omitted.
pub const PFC_OBJECT_UUID: u8 = 0x80;

// Flag bits in first flag field in connectionless PDU header.
pub const PFCL1_RESERVED_01: u8 = 0x01; // Reserved for use by implementations
pub const PFCL1_LASTFRAG: u8 = 0x02; // If set, the PDU is the last fragment
// of a multi-PDU transmission
pub const PFCL1_FRAG: u8 = 0x04; // If set, the PDU is a fragment
// of a multi-PDU transmission
pub const PFCL1_NOFACK: u8 = 0x08; // If set, the receiver is not requested
// to send a `fack' PDU for the fragment
pub const PFCL1_MAYBE: u8 = 0x10; // If set, the PDU is for a `maybe' request
pub const PFCL1_IDEMPOTENT: u8 = 0x20; // If set, the PDU is for
// an idempotent request
pub const PFCL1_BROADCAST: u8 = 0x40; // If set, the PDU is for
// a broadcast request
pub const PFCL1_RESERVED_80: u8 = 0x80; // Reserved for use by implementations

// Flag bits in second flag field in connectionless PDU header.
pub const PFCL2_RESERVED_01: u8 = 0x01; // Reserved for use by implementations
pub const PFCL2_CANCEL_PENDING: u8 = 0x02; // Cancel pending at the call end
pub const PFCL2_RESERVED_04: u8 = 0x04; // Reserved for future use
pub const PFCL2_RESERVED_08: u8 = 0x08; // Reserved for future use
pub const PFCL2_RESERVED_10: u8 = 0x10; // Reserved for future use
pub const PFCL2_RESERVED_20: u8 = 0x20; // Reserved for future use
pub const PFCL2_RESERVED_40: u8 = 0x40; // Reserved for future use
pub const PFCL2_RESERVED_80: u8 = 0x80; // Reserved for future use

pub const REASON_NOT_SPECIFIED: u8 = 0;
pub const TEMPORARY_CONGESTION: u8 = 1;
pub const LOCAL_LIMIT_EXCEEDED: u8 = 2;
pub const CALLED_PADDR_UNKNOWN: u8 = 3; /* not used */
pub const PROTOCOL_VERSION_NOT_SUPPORTED: u8 = 4;
pub const DEFAULT_CONTEXT_NOT_SUPPORTED: u8 = 5; /* not used */
pub const USER_DATA_NOT_READABLE: u8 = 6; /* not used */
pub const NO_PSAP_AVAILABLE: u8 = 7; /* not used */

// DCERPC Header packet types
pub const DCERPC_TYPE_REQUEST: u8 = 0;
Expand Down
30 changes: 0 additions & 30 deletions rust/src/jsonbuilder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,36 +373,6 @@ impl JsonBuilder {
}
}

/// Add a byte array to a JSON array encoded as hex.
pub fn append_hex(&mut self, val: &[u8]) -> Result<&mut Self, JsonError> {
match self.current_state() {
State::ArrayFirst => {
self.push('"')?;
for i in 0..val.len() {
self.push(HEX[(val[i] >> 4) as usize] as char)?;
self.push(HEX[(val[i] & 0xf) as usize] as char)?;
}
self.push('"')?;
self.set_state(State::ArrayNth);
Ok(self)
}
State::ArrayNth => {
self.push(',')?;
self.push('"')?;
for i in 0..val.len() {
self.push(HEX[(val[i] >> 4) as usize] as char)?;
self.push(HEX[(val[i] & 0xf) as usize] as char)?;
}
self.push('"')?;
Ok(self)
}
_ => {
debug_validate_fail!("invalid state");
Err(JsonError::InvalidState)
}
}
}

/// Add an unsigned integer to an array.
pub fn append_uint(&mut self, val: u64) -> Result<&mut Self, JsonError> {
match self.current_state() {
Expand Down
5 changes: 0 additions & 5 deletions rust/src/smb/smb2_records.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ pub struct Smb2SecBlobRecord<'a> {
pub data: &'a [u8],
}

pub fn parse_smb2_sec_blob(i: &[u8]) -> IResult<&[u8], Smb2SecBlobRecord> {
let (i, data) = rest(i)?;
Ok((i, Smb2SecBlobRecord { data }))
}

#[derive(Debug, PartialEq, Eq)]
pub struct Smb2RecordDir {
pub request: bool,
Expand Down