Skip to content

Commit

Permalink
Remove unnecessary macro_use statements
Browse files Browse the repository at this point in the history
  • Loading branch information
noproto committed Aug 17, 2021
1 parent 4063841 commit 2dd58b8
Show file tree
Hide file tree
Showing 21 changed files with 8 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/application/common/hash/hashes/argon2id.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use argon2::PasswordHasher;
use rand::RngCore;
#[macro_use]

build_hash! { ARGON2ID (reader, salt_opt) {
let mut password: String = String::new();
reader.read_to_string(&mut password).expect("WhiteBeam: Could not read password buffer");
Expand Down
1 change: 0 additions & 1 deletion src/application/common/hash/hashes/blake3.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[macro_use]
build_hash! { BLAKE3 (reader, _salt_opt) {
let digestbytes = 32;
let buf_size = 32768;
Expand Down
2 changes: 1 addition & 1 deletion src/application/common/hash/hashes/sha3_256.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use sha3::Digest;
#[macro_use]

build_hash! { SHA3_256 (reader, _salt_opt) {
let digestbytes = 32;
let buf_size = 32768;
Expand Down
2 changes: 1 addition & 1 deletion src/application/common/hash/hashes/sha3_512.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use sha3::Digest;
#[macro_use]

build_hash! { SHA3_512 (reader, _salt_opt) {
let digestbytes = 64;
let buf_size = 32768;
Expand Down
1 change: 0 additions & 1 deletion src/library/common/action/actions/add_environment.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[macro_use]
build_action! { AddEnvironment (_src_prog, hook, _arg_id, args, do_return, return_value) {
if !((&hook.symbol).contains("exec") && (&hook.library).contains("libc.so")) {
unimplemented!("WhiteBeam: AddEnvironment action is unsupported outside of Execution hooks");
Expand Down
1 change: 0 additions & 1 deletion src/library/common/action/actions/add_flags.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[macro_use]
build_action! { AddFlags (_src_prog, hook, _arg_id, args, do_return, return_value) {
let library: &str = &hook.library;
let library_basename: &str = library.rsplit('/').next().unwrap_or(library);
Expand Down
1 change: 0 additions & 1 deletion src/library/common/action/actions/canonicalize_path.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[macro_use]
build_action! { CanonicalizePath (_src_prog, hook, arg_id, args, do_return, return_value) {
let library: &str = &hook.library;
let library_basename: &str = library.rsplit('/').next().unwrap_or(library);
Expand Down
1 change: 0 additions & 1 deletion src/library/common/action/actions/combine_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ pub fn normalize_path(path: &std::path::Path) -> std::path::PathBuf {
ret
}

#[macro_use]
build_action! { CombineDirectory (_src_prog, hook, arg_id, args, do_return, return_value) {
let dirfd_index = args.iter().position(|arg| arg.id == arg_id).expect("WhiteBeam: Lost track of environment");
let dirfd_argument: crate::common::db::ArgumentRow = args[dirfd_index].clone();
Expand Down
1 change: 0 additions & 1 deletion src/library/common/action/actions/consume_variadic.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[macro_use]
build_action! { ConsumeVariadic (_src_prog, hook, arg_id, args, do_return, return_value) {
let variadic_start = args.iter().position(|arg| arg.id == arg_id).expect("WhiteBeam: Lost track of environment");
let variadic_start_id: i64 = args[variadic_start].id;
Expand Down
1 change: 0 additions & 1 deletion src/library/common/action/actions/filter_environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ fn get_restricted() -> Vec<std::ffi::OsString> {
)
}

#[macro_use]
build_action! { FilterEnvironment (_src_prog, hook, arg_id, args, do_return, return_value) {
// Enforce LD_AUDIT, LD_BIND_NOT, WB_PROG
// TODO: Avoid leaking memory (NB: this action is often called before execve on Linux)
Expand Down
1 change: 0 additions & 1 deletion src/library/common/action/actions/open_file_descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ fn fail(library_basename: &str, symbol: &str) -> isize {
}
}

#[macro_use]
build_action! { OpenFileDescriptor (src_prog, hook, arg_id, args, do_return, return_value) {
// TODO: Refactor
// TODO: No O_CLOEXEC leads to inherited fd's in children
Expand Down
5 changes: 2 additions & 3 deletions src/library/common/action/actions/print_arguments.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#[macro_use]
build_action! { PrintArguments (_src_prog, hook, arg_id, args, do_return, return_value) {
build_action! { PrintArguments (_src_prog, hook, _arg_id, args, do_return, return_value) {
// strace/l(a)trace-like functionality
// TODO: Refactor to use Display
let library: &str = &hook.library;
Expand Down Expand Up @@ -27,4 +26,4 @@ build_action! { PrintArguments (_src_prog, hook, arg_id, args, do_return, return
}
print_string.push_str(")");
println!("{}", print_string);
}}
}}
1 change: 0 additions & 1 deletion src/library/common/action/actions/split_file_path.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[macro_use]
build_action! { SplitFilePath (_src_prog, hook, arg_id, args, do_return, return_value) {
let path_index = args.iter().position(|arg| arg.id == arg_id).expect("WhiteBeam: Lost track of environment");
let path_argument: crate::common::db::ArgumentRow = args[path_index].clone();
Expand Down
1 change: 0 additions & 1 deletion src/library/common/action/actions/verify_can_execute.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[macro_use]
build_action! { VerifyCanExecute (src_prog, hook, arg_id, args, do_return, return_value) {
// TODO: Depending on LogVerbosity, log all use of this action
// TODO: Use OsString?
Expand Down
1 change: 0 additions & 1 deletion src/library/common/action/actions/verify_can_terminate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[macro_use]
build_action! { VerifyCanTerminate (src_prog, hook, arg_id, args, do_return, return_value) {
#[cfg(feature = "whitelist_test")]
return (hook, args, do_return, return_value);
Expand Down
1 change: 0 additions & 1 deletion src/library/common/action/actions/verify_can_write.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[macro_use]
build_action! { VerifyCanWrite (src_prog, hook, arg_id, args, do_return, return_value) {
let directory_index = args.iter().position(|arg| arg.id == arg_id).expect("WhiteBeam: Lost track of environment");
let directory_argument: crate::common::db::ArgumentRow = args[directory_index].clone();
Expand Down
1 change: 0 additions & 1 deletion src/library/common/action/actions/verify_file_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ fn fail(library_basename: &str, symbol: &str, argument_path: &str) {
}
}

#[macro_use]
build_action! { VerifyFileHash (src_prog, hook, arg_id, args, do_return, return_value) {
// TODO: Depending on LogVerbosity, log all use of this action
// NB: For Execution hooks, system executables that aren't read world may be whitelisted as ANY
Expand Down
2 changes: 1 addition & 1 deletion src/library/common/hash/hashes/argon2id.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use argon2::PasswordHasher;
#[macro_use]

build_hash! { ARGON2ID (reader, salt_opt) {
let mut password: String = String::new();
reader.read_to_string(&mut password).expect("WhiteBeam: Could not read password buffer");
Expand Down
1 change: 0 additions & 1 deletion src/library/common/hash/hashes/blake3.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[macro_use]
build_hash! { BLAKE3 (reader, _salt_opt) {
let digestbytes = 32;
let buf_size = 32768;
Expand Down
2 changes: 1 addition & 1 deletion src/library/common/hash/hashes/sha3_256.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use sha3::Digest;
#[macro_use]

build_hash! { SHA3_256 (reader, _salt_opt) {
let digestbytes = 32;
let buf_size = 32768;
Expand Down
2 changes: 1 addition & 1 deletion src/library/common/hash/hashes/sha3_512.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use sha3::Digest;
#[macro_use]

build_hash! { SHA3_512 (reader, _salt_opt) {
let digestbytes = 64;
let buf_size = 32768;
Expand Down

0 comments on commit 2dd58b8

Please sign in to comment.