Skip to content

Commit

Permalink
Adds logging and changes return status for bad temp dir: Issue #1028
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiggins26 committed Oct 3, 2023
1 parent 0f9de9e commit 71ff816
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions clamd/clamd.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,13 @@ int main(int argc, char **argv)
ret = 1;
break;
}

STATBUF sb;
if (CLAMSTAT(opt->strarg, &sb) != 0 && !S_ISDIR(sb.st_mode)) {
logg(LOGG_ERROR, "Current configuration of TemporaryDirectory: %s does not exist, or is not valid \n", opt->strarg);
ret = 1;
break;
}
}

cl_engine_set_clcb_hash(engine, hash_callback);
Expand Down
5 changes: 3 additions & 2 deletions clamd/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,9 @@ int execute_or_dispatch_command(client_conn_t *conn, enum commands cmd, const ch
}
case COMMAND_INSTREAM: {
int rc = cli_gentempfd(optget(conn->opts, "TemporaryDirectory")->strarg, &conn->filename, &conn->scanfd);
if (rc != CL_SUCCESS)
return rc;
if (rc != CL_SUCCESS) {
return 1;
}
conn->quota = optget(conn->opts, "StreamMaxLength")->numarg;
conn->mode = MODE_STREAM;
return 0;
Expand Down

0 comments on commit 71ff816

Please sign in to comment.