mirror of
https://github.com/Cisco-Talos/clamav.git
synced 2025-10-19 10:23:17 +00:00
win32#3
This commit is contained in:
parent
b2354dc1e7
commit
4cd80898e6
32 changed files with 49 additions and 145 deletions
|
@ -1,3 +1,7 @@
|
|||
Thu Sep 24 19:22:24 CEST 2009 (acab)
|
||||
------------------------------------
|
||||
* merge a set of win32 patches from Gianluigi Tiesi <sherpya*netfarm.it>
|
||||
|
||||
Thu Sep 24 19:09:38 CEST 2009 (acab)
|
||||
------------------------------------
|
||||
* drop OS/2 "support"
|
||||
|
|
|
@ -26,7 +26,9 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#ifndef _WIN32
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
|
||||
|
|
|
@ -30,18 +30,20 @@
|
|||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#ifdef HAVE_SYS_LIMITS_H
|
||||
#include <sys/limits.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifndef _WIN32
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <utime.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -67,7 +69,9 @@
|
|||
struct sockaddr *mainsa = NULL;
|
||||
int mainsasz;
|
||||
unsigned long int maxstream;
|
||||
#ifndef _WIN32
|
||||
static struct sockaddr_un nixsock;
|
||||
#endif
|
||||
static struct sockaddr_in tcpsock;
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
/* must be first because it may define _XOPEN_SOURCE */
|
||||
#include "shared/fdpassing.h"
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -33,11 +35,13 @@
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifndef _WIN32
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#include "libclamav/others.h"
|
||||
#include "shared/actions.h"
|
||||
|
|
|
@ -30,9 +30,7 @@
|
|||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef C_WINDOWS
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#ifndef _WIN32
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
@ -62,14 +60,14 @@ int main(int argc, char **argv)
|
|||
int ds, dms, ret;
|
||||
double mb, rmb;
|
||||
struct timeval t1, t2;
|
||||
#ifndef C_WINDOWS
|
||||
struct timezone tz;
|
||||
#ifndef _WIN32
|
||||
sigset_t sigset;
|
||||
#endif
|
||||
struct optstruct *opts;
|
||||
const struct optstruct *opt;
|
||||
|
||||
#if !defined(C_WINDOWS) && !defined(C_BEOS)
|
||||
#if !defined(_WIN32) && !defined(C_BEOS)
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGXFSZ);
|
||||
sigprocmask(SIG_SETMASK, &sigset, NULL);
|
||||
|
|
|
@ -29,14 +29,10 @@
|
|||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef C_WINDOWS
|
||||
#include <sys/utime.h>
|
||||
#else
|
||||
#include <dirent.h>
|
||||
#ifndef _WIN32
|
||||
#include <sys/wait.h>
|
||||
#include <utime.h>
|
||||
#endif
|
||||
#ifndef C_WINDOWS
|
||||
#include <dirent.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
@ -323,7 +319,7 @@ int scanmanager(const struct optstruct *opts)
|
|||
char *file, cwd[1024], *pua_cats = NULL;
|
||||
const char *filename;
|
||||
const struct optstruct *opt;
|
||||
#ifndef C_WINDOWS
|
||||
#ifndef _WIN32
|
||||
struct rlimit rlim;
|
||||
#endif
|
||||
|
||||
|
@ -457,7 +453,7 @@ int scanmanager(const struct optstruct *opts)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef C_WINDOWS
|
||||
#ifndef _WIN32
|
||||
if(getrlimit(RLIMIT_FSIZE, &rlim) == 0) {
|
||||
if(rlim.rlim_cur < (rlim_t) cl_engine_get_num(engine, CL_ENGINE_MAX_FILESIZE, NULL))
|
||||
logg("^System limit for file size is lower than engine->maxfilesize\n");
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef C_WINDOWS
|
||||
#ifndef _WIN32
|
||||
#include <sys/wait.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
|
|
@ -40,9 +40,6 @@ int active_children;
|
|||
void execute( const char *type, const char *text, const struct optstruct *opts )
|
||||
{
|
||||
int ret;
|
||||
#ifndef C_WINDOWS
|
||||
pid_t pid;
|
||||
#endif
|
||||
|
||||
if(!optget(opts, "daemon")->enabled) {
|
||||
if(sscanf(text, "EXIT_%d", &ret) == 1) {
|
||||
|
@ -65,7 +62,8 @@ void execute( const char *type, const char *text, const struct optstruct *opts )
|
|||
} else
|
||||
logg("^%s: already %d processes active.\n", type, active_children);
|
||||
#else
|
||||
if ( active_children<MAX_CHILDREN )
|
||||
if ( active_children<MAX_CHILDREN ) {
|
||||
pid_t pid;
|
||||
switch( pid=fork() ) {
|
||||
case 0:
|
||||
if ( -1==system(text) )
|
||||
|
@ -79,9 +77,8 @@ void execute( const char *type, const char *text, const struct optstruct *opts )
|
|||
default:
|
||||
active_children++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
logg("^%s: already %d processes active.\n", type, active_children);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef C_WINDOWS
|
||||
#ifndef _WIN32
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
|
@ -203,7 +203,7 @@ int main(int argc, char **argv)
|
|||
struct sigaction sigact;
|
||||
struct sigaction oldact;
|
||||
#endif
|
||||
#ifndef C_WINDOWS
|
||||
#ifdef HAVE_PWD_H
|
||||
const char *dbowner;
|
||||
struct passwd *user;
|
||||
#endif
|
||||
|
@ -256,7 +256,7 @@ int main(int argc, char **argv)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifdef HAVE_PWD_H
|
||||
/* freshclam shouldn't work with root privileges */
|
||||
dbowner = optget(opts, "DatabaseOwner")->strarg;
|
||||
|
||||
|
@ -419,7 +419,7 @@ int main(int argc, char **argv)
|
|||
|
||||
logg("#freshclam daemon %s (OS: "TARGET_OS_TYPE", ARCH: "TARGET_ARCH_TYPE", CPU: "TARGET_CPU_TYPE")\n", get_version());
|
||||
|
||||
#ifdef C_WINDOWS
|
||||
#ifdef _WIN32
|
||||
signal(SIGINT, daemon_sighandler);
|
||||
terminate = 0;
|
||||
#else
|
||||
|
|
|
@ -43,16 +43,14 @@
|
|||
#include <strings.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#ifndef C_WINDOWS
|
||||
#ifndef _WIN32
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifndef C_WINDOWS
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
|
@ -20,10 +20,6 @@
|
|||
#include "clamav-config.h"
|
||||
#endif
|
||||
|
||||
#ifdef C_WINDOWS
|
||||
#define _USE_32BIT_TIME_T /* FIXME: mirdat.atime assumes 32bit time_t */
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -35,7 +31,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifndef C_WINDOWS
|
||||
#ifndef _WIN32
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
|
|
@ -29,15 +29,13 @@
|
|||
#endif
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#ifndef C_WINDOWS
|
||||
#ifndef _WIN32
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifndef C_WINDOWS
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -46,16 +44,6 @@
|
|||
#include "shared/output.h"
|
||||
#include "libclamav/clamav.h"
|
||||
|
||||
#if (!defined(EALREADY)) && (defined(WSAEALREADY))
|
||||
#define EALREADY WSAEALREADY
|
||||
#endif
|
||||
#if (!defined(EINPROGRESS)) && (defined(WSAEINPROGRESS))
|
||||
#define EINPROGRESS WSAEINPROGRESS
|
||||
#endif
|
||||
#if (!defined(EISCONN)) && (defined(WSAEISCONN))
|
||||
#define EISCONN WSAEISCONN
|
||||
#endif
|
||||
|
||||
#ifdef SO_ERROR
|
||||
|
||||
#ifndef timercmp
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifndef C_WINDOWS
|
||||
#ifndef _WIN32
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
int notify(const char *cfgfile)
|
||||
{
|
||||
char buff[20];
|
||||
#ifndef C_WINDOWS
|
||||
#ifndef _WIN32
|
||||
struct sockaddr_un server;
|
||||
#endif
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
|
@ -66,7 +66,7 @@ int notify(const char *cfgfile)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifndef C_WINDOWS
|
||||
#ifndef _WIN32
|
||||
if((opt = optget(opts, "LocalSocket"))->enabled) {
|
||||
socktype = "UNIX";
|
||||
server.sun_family = AF_UNIX;
|
||||
|
|
|
@ -100,14 +100,6 @@ static char const rcsid[] = "$Id: binhex.c,v 1.23 2007/02/12 20:46:08 njh Exp $"
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
#if HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#else /* HAVE_SYS_MMAN_H */
|
||||
#undef HAVE_MMAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <memory.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
|
@ -33,18 +33,6 @@
|
|||
#endif
|
||||
#include <string.h>
|
||||
|
||||
#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK) || defined(HAVE_PRAGMA_PACK_HPPA)
|
||||
#if HAVE_MMAP
|
||||
#if HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#else /* HAVE_SYS_MMAN_H */
|
||||
#undef HAVE_MMAP
|
||||
#endif /* HAVE_SYS_MMAN_H */
|
||||
#endif /* HAVE_MMAP */
|
||||
#else/* PACKED */
|
||||
#undef HAVE_MMAP
|
||||
#endif
|
||||
|
||||
#include "others.h"
|
||||
#include "mspack.h"
|
||||
#include "cltypes.h"
|
||||
|
|
|
@ -40,14 +40,6 @@
|
|||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if HAVE_MMAP
|
||||
#if HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#else /* HAVE_SYS_MMAN_H */
|
||||
#undef HAVE_MMAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "others.h"
|
||||
#include "htmlnorm.h"
|
||||
|
||||
|
|
|
@ -32,11 +32,6 @@
|
|||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if HAVE_MMAP
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#endif /* HAVE_MMAP */
|
||||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
|
|
@ -301,20 +301,8 @@ static pthread_mutex_t tables_mutex = PTHREAD_MUTEX_INITIALIZER;
|
|||
#endif
|
||||
|
||||
#ifdef NEW_WORLD
|
||||
|
||||
#include "matcher.h"
|
||||
|
||||
#undef PARTIAL_DIR
|
||||
|
||||
#if HAVE_MMAP
|
||||
#if HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#else /* HAVE_SYS_MMAN_H */
|
||||
#undef HAVE_MMAP
|
||||
#endif
|
||||
#else /*HAVE_MMAP*/
|
||||
#undef NEW_WORLD
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEW_WORLD
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#include <sys/mman.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "others.h"
|
||||
|
|
|
@ -31,12 +31,6 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_MMAP
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "others.h"
|
||||
#include "cltypes.h"
|
||||
#include "nsis_bzlib.h"
|
||||
|
|
|
@ -36,14 +36,6 @@
|
|||
#include <stdlib.h>
|
||||
#include "clamav.h"
|
||||
|
||||
#if HAVE_MMAP
|
||||
#if HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#else /* HAVE_SYS_MMAN_H */
|
||||
#undef HAVE_MMAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "cltypes.h"
|
||||
#include "others.h"
|
||||
#include "ole2_extract.h"
|
||||
|
|
|
@ -42,16 +42,8 @@ static char const rcsid[] = "$Id: pdf.c,v 1.61 2007/02/12 20:46:09 njh Exp $";
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
#ifdef C_WINDOWS
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include "clamav.h"
|
||||
#include "others.h"
|
||||
#include "mbox.h"
|
||||
|
|
|
@ -35,18 +35,7 @@
|
|||
#include <sys/param.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#ifndef C_WINDOWS
|
||||
#include <dirent.h>
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_MMAP
|
||||
#if HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#else /* HAVE_SYS_MMAN_H */
|
||||
#undef HAVE_MMAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DCONF_ARCH ctx->dconf->archive
|
||||
#define DCONF_DOC ctx->dconf->doc
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifndef C_WINDOWS
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "clamav.h"
|
||||
|
|
|
@ -34,13 +34,6 @@
|
|||
#include <string.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#if HAVE_MMAP
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#endif /* HAVE_MMAP */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <zlib.h>
|
||||
|
|
|
@ -34,3 +34,6 @@ typedef unsigned int in_addr_t;
|
|||
#define PATHSEP "/"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H)
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#include <utime.h>
|
||||
#include <errno.h>
|
||||
#include <libgen.h>
|
||||
|
||||
|
|
|
@ -31,7 +31,9 @@
|
|||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef _WIN32
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
|
||||
#ifndef __MISC_H
|
||||
#define __MISC_H
|
||||
#ifndef _WIN32
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include "optparser.h"
|
||||
/* Maximum filenames under various systems - njh */
|
||||
#ifndef NAME_MAX /* e.g. Linux */
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#ifndef C_WINDOWS
|
||||
#ifndef _WIN32
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#include <sys/un.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
#include <dirent.h>
|
||||
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue