Skip to content

Commit

Permalink
datajson: fix unix socket add command
Browse files Browse the repository at this point in the history
It was not handling correctly the json values with space as they
were seen as multiple arguments.

Ticket: OISF#7372
  • Loading branch information
regit committed Nov 28, 2024
1 parent 02bb197 commit 848c3b0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/suricata/sc/suricatasc.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ def execute(self, command):
cmd_specs = argsd[cmd]
required_args_count = len([d["required"] for d in cmd_specs if d["required"] and not "val" in d])
arguments = dict()
# if all arguments are required in the command then we split at the count
# this way we can handle last argument containing space (datajson-add for example)
non_req_args_count = len([d for d in cmd_specs if not d["required"] or "val" in d])
if non_req_args_count == 0:
full_cmd = command.split(maxsplit=required_args_count)
for c, spec in enumerate(cmd_specs, 1):
spec_type = str if "type" not in spec else spec["type"]
if spec["required"]:
Expand Down

0 comments on commit 848c3b0

Please sign in to comment.