Skip to content

Commit

Permalink
Review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
micahsnyder committed Oct 11, 2023
1 parent 3097e77 commit e407e48
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 187 deletions.
184 changes: 0 additions & 184 deletions libclamav/scanners.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,190 +979,6 @@ static cl_error_t cli_scanegg(cli_ctx *ctx)
return status;
}

// static cl_error_t cli_scanonenote(cli_ctx *ctx)
// {
// cl_error_t status = CL_SUCCESS;
// cl_error_t onenote_ret;

// unsigned int file_count = 0;

// uint32_t nTooLargeFilesFound = 0;

// void *hArchive = NULL;

// char *extract_fullpath = NULL;

// char *extract_filename = NULL;
// char *extract_buffer = NULL;
// size_t extract_buffer_len = 0;

// char *onenote_filename = NULL;

// FFIError *onenote_error = NULL;

// if (ctx == NULL) {
// cli_dbgmsg("OneNote: Invalid arguments!\n");
// return CL_EARG;
// }

// cli_dbgmsg("in scanonenote()\n");

// char *onenote_filename = ctx->recursion_stack[ctx->recursion_level].fmap->name;

// /*
// * Open the archive.
// */
// if (CL_SUCCESS != (onenote_ret = onedump_from_bytes(
// onenote_filename,
// ctx->fmap,
// &hArchive,
// &onenote_error))) {
// if (onenote_ret == CL_EMEM) {
// status = CL_EMEM;
// goto done;
// } else {
// status = CL_EFORMAT;
// goto done;
// }
// }

// /*
// * Read & scan each file header.
// * Extract & scan each file.
// *
// * Skip files if they will exceed max filesize or max scansize.
// * Count the number of encrypted file headers and encrypted files.
// * - Alert if there are encrypted files,
// * if the Heuristic for encrypted archives is enabled,
// * and if we have not detected a signature match.
// */
// do {
// status = CL_CLEAN;

// /* Check if we've already exceeded the scan limit */
// if (cli_checklimits("OneNote", ctx, 0, 0, 0))
// break;

// /*
// * Extract the file...
// */
// if (!onenote_get_next_file(hArchive, &file_out, &extract_buffer, &extract_buffer_len)) {
// cli_dbgmsg("Failed to extract file from OneNote document %s: %s\n",
// cli_ftname(type),
// ffierror_fmt(fuzzy_hash_calc_error));
// break;
// }

// if (!extract_buffer || 0 == extract_buffer_len) {
// /*
// * Empty file. Skip.
// */
// cli_dbgmsg("OneNote: Skipping empty file: %s\n", metadata.filename);

// if (NULL != extract_filename) {
// free(extract_filename);
// extract_filename = NULL;
// }
// if (NULL != extract_buffer) {
// free(extract_buffer);
// extract_buffer = NULL;
// }
// /* Free up that the filepath */
// if (NULL != extract_fullpath) {
// free(extract_fullpath);
// extract_fullpath = NULL;
// }

// } else {
// /*
// * Drop to a temp file, if requested.
// */
// if (ctx->engine->keeptmp) {
// int extracted_fd = -1;
// extract_fullpath = cli_gentemp(ctx->sub_tmpdir);
// if (NULL == extract_fullpath) {
// cli_dbgmsg("OneNote: Memory error allocating filename for extracted file.");
// status = CL_EMEM;
// break;
// }

// extracted_fd = open(extract_fullpath, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0600);
// if (extracted_fd < 0) {
// cli_dbgmsg("OneNote: ERROR: Failed to open output file\n");
// } else {
// cli_dbgmsg("OneNote: Writing the extracted file contents to temp file: %s\n", extract_fullpath);
// if (0 == write(extracted_fd, extract_buffer, extract_buffer_len)) {
// cli_dbgmsg("OneNote: ERROR: Failed to write to output file\n");
// } else {
// close(extracted_fd);
// extracted_fd = -1;
// }
// }
// }

// /*
// * Scan the extracted file...
// */
// cli_dbgmsg("OneNote: Extraction complete. Scanning now...\n");
// status = cli_magic_scan_buff(extract_buffer, extract_buffer_len, ctx, NULL, LAYER_ATTRIBUTES_NONE);
// if (status != CL_SUCCESS) {
// goto done;
// }

// if (NULL != extract_filename) {
// free(extract_filename);
// extract_filename = NULL;
// }
// if (NULL != extract_buffer) {
// free(extract_buffer);
// extract_buffer = NULL;
// }
// }

// /* Free up that the filepath */
// if (NULL != extract_fullpath) {
// free(extract_fullpath);
// extract_fullpath = NULL;
// }

// if (ctx->engine->maxscansize && ctx->scansize >= ctx->engine->maxscansize) {
// status = CL_CLEAN;
// break;
// }

// } while (status == CL_CLEAN);

// if (status == CL_BREAK) {
// status = CL_CLEAN;
// }

// done:

// if (NULL != extract_filename) {
// free(extract_filename);
// extract_filename = NULL;
// }

// if (NULL != extract_buffer) {
// free(extract_buffer);
// extract_buffer = NULL;
// }

// if (NULL != hArchive) {
// onedump_free_parser(hArchive);
// hArchive = NULL;
// }

// if (NULL != extract_fullpath) {
// free(extract_fullpath);
// extract_fullpath = NULL;
// }

// cli_dbgmsg("OneNote: Exit code: %d\n", status);

// return status;
// }

static cl_error_t cli_scanarj(cli_ctx *ctx)
{
cl_error_t ret = CL_CLEAN;
Expand Down
4 changes: 1 addition & 3 deletions libclamav_rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ fn execute_bindgen() -> Result<(), &'static str> {
// are probably not the same when generated as when compiled.
.layout_tests(false)
// Enable bindgen to find generated headers in the build directory, too.
.clang_arg(build_include_path)
// Hack to include 3rd party C libary headers
.clang_arg("-I/home/micah/.mussels/install/host-static/include");
.clang_arg(build_include_path);

for &include_path in BINDGEN_INCLUDE_PATHS {
builder = builder.clang_arg(include_path);
Expand Down

0 comments on commit e407e48

Please sign in to comment.