preliminary ID support, only on engine messages, not clamd messages

git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4672 77e5149b-7576-45b1-b177-96237e5ba77b
0.95
Török Edvin 17 years ago
parent 79b43cf868
commit 937c8ec187
  1. 6
      ChangeLog
  2. 1
      clamd/others.c
  3. 1
      clamd/others.h
  4. 10
      clamd/scanner.c
  5. 1
      clamd/scanner.h
  6. 3
      clamd/server-th.c
  7. 6
      clamd/session.c

@ -1,3 +1,9 @@
Tue Feb 3 23:09:19 EET 2009 (edwin)
------------------------------------
* clamd/others.c, clamd/others.h, clamd/scanner.c, clamd/scanner.h,
clamd/server-th.c, clamd/session.c: preliminary ID support, only on
engine messages, not clamd messages
Tue Feb 3 23:02:49 EET 2009 (edwin)
------------------------------------
* clamd/others.c, clamd/others.h, clamd/server-th.c,

@ -387,6 +387,7 @@ int fds_add(struct fd_data *data, int fd, int listen_only)
data->nfds = n;
data->buf[n-1].fd = -1;
data->buf[n-1].recvfd = -1;
data->buf[n-1].id = 0;
data->buf[n-1].group = NULL;
if (!listen_only) {
data->buf[n-1].bufsize = PATH_MAX+8;

@ -34,6 +34,7 @@ struct fd_buf {
int fd;
int got_newdata;
int recvfd;
int id;
jobgroup_t *group;
};

@ -199,12 +199,18 @@ int scan_callback(struct stat *sb, char *filename, const char *msg, enum cli_ftw
if (ret == CL_VIRUS) {
scandata->infected++;
mdprintf(scandata->odesc, "%s: %s FOUND%c", filename, virname, scandata->term);
if (scandata->id)
mdprintf(scandata->odesc, "%u: %s: %s FOUND%c", scandata->id, filename, virname, scandata->term);
else
mdprintf(scandata->odesc, "%s: %s FOUND%c", filename, virname, scandata->term);
logg("~%s: %s FOUND\n", filename, virname);
virusaction(filename, virname, scandata->opts);
} else if (ret != CL_CLEAN) {
scandata->errors++;
mdprintf(scandata->odesc, "%s: %s ERROR%c", filename, cl_strerror(ret), scandata->term);
if (scandata->id)
mdprintf(scandata->odesc, "%u: %s: %s ERROR%c", scandata->id, filename, cl_strerror(ret), scandata->term);
else
mdprintf(scandata->odesc, "%s: %s ERROR%c", filename, cl_strerror(ret), scandata->term);
logg("~%s: %s ERROR\n", filename, cl_strerror(ret));
if(ret == CL_EMEM) /* stop scanning */
return ret;

@ -34,6 +34,7 @@ struct scan_cb_data {
int infected;
int errors;
int total;
int id;
char term;
const char *toplevel_path;
unsigned long scanned;

@ -800,7 +800,7 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi
conn.thrpool = thr_pool;
conn.engine = engine;
conn.group = buf->group;
conn.id = 0;
conn.id = buf->id;
/* Parse & dispatch commands */
while ((cmd = get_cmd(buf, pos, &cmdlen, &term)) != NULL) {
int rc;
@ -837,6 +837,7 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi
pos += cmdlen+1;
conn.id++;
}
buf->id = conn.id;
buf->group = conn.group;
if (error) {
mdprintf(buf->fd, "ERROR%c", term);

@ -131,6 +131,7 @@ int command(client_conn_t *conn)
data.data = &scandata;
memset(&scandata, 0, sizeof(scandata));
scandata.id = conn->id;
scandata.group = conn->group;
scandata.odesc = desc;
scandata.term = term;
@ -203,7 +204,10 @@ int command(client_conn_t *conn)
}
if (ok + error == total && (error != total)) {
mdprintf(desc, "%s: OK%c", conn->filename, conn->term);
if (conn->id)
mdprintf(desc, "%u: %s: OK%c", conn->id, conn->filename, conn->term);
else
mdprintf(desc, "%s: OK%c", conn->filename, conn->term);
}
return keepopen; /* no error and no 'special' command executed */
}

Loading…
Cancel
Save