openbsd-ports/security/clamav/patches/patch-clamd_scanner_c
mbalmer fa0e2fef8f Update ClamAV to version 0.93, which fixes mostly security problems, at
least one highly critical (remote). See http://secunia.com/advisories/29000
for details.

Thanks to kurt@ for helping analyzing the threaded code issues.
2008-04-16 19:46:01 +00:00

50 lines
1.5 KiB
Plaintext

$OpenBSD: patch-clamd_scanner_c,v 1.1 2008/04/16 19:46:01 mbalmer Exp $
--- clamd/scanner.c.orig Thu Mar 6 19:41:03 2008
+++ clamd/scanner.c Mon Apr 14 19:13:26 2008
@@ -373,6 +373,45 @@ int scan(const char *filename, unsigned long int *scan
return ret;
}
+/*
+ * This function was readded by mbalmer@openbsd.org. That is the reason
+ * why it is so nicely formatted.
+ */
+int scanfd(const int fd, unsigned long int *scanned,
+ const struct cl_engine *engine, const struct cl_limits *limits,
+ unsigned int options, const struct cfgstruct *copt, int odesc)
+{
+ int ret;
+ const char *virname;
+ struct stat statbuf;
+ char fdstr[32];
+
+
+ if(fstat(fd, &statbuf) == -1)
+ return -1;
+
+ if(!S_ISREG(statbuf.st_mode))
+ return -1;
+
+ snprintf(fdstr, sizeof(fdstr), "fd[%d]", fd);
+
+ ret = cl_scandesc(fd, &virname, scanned, engine, limits, options);
+
+ if(ret == CL_VIRUS) {
+ mdprintf(odesc, "%s: %s FOUND\n", fdstr, virname);
+ logg("%s: %s FOUND\n", fdstr, virname);
+ virusaction(fdstr, virname, copt);
+ } else if(ret != CL_CLEAN) {
+ mdprintf(odesc, "%s: %s ERROR\n", fdstr, cl_strerror(ret));
+ logg("%s: %s ERROR\n", fdstr, cl_strerror(ret));
+ } else {
+ mdprintf(odesc, "%s: OK\n", fdstr);
+ if(logok)
+ logg("%s: OK\n", fdstr);
+ }
+ return ret;
+}
+
int scanstream(int odesc, unsigned long int *scanned, const struct cl_engine *engine, const struct cl_limits *limits, unsigned int options, const struct cfgstruct *copt)
{
int ret, sockfd, acceptd;