Correctly get the last virus name

0.98.2
Shawn Webb 12 years ago
parent 2d6361a9d0
commit b79ea1a382
  1. 2
      libclamav/matcher.c
  2. 19
      libclamav/www.c

@ -532,7 +532,7 @@ int cli_checkfp(unsigned char *digest, size_t size, cli_ctx *ctx)
ctx->engine->cb_hash(fmap_fd(*ctx->fmap), size, md5, cli_get_last_virus(ctx), ctx->cb_ctx);
if (ctx->engine->cb_stats_add_sample)
ctx->engine->cb_stats_add_sample(virname, digest, size, WHOLEFILE, ctx->engine->stats_data);
ctx->engine->cb_stats_add_sample(cli_get_last_virus(ctx), digest, size, WHOLEFILE, ctx->engine->stats_data);
return CL_VIRUS;
}

@ -108,8 +108,9 @@ void submit_post(const char *host, const char *port, const char *url, const char
bufsz = sizeof("POST HTTP/1.1") + 1; /* Yes. Three blank spaces. +1 for the \n */
bufsz += strlen(url);
bufsz += sizeof("Host: ");
bufsz += strlen(host) + 1; /* +1 for the \n */
bufsz += sizeof("Host: \n");
bufsz += strlen(host);
bufsz += sizeof("Connection: Close\n");
bufsz += sizeof("Content-Type: application/x-www-form-urlencoded\n");
bufsz += sizeof("Content-Length: \n") + 10;
bufsz += 2; /* +2 for \n\n */
@ -124,6 +125,7 @@ void submit_post(const char *host, const char *port, const char *url, const char
snprintf(buf, bufsz, "POST %s HTTP/1.1\n", url);
snprintf(buf+strlen(buf), bufsz-strlen(buf), "Host: %s\n", host);
snprintf(buf+strlen(buf), bufsz-strlen(buf), "Connection: Close\n");
snprintf(buf+strlen(buf), bufsz-strlen(buf), "Content-Type: application/x-www-form-urlencoded\n");
snprintf(buf+strlen(buf), bufsz-strlen(buf), "Content-Length: %u\n\n", (unsigned int)(strlen(encoded) + sizeof("postdata=") - 1));
snprintf(buf+strlen(buf), bufsz-strlen(buf), "postdata=%s", encoded);
@ -141,6 +143,19 @@ void submit_post(const char *host, const char *port, const char *url, const char
send(sockfd, buf, strlen(buf), 0);
while (1) {
memset(buf, 0x00, bufsz);
if (recv(sockfd, buf, bufsz, 0) <= 0)
break;
if (strstr(buf, "STATOK"))
break;
cli_warnmsg("---- Received ----\n");
cli_warnmsg("%s\n", buf);
cli_warnmsg("---- End data received ----\n");
}
close(sockfd);
free(buf);
}

Loading…
Cancel
Save