Commit Graph

702 Commits (363b5f99c36fda06f185e446ca28dff6da81fbcc)

Author SHA1 Message Date
Jason Ish 363b5f99c3 rust: functions that reference raw pointers are unsafe
Based on the Rust clippy lint that recommends that any public
function that dereferences a raw pointer, mark all FFI functions
that reference raw pointers with build_slice and cast_pointer
as unsafe.

This commits starts by removing the unsafe wrapper inside
the build_slice and cast_pointer macros then marks all
functions that use these macros as unsafe.

Then fix all not_unsafe_ptr_arg_deref warnings from clippy.

Fixes clippy lint:
https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
5 years ago
Jason Ish 53413f2d7a rust: remove all usage of transmute
All cases of our transmute can be replaced with more idiomatic
solutions and do no require the power of transmute.

When returning an object to C for life-time management, use
Box::into_raw to convert the boxed object to pointer and use
Box::from_raw to convert back.

For cases where we're just returning a pointer to Rust managed
data, use a cast.
5 years ago
Victor Julien 9d24a53c53 nfs: minor code cleanup 5 years ago
Victor Julien aa9d8658ef smb: minor formatting fixup 5 years ago
Victor Julien 094208823b smb: minor code cleanup 5 years ago
Shivani Bhardwaj 0a1747c1ba nfs: fix comment 5 years ago
Shivani Bhardwaj 58ac9b0f38 nfs: Add rust registration function
Get rid of the C glue code and move registration completely to Rust.
5 years ago
Shivani Bhardwaj 61fca4e9db nfs: add missing code from rust impl of fns 5 years ago
Shivani Bhardwaj de50ac631e nfs: Change fn sign as per rust registration requirement
Registering parsers in Rust requires signatures to be a certain way and
compatible with C. Change signatures of all the functions.
Probe fn has also been changed to return AppProto as required by the new
fn signature.
5 years ago
Shivani Bhardwaj e5c948df87 smb: Add rust registration function
Get rid of the C glue code and move registration completely to Rust.
5 years ago
Shivani Bhardwaj 27af4bb002 smb: add missing code from rust impl of fns 5 years ago
Shivani Bhardwaj 6420df84b7 smb: Change fn sign as per rust registration requirement
Registering parsers in Rust requires signatures to be a certain way and
compatible with C. Change signatures of all the functions.
5 years ago
Shivani Bhardwaj 4d6b6b5dfe smb: add constants 5 years ago
Shivani Bhardwaj d1ea00521b rust/core: Add flow flags 5 years ago
Jason Ish 222e55847c flow: provide flags accessor function
Add an accessor function for flow flags. To be used by Rust where
the flow struct is an opaque data type.
5 years ago
Shivani Bhardwaj cb8bd8c669 rust/applayer: add more externs 5 years ago
Philippe Antoine 31dccd1171 modbus: do not claim to handle gaps 5 years ago
Sascha Steinbiss d541b3d4a8 rust: fix warnings with nightly 5 years ago
Philippe Antoine 9e7ea631b2 dns: improve probing parser
Checks opcode is valid
Checks additional_rr do not exceed message length
Better logic for incomplete cases
5 years ago
Philippe Antoine 6f03ee2e47 dcerpc: handles bigger inputs than 2^16
By comparing integers with the largest size
5 years ago
Philippe Antoine 7d0a39412b detect: use u32 for InspectionBufferMultipleForList
So that we do not have an endless loop casting index to
u16 and having more than 65536 buffers in one transaction

Changes for all protocols, even ones where it is impossible
to have such a pattern, so as to avoid bad pattern copy/paste
in the future
5 years ago
Philippe Antoine b3c1f2ab48 nfs: improve probing parser
Checks credentials flavor is known
5 years ago
Philippe Antoine 39575e2cc9 modbus: use ascii character classes while parsin rule
As the rust regex crate is unicode aware, which was
not the case of the C version
5 years ago
Philippe Antoine ef5755338f rust: SCLogDebug is real nop when built as release
Before, even if there were no outputs, all the arguments
were evaluated, which could turn expensive

All variables which are used only in certain build configurations
are now prefixed by underscore to avoid warnings
5 years ago
Victor Julien 20e8f90981 http2: set Debug on structs 5 years ago
Victor Julien 3587033d9e files: construct with default, free on drop
Update protocols.
5 years ago
Victor Julien d757545f03 files: implement default support 5 years ago
Philippe Antoine fdab22d924 rust: fix app-layer parser flags
This especially allows for SSH bypass to work
5 years ago
Jeff Lucovsky aa8871a5be rust/default: Enable Default usage 5 years ago
Jeff Lucovsky 6028ca7827 nfs: Rework constructs to use Self/Default 5 years ago
Jeff Lucovsky aafb0a60b7 dhcp: Rework constructs to use Self/Default 5 years ago
Jeff Lucovsky 1ef0bd580b dcerpc: Rework constructs to use Self/Default 5 years ago
Jeff Lucovsky 00167121dc dns: Rework constructs to use Self/Default 5 years ago
Jeff Lucovsky 02dccb1529 smb: Rework constructs to use Self/Default
This commit modifies the constructors to use Self and/or
Default::default() when feasible
5 years ago
Jeff Lucovsky f502f21f9e rust/default: Enable Default usage in SMB 5 years ago
Shivani Bhardwaj 581cb6223d dcerpc/udp: Add rust registration function
Get rid of the C glue code and move registration completely to Rust.
5 years ago
Shivani Bhardwaj d7007424bd dcerpc/udp: Change fn sign as per rust registration requirement
Registering parsers in Rust requires signatures to be a certain way and
compatible with C. Change signatures of all the functions.
5 years ago
Shivani Bhardwaj bac69af7e4 dcerpc: Add rust registration function
Get rid of the C glue code and move registration completely to Rust.
5 years ago
Shivani Bhardwaj a0a09a102b dcerpc: Change fn sign as per rust registration requirement
Registering parsers in Rust requires signatures to be a certain way and
compatible with C. Change signatures of all the functions.
5 years ago
Shivani Bhardwaj dee972b863 rust/core: Make AppProto type u16 5 years ago
Shivani Bhardwaj d66ad96f0d applayer/rust: add extern AppLayerProtoDetectPMRegisterPatternCSwPP 5 years ago
Victor Julien d7c3ecb6f9 http2: remove dead code 5 years ago
Philippe Antoine b3c502d572 http2: remove assertion which can be wrong
Brotli decoder stops consuming input it it reaches the
end of its input
5 years ago
Simon Dugas c2720fc2fb modbus: fix quantity and count calculation
The [Modbus Spec S6.11](https://modbus.org/docs/Modbus_Application_Protocol_V1_1b.pdf)
clearly states that the `count = quantity / 8` and not the other way
around. This is fixed in sawp-0.5.0.
5 years ago
Philippe Antoine 999327ba1f http2: http.cookie keyword now works for HTTP2 5 years ago
Philippe Antoine df039555bc http2: http.host.raw keyword now works for HTTP2 5 years ago
Philippe Antoine 1e82d0b3c8 http2: http.method keyword now works for HTTP2 5 years ago
Philippe Antoine 017e39d8fd http2: makes all HTTP1 header keywords work 5 years ago
Simon Dugas a8a51dc004 modbus: add eve logging 5 years ago
Simon Dugas 8342641477 modbus: move tests from c to rust
Move tests in a seperate commit so that we can use the previous one for
regression testing. This also gets rid of the temporary glue that made
the C tests work with the rust implementation.
5 years ago