samba-vscan/f-secure vscan-fsav.c,1.1.2.4,1.1.2.5 vscan-fsav_core.c,1.1.2.3,1.1.2.4 vscan-fsav_core.h,1.1.2.2,1.1.2.3

[email protected]
Newsgroups gmane.comp.security.virus.openantivirus.cvs
Message-ID <[email protected]>
Update of /cvsroot/openantivirus/samba-vscan/f-secure
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv557

Modified Files:
      Tag: VSCAN_0_3
	vscan-fsav.c vscan-fsav_core.c vscan-fsav_core.h 
Log Message:
some more fixes to get the module built


Index: vscan-fsav.c
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/f-secure/Attic/vscan-fsav.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -d -r1.1.2.4 -r1.1.2.5
--- vscan-fsav.c	10 Mar 2004 15:59:42 -0000	1.1.2.4
+++ vscan-fsav.c	10 Mar 2004 16:29:03 -0000	1.1.2.5
@@ -496,7 +496,7 @@
 			/* ok, we must check the file */
 
 			/* scan file */
-			retval = fsav_scan(fsav, filepath);
+			retval = fsav_scan(fsav, filepath, client_ip);
 			if (retval == -2 && deny_access_on_minor_error) {
 				/* a minor error occured - deny access */
 				vscan_syslog
@@ -652,7 +652,7 @@
 	if (fsav) {
 		safe_strcpy(client_ip, fsp->conn->client_address,
 			    CLIENT_IP_SIZE - 1);
-		rv = fsav_scan(fsav, filepath);
+		rv = fsav_scan(fsav, filepath, client_ip);
 		if (rv == 1) {
 			/* virus was found */
 #if (SMB_VFS_INTERFACE_VERSION >= 6)

Index: vscan-fsav_core.c
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/f-secure/Attic/vscan-fsav_core.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- vscan-fsav_core.c	10 Mar 2004 15:59:09 -0000	1.1.2.3
+++ vscan-fsav_core.c	10 Mar 2004 16:29:03 -0000	1.1.2.4
@@ -268,7 +268,6 @@
 			    "--standalone", (char *) 0);
 
 		if (rc != 0) {
-			DEBUG(5,
                         vscan_syslog("ERROR: slave cannot execlp %s %s (%i)",
                                binary, strerror(errno), errno);
 		}
@@ -284,14 +283,14 @@
  *  1 if a virus was found
  */
 
-int fsav_scan(fsav_handle * h, char *file)
+int fsav_scan(fsav_handle * h, char *file, char* client_ip)
 {
 	if (!h)
 		return -1;
 
 	DEBUG(5, ("samba-vscan (%s) scan %s\n ", module_id, file));
         if ( verbose_file_logging )
-                vscan_syslog("INFO: Scanning file : '%s'", scan_file);
+                vscan_syslog("INFO: Scanning file : '%s'", file);
 
 	fsav_clean_handle(h);
 
@@ -306,7 +305,7 @@
 		h->rc = 1;
 		 /* FIXME: is parsing of virus name possible based on fsavd resonse?!? */
                 vscan_syslog_alert("ALERT - Scan result: '%s' infected with virus, client: '%s'",
-                        infected_file, client_ip);
+                        file, client_ip);
 	} else {
 		if (h->fail)
 			/* error */
@@ -520,29 +519,47 @@
 	       h->rc));
 	return h->rc;
 }
+
 /**
- * switch the uid, depends on the uid set in the handle
+ * switch the uid , depend on the uid set in the handle
  *
  */
-void fsav_switch_uid(fsav_handle * h) {
+int fsav_switch_uid(fsav_handle * h) {
+	int rc;
 	if (h->connect_uid == -1)
-		return;
+		return 0;
 
 	DEBUG(5,("samba-vscan (%s) switching user uid (%i) euid (%i)\n ",
 	module_id, getuid(),geteuid()));
 
 	if (h->uid == -1) {
 		h->uid = geteuid();
-		seteuid(h->connect_uid);
+		rc=seteuid(h->connect_uid);
 		DEBUG(5,("samba-vscan (%s) switching user from (%i) to (%i)\n ",
- 			module_id, h->connect_uid,h->uid));
+                        module_id, h->connect_uid,h->uid));
+
+	if (rc != 0) {
+		 vscan_syslog("ERROR: cannot switch user rc = %i / %s",
+			rc,strerror(errno));
+		return 1;
+	}
+
 	} else {
 		DEBUG(5,("samba-vscan (%s) switching user back (%i) to (%i)\n ",
- 			module_id, h->connect_uid,h->uid));
-		seteuid(h->uid);
-	  	h->uid = -1;
+                        module_id, h->connect_uid,h->uid));
+		rc=seteuid(h->uid);
+		if (rc != 0) {
+			vscan_syslog("ERROR: cannot switch user rc = %i / %s",
+			rc,strerror(errno));
+			return 1;
+		}
+		h->uid = -1;
 	}
+	return 0;
 }
+
+
+
 /**
  * process
  * 

Index: vscan-fsav_core.h
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/f-secure/Attic/vscan-fsav_core.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- vscan-fsav_core.h	8 Jan 2004 18:41:05 -0000	1.1.2.2
+++ vscan-fsav_core.h	10 Mar 2004 16:29:03 -0000	1.1.2.3
@@ -71,11 +71,11 @@
 void fsav_clean_handle(fsav_handle *h);
 void fsav_socket_create(fsav_handle *h);
 void fsav_socket_name_create(fsav_handle *h);
-void fsav_switch_uid(fsav_handle *h);
 
+int fsav_switch_uid(fsav_handle *h);
 int fsav_connect_handle(fsav_handle *h);
 int fsav_configure(fsav_handle *h,char *option, int value);
-int fsav_scan(fsav_handle *h, char *file);
+int fsav_scan(fsav_handle *h, char *file, char* client_ip);
 int fsav_process(fsav_handle *h);
 
 #endif /* __VSCAN_FSAV_H */



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.