samba3-vscan/clamav .cvsignore,1.1.1.1,1.2 vscan-clamav.c,1.1.1.1,1.2 vscan-clamav.h,1.1.1.1,1.2 vscan-clamav_core.c,1.1.1.1,1.2

Rainer Link <[email protected]> Sat, 23 Jul 2005 14:47:47 +0000
Newsgroups gmane.comp.security.virus.openantivirus.cvs
Message-ID <[email protected]>
Update of /cvsroot/openantivirus/samba3-vscan/clamav
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8372/clamav

Modified Files:
	.cvsignore vscan-clamav.c vscan-clamav.h vscan-clamav_core.c 
Log Message:
remove Samba 2.2 support, Samba3 is from now on supported only


Index: vscan-clamav.h
===================================================================
RCS file: /cvsroot/openantivirus/samba3-vscan/clamav/vscan-clamav.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- vscan-clamav.h	23 Jul 2005 14:33:54 -0000	1.1.1.1
+++ vscan-clamav.h	23 Jul 2005 14:47:45 -0000	1.2
@@ -6,9 +6,6 @@
 
 /* Configuration Section :-) */
 
-/* default location of samba-style configuration file (needs Samba >= 2.2.4
- or Samba 3.0 */
-
 #define PARAMCONF "/etc/samba/vscan-clamav.conf"
 
 /* Clam AntiVirus (clamd) stuff:


Index: vscan-clamav.c
===================================================================
RCS file: /cvsroot/openantivirus/samba3-vscan/clamav/vscan-clamav.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- vscan-clamav.c	23 Jul 2005 14:33:55 -0000	1.1.1.1
+++ vscan-clamav.c	23 Jul 2005 14:47:45 -0000	1.2
@@ -1,10 +1,10 @@
 /*
  * $Id$
  * 
- * virusscanning VFS module for samba.  Log infected files via syslog
+ * virusscanning VFS module for Samba3.  Log infected files via syslog
  * facility and block access using Clam AntiVirus Daemon.
  *
- * Copyright (C) Rainer Link, 2001-2004
+ * Copyright (C) Rainer Link, 2001-2005
  *               OpenAntiVirus.org <rainer-pBPPa8WU5k41Tgt60Rntydi2O/[email protected]>
  *               Dariusz Markowicz <[email protected]>, 2003
  * Copyright (C) Stefan (metze) Metzmacher, 2003
@@ -116,27 +116,15 @@
 
 /* Implementation of vfs_ops.  */
 
-#if (SMB_VFS_INTERFACE_VERSION >= 6)
 static int vscan_connect(vfs_handle_struct *handle, connection_struct *conn, const char *svc, const char *user)
-#else
-static int vscan_connect(struct connection_struct *conn, PROTOTYPE_CONST char *svc, PROTOTYPE_CONST char *user)
-#endif
 {
         fstring config_file;            /* location of config file, either
                                            PARAMCONF or as set via vfs options
                                         */
+	int retval;
 
-	#if (SAMBA_VERSION_MAJOR==2 && SAMBA_VERSION_RELEASE>=4) || SAMBA_VERSION_MAJOR==3
-	 #if !(SMB_VFS_INTERFACE_VERSION >= 6)
-          pstring opts_str;
-          PROTOTYPE_CONST char *p;
-	 #endif
-	#endif
-        int retval;
 
-#if (SMB_VFS_INTERFACE_VERSION >= 6)
         vscan_syslog("samba-vscan (%s) connected (Samba 3.0), (c) by Rainer Link, OpenAntiVirus.org", module_id);
-#endif
 
 	/* set default value for configuration files */
 	fstrcpy(config_file, PARAMCONF);
@@ -161,20 +149,17 @@
 	vscan_syslog("INFO: connect to service %s by user %s", 
 	       svc, user);
 
-	#if (SAMBA_VERSION_MAJOR==2 && SAMBA_VERSION_RELEASE>=4) || SAMBA_VERSION_MAJOR==3
-
-          fstrcpy(config_file, get_configuration_file(conn, VSCAN_MODULE_STR, PARAMCONF));
-          DEBUG(3, ("configuration file is: %s\n", config_file));
+	fstrcpy(config_file, get_configuration_file(conn, VSCAN_MODULE_STR, PARAMCONF));
+        DEBUG(3, ("configuration file is: %s\n", config_file));
 
-          retval = pm_process(config_file, do_section, do_parameter);
-          DEBUG(10, ("pm_process returned %d\n", retval));
+        retval = pm_process(config_file, do_section, do_parameter);
+        DEBUG(10, ("pm_process returned %d\n", retval));
 
-          /* FIXME: this is lame! */
-          verbose_file_logging = vscan_config.common.verbose_file_logging;
-          send_warning_message = vscan_config.common.send_warning_message;
+        /* FIXME: this is lame! */
+        verbose_file_logging = vscan_config.common.verbose_file_logging;
+        send_warning_message = vscan_config.common.send_warning_message;
 
-	  if (!retval) vscan_syslog("ERROR: could not parse configuration file '%s'. File not found or not read-able. Using compiled-in defaults", config_file);
-	#endif
+	if (!retval) vscan_syslog("ERROR: could not parse configuration file '%s'. File not found or not read-able. Using compiled-in defaults", config_file);
 
 #ifdef LIBCLAMAV
 	/* initialise lib clamav */
@@ -193,19 +178,11 @@
         DEBUG(5, ("init file regexp\n"));
 	fileregexp_init(vscan_config.common.exclude_file_regexp);
 
-	#if (SMB_VFS_INTERFACE_VERSION >= 6)
-	 return SMB_VFS_NEXT_CONNECT(handle, conn, svc, user);
-	#else
-	 return default_vfs_ops.connect(conn, svc, user);
-	#endif
+	return SMB_VFS_NEXT_CONNECT(handle, conn, svc, user);
 
 }
 
-#if (SMB_VFS_INTERFACE_VERSION >= 6)
 static void vscan_disconnect(vfs_handle_struct *handle, connection_struct *conn)
-#else/* Samba 3.0 alphaX */
-static void vscan_disconnect(struct connection_struct *conn)
-#endif
 {
 
 	vscan_syslog("INFO: disconnected");
@@ -217,19 +194,11 @@
         lrufiles_destroy_all();
 	filetype_close();
 
-#if (SMB_VFS_INTERFACE_VERSION >= 6)
 	SMB_VFS_NEXT_DISCONNECT(handle, conn);
-#else
-	default_vfs_ops.disconnect(conn);
-#endif
 }
 
 
-#if (SMB_VFS_INTERFACE_VERSION >= 6)
 static int vscan_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode)
-#else
-static int vscan_open(struct connection_struct *conn, PROTOTYPE_CONST char *fname, int flags, mode_t mode)
-#endif
 {
 	SMB_STRUCT_STAT stat_buf;
 	pstring filepath;
@@ -244,11 +213,7 @@
         if ( !vscan_config.common.scan_on_open ) {
                 DEBUG(3, ("samba-vscan - open: File '%s' not scanned as scan_on_open is not set\n", fname));
         }
-#if (SMB_VFS_INTERFACE_VERSION >= 6)
 	else if ( (SMB_VFS_NEXT_STAT(handle, conn, fname, &stat_buf)) != 0 ) {    /* an error occured */ 
-#else
-	else if ( (default_vfs_ops.stat(conn, fname, &stat_buf)) != 0 ) {    /* an error occured */ 
-#endif
 		if ( errno == ENOENT ) {
 			if ( verbose_file_logging )
 				vscan_syslog("INFO: File %s not found! Not scanned!", fname);
@@ -332,11 +297,7 @@
 			else if ( retval == VSCAN_SCAN_VIRUS_FOUND ) {
 				/* virus found */
 				/* do action ... */
-#if (SMB_VFS_INTERFACE_VERSION >= 6)
 				vscan_do_infected_file_action(handle, conn, filepath, vscan_config.common.quarantine_dir, vscan_config.common.quarantine_prefix, vscan_config.common.infected_file_action);
-#else
-				vscan_do_infected_file_action(&default_vfs_ops, conn, filepath, vscan_config.common.quarantine_dir, vscan_config.common.quarantine_prefix, vscan_config.common.infected_file_action);
-#endif
 
                                 /* add/update file. mark file as infected! */
                                 lrufiles_add(filepath, stat_buf.st_mtime, True);
@@ -376,18 +337,10 @@
 			}
 		}
 	}
-#if (SMB_VFS_INTERFACE_VERSION >= 6)
 	return SMB_VFS_NEXT_OPEN(handle, conn, fname, flags, mode);
-#else
-	return default_vfs_ops.open(conn, fname, flags, mode);
-#endif
 }
 
-#if (SMB_VFS_INTERFACE_VERSION >= 6)
 static int vscan_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
-#else
-static int vscan_close(struct files_struct *fsp, int fd)
-#endif
 {
 	SMB_STRUCT_STAT stat_buf;
 	pstring filepath;
@@ -395,11 +348,7 @@
 	char client_ip[CLIENT_IP_SIZE];
 
         /* First close the file */
-#if (SMB_VFS_INTERFACE_VERSION >= 6)
         retval = SMB_VFS_NEXT_CLOSE(handle, fsp, fd);
-#else
-        retval = default_vfs_ops.close(fsp, fd);
-#endif
 
         /* get the file name */
         pstrcpy(filepath, fsp->conn->connectpath);
@@ -428,11 +377,7 @@
                 if ( vscan_config.common.verbose_file_logging )
                         vscan_syslog("INFO: File '%s' not scanned as file type is on exclude list", filepath);
 	}
-#if (SMB_VFS_INTERFACE_VERSION >= 6)
 	else if ( (SMB_VFS_NEXT_STAT(handle, handle->conn, fsp->fsp_name, &stat_buf)) != 0 ) {    /* an error occured */ 
-#else
-	else if ( (default_vfs_ops.stat(fsp->conn, fsp->fsp_name, &stat_buf)) != 0 ) {    /* an error occured */ 
-#endif
 		if( errno == ENOENT) {
 			if ( vscan_config.common.verbose_file_logging )
 				vscan_syslog("INFO: File %s not found! Not scanned!", fsp->fsp_name);
@@ -461,11 +406,7 @@
 
 		if ( rv == VSCAN_SCAN_VIRUS_FOUND ) {
 			/* virus was found */
-#if (SMB_VFS_INTERFACE_VERSION >= 6)
 			vscan_do_infected_file_action(handle, fsp->conn, filepath, vscan_config.common.quarantine_dir, vscan_config.common.quarantine_prefix, vscan_config.common.infected_file_action);
-#else
-			vscan_do_infected_file_action(&default_vfs_ops, fsp->conn, filepath, vscan_config.common.quarantine_dir, vscan_config.common.quarantine_prefix, vscan_config.common.infected_file_action);
-#endif
 			/* add/update file, mark file as infected! */
 			lrufiles_add(filepath, stat_buf.st_mtime, True);
 		}
@@ -482,8 +423,6 @@
 }
 
 
-#if (SMB_VFS_INTERFACE_VERSION >= 6)
-/* Samba 3.0 */
 NTSTATUS init_module(void)
 {
 	NTSTATUS ret;
@@ -495,100 +434,8 @@
 	
 	return ret;	
 }
-#else
-/* VFS initialisation function.  Return initialised vfs_ops structure
-   back to SAMBA. */
-#if SAMBA_VERSION_MAJOR==3
- /* Samba 3.0 alphaX */
- vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops,
-			struct smb_vfs_handle_struct *vfs_handle)
-#else
- /* Samba 2.2.x */
- #if SAMBA_VERSION_RELEASE>=4   
-  /* Samba 2.2.4 */
-  struct vfs_ops *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops)
- #elif SAMBA_VERSION_RELEASE==2
-  /* Samba 2.2.2 / Samba 2.2.3 !!! */
-  struct vfs_ops *vfs_init(int* Version, struct vfs_ops *ops)
- #elif SAMBA_VERSION_RELEASE==1
-  /* Samba 2.2.1 */
-  struct vfs_ops *vfs_module_init(int *vfs_version)
- #else
-  /* Samba 2.2.0 */
-  struct vfs_ops *vfs_init(int *vfs_version)
- #endif
-#endif
-{
-	#if SAMBA_VERSION_MAJOR!=3
- 	 #if SAMBA_VERSION_RELEASE>=4
-	  /* Samba 2.2.4 */
-	  struct vfs_ops tmp_ops;
-	 #endif
-	#endif
-
-	openlog("smbd_"VSCAN_MODULE_STR, LOG_PID, SYSLOG_FACILITY);
-
-        #if SAMBA_VERSION_MAJOR==3
-         /* Samba 3.0 alphaX */
-         *vfs_version = SMB_VFS_INTERFACE_VERSION;
-         vscan_syslog("samba-vscan (%s) loaded (Samba 3.x), (c) by Rainer Link, OpenAntiVirus.org", module_id);
-        #else
-         /* Samba 2.2.x */
-         #if SAMBA_VERSION_RELEASE>=4
-          /* Samba 2.2.4 */
-          *vfs_version = SMB_VFS_INTERFACE_VERSION;
-          vscan_syslog("samba-vscan (%s) loaded (Samba >=2.2.4), (c) by Rainer Link, OpenAntiVirus.org", module_id);
-         #elif SAMBA_VERSION_RELEASE==2
-          /* Samba 2.2.2 / Samba 2.2.3 !!! */
-          *Version = SMB_VFS_INTERFACE_VERSION;
-          vscan_syslog("samba-vscan (%s) loaded (Samba 2.2.2/2.2.3), (c) by Rainer Link, OpenAntiVirus.org", module_id);
-         #else
-          /* Samba 2.2.1 / Samba 2.2.0 */
-          *vfs_version = SMB_VFS_INTERFACE_VERSION;
-          vscan_syslog("samba-vscan (%s) loaded (Samba 2.2.0/2.2.1), (c) by Rainer Link, OpenAntiVirus.org",
-               module_id);
-         #endif
-        #endif
-
-
-	#if SAMBA_VERSION_MAJOR==3
-         /* Samba 3.0 alphaX */
-	 DEBUG(3, ("Initialising default vfs hooks\n"));
-         memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops));
-
-         /* Remember vfs_handle for further allocation and referencing of 
-	    private information in vfs_handle->data
-         */
-	 vscan_handle = vfs_handle;
-	 return vscan_ops;
-        #else
-         /* Samba 2.2.x */
-	 #if SAMBA_VERSION_RELEASE>=4
-	  /* Samba 2.2.4 */
 
-	  *vfs_version = SMB_VFS_INTERFACE_VERSION;
-	  memcpy(&tmp_ops, def_vfs_ops, sizeof(struct vfs_ops));
-	  tmp_ops.connect = vscan_connect;
-	  tmp_ops.disconnect = vscan_disconnect;
-	  tmp_ops.open = vscan_open;
-	  tmp_ops.close = vscan_close;
-	  memcpy(&vscan_ops, &tmp_ops, sizeof(struct vfs_ops));
-	  return(&vscan_ops);
-
-	 #else
-          /* Samba 2.2.3-2.2.0 */
-          return(&vscan_ops);
-	 #endif
-	#endif
-}
-
-
-#if SAMBA_VERSION_MAJOR==3
-/* VFS finalization function */
 void vfs_done(connection_struct *conn)
 {
         DEBUG(3, ("Finalizing default vfs hooks\n"));
 }
-#endif
-
-#endif /* #if (SMB_VFS_INTERFACE_VERSION >= 6) */




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click