mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge remote-tracking branch 'origin/topic/robin/gh-54-sanitize'
* origin/topic/robin/gh-54-sanitize: Sanitize log files names before they go into system().
This commit is contained in:
parent
a49dcc8954
commit
0a0ed65306
8 changed files with 52 additions and 7 deletions
|
@ -649,7 +649,7 @@ function run_rotation_postprocessor_cmd(info: RotationInfo, npath: string) : boo
|
|||
# The date format is hard-coded here to provide a standardized
|
||||
# script interface.
|
||||
system(fmt("%s %s %s %s %s %d %s",
|
||||
pp_cmd, npath, info$path,
|
||||
pp_cmd, safe_shell_quote(npath), safe_shell_quote(info$path),
|
||||
strftime("%y-%m-%d_%H.%M.%S", info$open),
|
||||
strftime("%y-%m-%d_%H.%M.%S", info$close),
|
||||
info$terminating, writer));
|
||||
|
|
|
@ -66,7 +66,7 @@ function scp_postprocessor(info: Log::RotationInfo): bool
|
|||
command += fmt("scp %s %s@%s:%s;", info$fname, d$user, d$host, dst);
|
||||
}
|
||||
|
||||
command += fmt("/bin/rm %s", info$fname);
|
||||
command += fmt("/bin/rm %s", safe_shell_quote(info$fname));
|
||||
system(command);
|
||||
return T;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ function sftp_postprocessor(info: Log::RotationInfo): bool
|
|||
d$host_port, d$user, d$host);
|
||||
}
|
||||
|
||||
command += fmt("/bin/rm %s", info$fname);
|
||||
command += fmt("/bin/rm %s", safe_shell_quote(info$fname));
|
||||
system(command);
|
||||
return T;
|
||||
}
|
||||
|
|
|
@ -384,12 +384,13 @@ function log_mailing_postprocessor(info: Log::RotationInfo): bool
|
|||
{
|
||||
local headers = email_headers(fmt("Log Contents: %s", info$fname),
|
||||
mail_dest);
|
||||
local tmpfilename = fmt("%s.mailheaders.tmp", info$fname);
|
||||
local tmpfilename = safe_shell_quote(fmt("%s.mailheaders.tmp", info$fname));
|
||||
local tmpfile = open(tmpfilename);
|
||||
write_file(tmpfile, headers);
|
||||
close(tmpfile);
|
||||
system(fmt("/bin/cat %s %s | %s -t -oi && /bin/rm %s %s",
|
||||
tmpfilename, info$fname, sendmail, tmpfilename, info$fname));
|
||||
tmpfilename, safe_shell_quote(info$fname), sendmail,
|
||||
tmpfilename, safe_shell_quote(info$fname)));
|
||||
}
|
||||
return T;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ event TrimTraceFile::go(first_trim: bool)
|
|||
{
|
||||
local info = rotate_file_by_name(trace_output_file);
|
||||
if ( info$old_name != "" )
|
||||
system(fmt("/bin/rm %s", info$new_name));
|
||||
system(fmt("/bin/rm %s", safe_shell_quote(info$new_name)));
|
||||
}
|
||||
|
||||
schedule trim_interval { TrimTraceFile::go(F) };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue