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 Sep 29, 2023
1 parent 0f9de9e commit 0c464fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions clamd/clamd.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,12 @@ int main(int argc, char **argv)
ret = 1;
break;
}

if (stat(CL_ENGINE_TMPDIR, &sb) != 0 && !S_ISDIR(sb.st_mode)) {

Check failure on line 572 in clamd/clamd.c

View workflow job for this annotation

GitHub Actions / build-windows

'sb': undeclared identifier

Check failure on line 572 in clamd/clamd.c

View workflow job for this annotation

GitHub Actions / build-windows

left of '.st_mode' must have struct/union type
logg(LOGG_ERROR, "Current configuration of TemporaryDirectory: %s does not exist, or is not valid", CL_ENGINE_TMPDIR);

Check failure

Code scanning / CodeQL

Wrong type of arguments to formatting function High

This argument should be of type 'char *' but is of type 'int'.
ret = 1;
break;
}
}

cl_engine_set_clcb_hash(engine, hash_callback);
Expand Down
6 changes: 4 additions & 2 deletions clamd/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,10 @@ 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) {
logg(LOGG_ERROR, "Failed to generate file in TemporaryDirectory, filename: %s \n", &conn->filename);

Check failure

Code scanning / CodeQL

Wrong type of arguments to formatting function High

This argument should be of type 'char *' but is of type 'char **'.
return 1;
}
conn->quota = optget(conn->opts, "StreamMaxLength")->numarg;
conn->mode = MODE_STREAM;
return 0;
Expand Down

0 comments on commit 0c464fb

Please sign in to comment.