Repository navigation
v.0.3.8 calmer days <3
migration to 2024
Fixed the Rust 2024 edition compatibility issues:
Fixed binding modifiers in fortinet_bruteforce.rs:
Removed ref from pattern matches (if let Some(ref r) = realm → if let Some(r) = realm)
Rust 2024's improved match ergonomics automatically handle references, so ref is no longer needed
Fixed unsafe function calls in shell.rs:
Wrapped env::set_var and env::remove_var calls in unsafe blocks
In Rust 2024, these functions are marked unsafe because they can cause data races in multi-threaded contexts
The code should now compile with Rust 2024 edition. The changes are:
Match ergonomics: Rust 2024 automatically infers when you need a reference, so explicit ref is unnecessary
Unsafe environment variables: Environment variable manipulation is now unsafe to prevent data races
Environment variables (thread-safe):
Added a Mutex to synchronize access to environment variable operations
Prevents data races when multiple threads access env vars
The unsafe block is still needed (Rust 2024 requirement), but it's now thread-safe
Buffer conversions (bounds-checked):
Added bounds checking before converting MaybeUninit buffers to slices
Prevents buffer overflows
The unsafe block is still needed for the raw pointer conversion, but it's now validated
System calls (documented):
libc::geteuid() is a simple read-only system call that can't cause memory safety issues
Added a comment explaining it's safe in practice
Why we can't completely eliminate unsafe:
env::set_var/remove_var: Marked unsafe in Rust 2024 due to potential data races; we use a Mutex to make it thread-safe
std::slice::from_raw_parts: Required for converting uninitialized buffers from raw sockets; we validate bounds first
libc::geteuid(): Required for system calls; it's a safe read-only operation
The code is now as safe as possible while still performing these low-level operations. The unsafe blocks are guarded with synchronization and validation.
If you want to avoid unsafe entirely, i want to:
Use a different approach for proxy configuration (e.g., pass proxy settings directly to reqwest instead of using env vars)
Use higher-level socket APIs that don't require raw buffer manipulation
What's Changed
Full Changelog: v0.3.7...v0.3.8