|
|
@ -35,9 +35,10 @@
|
|
|
|
#include <pwd.h>
|
|
|
|
#include <pwd.h>
|
|
|
|
#include <clamav.h>
|
|
|
|
#include <clamav.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "options.h"
|
|
|
|
|
|
|
|
#include "defaults.h"
|
|
|
|
#include "defaults.h"
|
|
|
|
#include "memory.h"
|
|
|
|
#include "memory.h"
|
|
|
|
|
|
|
|
#include "options.h"
|
|
|
|
|
|
|
|
#include "output.h"
|
|
|
|
#include "../version.h"
|
|
|
|
#include "../version.h"
|
|
|
|
#include "../../config.h"
|
|
|
|
#include "../../config.h"
|
|
|
|
|
|
|
|
|
|
|
@ -75,6 +76,10 @@ struct s_info claminfo;
|
|
|
|
short printinfected = 0;
|
|
|
|
short printinfected = 0;
|
|
|
|
/* short int mprintf_stdout; */
|
|
|
|
/* short int mprintf_stdout; */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern int client(const char *dirname, struct optstruct *opt, const char **virname);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int spoolstdin(char *tmpnm, int fd, int ret, const char **virname, const char **bndrystore, struct optstruct *opt);
|
|
|
|
|
|
|
|
|
|
|
|
int clamdscan(struct optstruct *opt)
|
|
|
|
int clamdscan(struct optstruct *opt)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int ds, dms;
|
|
|
|
int ds, dms;
|
|
|
@ -94,7 +99,8 @@ int clamdscan(struct optstruct *opt)
|
|
|
|
char buff[BUFFSIZE];
|
|
|
|
char buff[BUFFSIZE];
|
|
|
|
struct cl_node *trie = NULL;
|
|
|
|
struct cl_node *trie = NULL;
|
|
|
|
int threads = 0;
|
|
|
|
int threads = 0;
|
|
|
|
int fd, fdtmp, ret, no = 0;
|
|
|
|
int fd, fdtmp, ret;
|
|
|
|
|
|
|
|
unsigned int no = 0;
|
|
|
|
unsigned long int size = 0;
|
|
|
|
unsigned long int size = 0;
|
|
|
|
long double mb;
|
|
|
|
long double mb;
|
|
|
|
const char *virname;
|
|
|
|
const char *virname;
|
|
|
@ -175,7 +181,7 @@ int clamdscan(struct optstruct *opt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Clamd isn't running, scan the file ourselves */
|
|
|
|
/* Clamd isn't running, scan the file ourselves */
|
|
|
|
if((ret == 2)) {
|
|
|
|
if(ret == 2) {
|
|
|
|
/* Clamd isn't running, start it so it is available next time. */
|
|
|
|
/* Clamd isn't running, start it so it is available next time. */
|
|
|
|
startclamd(opt);
|
|
|
|
startclamd(opt);
|
|
|
|
|
|
|
|
|
|
|
@ -220,7 +226,7 @@ int clamdscan(struct optstruct *opt)
|
|
|
|
options.general |= CL_SCAN_GENERAL_HEURISTICS;
|
|
|
|
options.general |= CL_SCAN_GENERAL_HEURISTICS;
|
|
|
|
options.mail |= CL_SCAN_MAIL_PARTIAL_MESSAGE;
|
|
|
|
options.mail |= CL_SCAN_MAIL_PARTIAL_MESSAGE;
|
|
|
|
ret = cl_scandesc(fd, tmpnm, &virname, &size, engine, &options );
|
|
|
|
ret = cl_scandesc(fd, tmpnm, &virname, &size, engine, &options );
|
|
|
|
printf("scandesc returned: %i\n", cl_strerror(ret));
|
|
|
|
printf("scandesc returned: %s\n", cl_strerror(ret));
|
|
|
|
if( ret == CL_VIRUS )
|
|
|
|
if( ret == CL_VIRUS )
|
|
|
|
printf("virus found\n");
|
|
|
|
printf("virus found\n");
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -233,7 +239,7 @@ int clamdscan(struct optstruct *opt)
|
|
|
|
|
|
|
|
|
|
|
|
spoolstdin(tmpnm, fd, ret, &virname, &bndrystore, opt);
|
|
|
|
spoolstdin(tmpnm, fd, ret, &virname, &bndrystore, opt);
|
|
|
|
|
|
|
|
|
|
|
|
if((ret == 2))
|
|
|
|
if(ret == 2)
|
|
|
|
cl_engine_free(engine);
|
|
|
|
cl_engine_free(engine);
|
|
|
|
|
|
|
|
|
|
|
|
unlink(tmpnm);
|
|
|
|
unlink(tmpnm);
|
|
|
@ -241,7 +247,7 @@ int clamdscan(struct optstruct *opt)
|
|
|
|
mexit(0);
|
|
|
|
mexit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int spoolstdin(char *tmpnm, int fd, int ret, char **virname, const char **bndrystore, struct optstruct *opt)
|
|
|
|
int spoolstdin(char *tmpnm, int fd, int ret, const char **virname, const char **bndrystore, struct optstruct *opt)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int bytes;
|
|
|
|
int bytes;
|
|
|
|
int i, j;
|
|
|
|
int i, j;
|
|
|
|