fix: SSH transport - log to stderr, use-after-free, systemd scope conflict

This commit is contained in:
2026-07-06 20:15:36 +02:00
parent 3b92501dc7
commit 372c559ef2
3 changed files with 11 additions and 8 deletions
+4
View File
@@ -307,6 +307,10 @@ int main(int argc, char *argv[]) {
if (is_remote_dest(config->receive_root_directory)) {
config->transport = TRANSPORT_SSH;
config->ssh_destination = str_dup(config->receive_root_directory);
char *colon = strchr(config->receive_root_directory, ':');
char *path = str_dup(colon + 1);
free(config->receive_root_directory);
config->receive_root_directory = path;
}
} else if (positional_count == 1) {
fprintf(stderr, "Error: missing destination argument\n");
+5 -6
View File
@@ -12,14 +12,13 @@ void log_message(LogLevel log_level, char *format, ...) {
time_t now = time(NULL);
struct tm *t = localtime(&now);
// Print timestamp and log level to the file
printf("%04d-%02d-%02d %02d:%02d:%02d [%s]: ", t->tm_year + 1900,
t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec,
log_level_strings[log_level]);
fprintf(stderr, "%04d-%02d-%02d %02d:%02d:%02d [%s]: ", t->tm_year + 1900,
t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec,
log_level_strings[log_level]);
va_list args;
va_start(args, format);
vprintf(format, args);
vfprintf(stderr, format, args);
va_end(args);
printf("\n");
fprintf(stderr, "\n");
}
+1 -1
View File
@@ -273,7 +273,7 @@ def run_profile(profile_name, source_dir, dest_dir):
for case in SSH_CASES:
flags = BASE_CLIENT_FLAGS + (["-M"] if case.get("use_metadata", True) else []) + case["flags"]
ssh_dest = f"localhost:{dest_dir}_ssh"
cmd = client_prefix + BASE_CLIENT_CMD + [source_dir, ssh_dest] + flags
cmd = BASE_CLIENT_CMD + [source_dir, ssh_dest] + flags
print(f"\n --- {case['name']} ---\n Running: {' '.join(cmd)}")
try:
r = run_single_test(cmd, case["name"], source_dir, f"{dest_dir}_ssh", no_server=True)