- clamd.patch: Similar change as clamscan to allow support for win32 paths
with the SCAN verb. Also works around a bug in recvmsg() which is new in
Interix 5.2, but doesn't currently work.
diff -ur clamav-0.88.2/clamd/others.c clamav-0.88.2-interix/clamd/others.c
--- clamav-0.88.2/clamd/others.c Mon Apr 10 05:38:31 2006
+++ clamav-0.88.2-interix/clamd/others.c Mon Jun 5 15:33:33 2006
@@ -264,6 +264,11 @@
return count;
}
+/* [EMAIL PROTECTED]: recvmsg() is new in Interix 5.2 but doesn't
work properly. It
+always returns -1 with errno 41 for some reason. we need to continue to
redefine readsock to read()
+for now. */
+#ifndef __INTERIX
+
/* Submitted by Richard Lyons <frob-clamav*webcentral.com.au> */
#if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) ||
defined(HAVE_CONTROL_IN_MSGHDR)) && !defined(C_CYGWIN) && !defined(C_OS2) &&
!defined(INCOMPLETE_CMSG)
@@ -326,3 +331,4 @@
return n;
}
#endif
+#endif /*Interix*/
\ No newline at end of file
diff -ur clamav-0.88.2/clamd/others.h clamav-0.88.2-interix/clamd/others.h
--- clamav-0.88.2/clamd/others.h Thu Dec 22 20:25:22 2005
+++ clamav-0.88.2-interix/clamd/others.h Mon Jun 5 15:34:59 2006
@@ -21,8 +21,13 @@
#if HAVE_CONFIG_H
#include "clamav-config.h"
+# ifdef __INTERIX
+# undef HAVE_POLL_H
+# undef HAVE_POLL
+# endif
#endif
+
#include <stdlib.h>
#include "cfgparser.h"
@@ -31,7 +36,10 @@
void virusaction(const char *filename, const char *virname, const struct
cfgstruct *copt);
int writen(int fd, void *buff, unsigned int count);
-#if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) ||
defined(HAVE_CONTROL_IN_MSGHDR)) && !defined(C_CYGWIN) && !defined(C_OS2) &&
!defined(INCOMPLETE_CMSG)
+/* [EMAIL PROTECTED]: recvmsg() is new in Interix 5.2 but doesn't
work properly. It
+always returns -1 with errno 41 for some reason. we need to continue to
redefine readsock to read()
+for now. */
+#if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) ||
defined(HAVE_CONTROL_IN_MSGHDR)) && !defined(C_CYGWIN) && !defined(C_OS2)
&&!defined(INCOMPLETE_CMSG) && !defined(__INTERIX)
int readsock(int sockfd, char *buf, size_t size);
#else
#define readsock read
diff -ur clamav-0.88.2/clamd/scanner.c clamav-0.88.2-interix/clamd/scanner.c
--- clamav-0.88.2/clamd/scanner.c Sun Mar 26 14:37:19 2006
+++ clamav-0.88.2-interix/clamd/scanner.c Tue May 16 15:42:46 2006
@@ -42,6 +42,17 @@
#include <stddef.h>
#endif
+#ifdef __INTERIX
+# include <errno.h>
+# include <interix/interix.h>
+# ifndef TRUE
+# define TRUE 1
+# endif
+# ifndef FALSE
+# define FALSE 0
+# endif
+#endif
+
#include "cfgparser.h"
#include "others.h"
#include "scanner.h"
@@ -199,11 +210,42 @@
int scan(const char *filename, unsigned long int *scanned, const struct
cl_node *root, const struct cl_limits *limits, int options, const struct
cfgstruct *copt, int odesc, short contscan)
{
+ #ifdef __INTERIX
+ /* Need these to handle win32-style paths passed to the Interix
subsystem on NT 5.x+*/
+ int iswinpath = FALSE;
+ char c;
+ char *srch;
+ #endif
+
struct stat sb;
int ret = 0;
unsigned int reclev = 0;
const char *virname;
+
+ #ifdef __INTERIX
+ /* This block is to handle convertint win32-style paths to POSIX
paths
+ on the Interix subsystem on NT 5.x+. */
+ srch = filename;
+ while( (c = *srch++) != '\0' )
+ {
+ if( c == '\\' || c == ':' )
+ {
+ iswinpath = TRUE;
+ break;
+ }
+ }
+ if( iswinpath )
+ {
+ char buff[PATH_MAX];
+ if ( winpath2unix( filename, 0, buff, sizeof(buff) ) != 0 )
+ {
+ mdprintf( odesc, "\"%s\": winpath2unix() failed.
ERROR\n", filename );
+ return errno;
+ }
+ filename = buff;
+ }
+ #endif
/* stat file */
if(lstat(filename, &sb) == -1) {
Brian A. Reiter
WolfeReiter, LLC : Thoughtful Computing
[http://www.thoughtfulcomputing.com]
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html