Commit Graph

1107 Commits (7f4c1d5e2fc03a81cee193918b8da8ee3243f5a6)

Author SHA1 Message Date
Alice Akaki ccdc992a71 rust: fix lint warnings about mixed case hex literals
Ticket: #4593
2 years ago
Gabriel Lima Luz 4e90d17fd9 rust: fix lint warnings about if same then else
Ticket: 4609
2 years ago
Kristina Jefferson 9cd00424c3 rust: fix lint warnings about ptr_arg
Ticket: #4599
2 years ago
Jason Ish 21bb697bc9 rust: fix clippy lint for unneeded late initialization 2 years ago
Jason Ish 7cca238128 rust: fix clippy lint for cmp_null is debug code
Ticket: 5577
2 years ago
Jason Ish f0952aef0d rust: fix clippy lints for unneeded reference in debug code 2 years ago
Jason Ish 6a7439a26b rust: fix clippy lints for is_empty in debug code 2 years ago
Jason Ish 560c4ea125 rust: don't allow fixed up clippy lints 2 years ago
Jason Ish 6db85d6f89 rust: clippy fix for bitwise or with 0 2 years ago
Jason Ish 04f0ee0151 rust: fix clippy lints for clippy::unnecessary_cast 2 years ago
Jason Ish b6cc0e25b1 rust: fix clippy lints for clippy::redundant_static_lifetimes 2 years ago
Jason Ish 13db83274b rust: fix clippy lints for clippy::redundant_pattern_matching 2 years ago
Jason Ish 7ba1d3e300 rust: fix clippy lints for clippy::nonminimal_bool 2 years ago
Jason Ish 6ba0a67143 rust: fix clippy lints for clippy::map_flatten 2 years ago
Jason Ish 7ebdfa539a rust: fix clippy lints for clippy::manual_find 2 years ago
Jason Ish 119e02cf81 rust: fix clippy lints for clippy::collapsible_if 2 years ago
Jason Ish 572505870a rust: fix clippy lints for clippy::collapsible_else_if 2 years ago
Jason Ish 6b71d69356 rust: fix clippy lints for clippy::bool_comparison 2 years ago
Jason Ish e373d9f5e0 rust: fix clippy lints for clippy::crate_in_macro_def 2 years ago
Jason Ish 565da0d0af rust: fix clippy lints for clippy::redundant_field_names 2 years ago
Jason Ish 5f7ba03e63 rust: fix clippy lints for clippy::needless_bool 2 years ago
Jason Ish 3ec435a703 rust: fix clippy lints for clippy::manual_range_contains 2 years ago
Jason Ish f342d4aacd rust: fix clippy lints for clippy::len_zero 2 years ago
Jason Ish 5e5401d3e9 rust: fix clippy lints for clippy::char_lit_as_u8 2 years ago
Jason Ish 29a4a7fddc rust: fix clippy lints for clippy::assign_op_pattern 2 years ago
Jason Ish c4034dafa1 rust: fix clippy lints for clippy::derive_partial_eq_without_eq 2 years ago
Jason Ish 5a10fcd2d8 rust: suppress large enum variant lint at location
And disable the global lint.
2 years ago
Jason Ish 74b7522b6a rust/http2: box decompressor variants
These variants, in particular the Brotli one can be large at over 2500
bytes which is allocated no matter which decompressor is being used.

Gzip comes in at over 500 bytes.  Box deflate for consistency.
2 years ago
Jason Ish 36f8ada305 rust: remove clippy lints that no longer warn 2 years ago
Jason Ish e8c00dd980 rust: sort clippy allow statements 2 years ago
Haleema Khan 6c922e0b98 rust: fix lint warning for clippy::enum's name
Ticket: #4597
2 years ago
Jason Ish 2a42386c28 rust: fix clippy lint for null comparison
Use .is_null() instead of checking for equality against
std::ptr::null().
2 years ago
Jason Ish 45dfea2497 rust/modbus: derive default instead of manual impl
Cleans up a clippy lint for a trivial default impl that can be derived.
2 years ago
Jason Ish 9218da0eb8 rust/frames: cleanup clippy lint for unsafe
Where possible mark the relevant functions unsafe.  Otherwise suppress
the warning for now as this pattern is supposed to be a safe API around
an unsafe one. Might need some further investigation, but in general the
"guarantee" here is provided from the C side.
2 years ago
Jason Ish 105d9a5f02 rust: fix clippy lint for unnecessary_unwrap
Avoid check if not none followed by unwrap.
2 years ago
Jason Ish 85cfa7254b rust: fix clippy lint for single_char_add_str
Idiomatic cleanup and a fix automatically done by `cargo clippy --fix`.
2 years ago
Jason Ish f3e4bcfe23 rust: fix clippy lint for bool_assert_comparison
Checking for is_empty is faster than checking for equality.
2 years ago
Jason Ish f60e1b30f6 rust: fix clippy lint for partialeq_to_none
Use .is_some() and .is_none() instead of comparing against None.
Comparing against None requires a value to impl PartialEq, is_none() and
is_some() do not and are more idiomatic.
2 years ago
Jason Ish 7d623f0854 rust: fix clippy lint for explicit_auto_deref
This adds unnecessary complexity to code.
2 years ago
Jason Ish c503ca62e2 rust: fix clippy lint for needless_late_init 2 years ago
Jason Ish 94dd85baed rust: fix clippy lint for borrow_deref_ref
This type of borrow then reference has no effect.
2 years ago
Jason Ish e9597f3d0c rust: fix clippy lint for redundant_closure
Removes a closure where the function can be directly provided.
2 years ago
Jason Ish c5b26e2043 rust: fix clippy ling for needless borrows
Cleanup needless borrows found by clippy. This fix done automatically by
`cargo clippy --fix`.
2 years ago
Jason Ish 63b3d73ccc rust: allow some more clippy lints
Allow these lints for now until some more investigation can be done, as
--fix attempts to fix these.
2 years ago
Eric Leblond a9519778de rust/smb: avoid allocation in smb status function
Avoid an allocation by returning a static string.
2 years ago
Eric Leblond 9cb06d4376 detect/smb: add smb.ntlmssp_domain keyword
Feature #5411.
2 years ago
Eric Leblond 5debb86cd5 rust/smb1: add a missing command 2 years ago
Eric Leblond 69ef1bc194 detect/smb: add smb.ntlmssp_user keyword
Feature #5411.
2 years ago
Eric Leblond f46f895e8d rust/smb: import NT status code for Microsoft doc
This patch updates the NT status code definition to use the status
definition used on Microsoft documentation website. A first python
script is building JSON object with code definition.

```
import json
from bs4 import BeautifulSoup
import requests

ntstatus = requests.get('https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55')

ntstatus_parsed = BeautifulSoup(ntstatus.text, 'html.parser')

ntstatus_parsed = ntstatus_parsed.find('tbody')

ntstatus_dict = {}

for item in ntstatus_parsed.find_all('tr'):
    cell = item.find_all('td')
    if len(cell) == 0:
        continue
    code = cell[0].find_all('p')
    description_ps = cell[1].find_all('p')
    description_list = []
    if len(description_ps):
        for desc in description_ps:
            if not desc.string is None:
                description_list.append(desc.string.replace('\n ', ''))
    else:
        description_list = ['Description not available']
    if not code[0].string.lower() in ntstatus_dict:
        ntstatus_dict[code[0].string.lower()] = {"text": code[1].string, "desc": ' '.join(description_list)}

print(json.dumps(ntstatus_dict))
```

The second one is generating the code that is ready to be inserted into the
source file:

```
import json

ntstatus_file = open('ntstatus.json', 'r')

ntstatus = json.loads(ntstatus_file.read())

declaration_format = 'pub const SMB_NT%s:%su32 = %s;\n'
resolution_format = '        SMB_NT%s%s=> "%s",\n'

declaration = ""
resolution = ""

text_max = len(max([ntstatus[x]['text'] for x in ntstatus.keys()], key=len))

for code in ntstatus.keys():
    text = ntstatus[code]['text']
    text_spaces = ' ' * (4 + text_max - len(text))
    declaration += declaration_format % (text, text_spaces, code)
    resolution += resolution_format % (text, text_spaces, text)

print(declaration)
print('\n')
print('''
pub fn smb_ntstatus_string(c: u32) -> String {
    match c {
''')
print(resolution)
print('''
        _ => { return (c).to_string(); },
    }.to_string()
}
''')
```

Bug #5412.
2 years ago
Victor Julien db0f9ddc69 files/tx: inspection, logging and loop optimizations
Introduce AppLayerTxData::file_tx as direction(s) indicator for transactions.
When set to 0, its not a file tx and it will not be considered for file
inspection, logging and housekeeping tasks.

Various tx loop optimizations in housekeeping and output.

Update the "file capable" app-layers to set the fields based on their
directional file support as well as on the traffic.
2 years ago