samba-vscan/sophos vscan-sophos_core.c,1.17.2.1,1.17.2.2

Rainer Link <[email protected]> Sun, 02 May 2004 19:45:34 +0000
Newsgroups gmane.comp.security.virus.openantivirus.cvs
Message-ID <[email protected]>
Update of /cvsroot/openantivirus/samba-vscan/sophos
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21244/sophos

Modified Files:
      Tag: VSCAN_0_3
	vscan-sophos_core.c 
Log Message:
started some more code-reorganisation; not finished; could have
broken stuff


Index: vscan-sophos_core.c
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/sophos/vscan-sophos_core.c,v
retrieving revision 1.17.2.1
retrieving revision 1.17.2.2
diff -u -d -r1.17.2.1 -r1.17.2.2
--- vscan-sophos_core.c	14 Jul 2003 13:09:19 -0000	1.17.2.1
+++ vscan-sophos_core.c	2 May 2004 19:45:32 -0000	1.17.2.2
@@ -3,7 +3,7 @@
  * 
  * Core Interface for Sophie
  *
- * Copyright (C) Rainer Link, 2001-2002
+ * Copyright (C) Rainer Link, 2001-2004
  *               OpenAntiVirus.org <rainer-pBPPa8WU5k41Tgt60Rntydi2O/[email protected]>
  *
  * This stuff is heavily based on Sophie by
@@ -27,26 +27,7 @@
 int vscan_sophos_init(void)
 {
 
-        int sockfd;
-        struct sockaddr_un servaddr;
-
-        /* create socket */
-        if (( sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0 ) {
-               vscan_syslog("ERROR: can not create socket!");
-               return -1; 
-        }
-
-        bzero(&servaddr, sizeof(servaddr));
-        servaddr.sun_family = AF_UNIX;
-        safe_strcpy(servaddr.sun_path, sophie_socket_name, sizeof(servaddr.sun_path)-1);
-
-        /* connect to socket */
-        if ( connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr)) < 0 ) {
-                vscan_syslog("ERROR: can not connect to Sophie (socket: '%s')!", sophie_socket_name);
-                return -1;
-        }
-
-    return sockfd;
+	return vscan_unix_socket_init("Sophie", sophie_socket_name);
 
 }
 
@@ -142,10 +123,7 @@
 void vscan_sophos_end(int sockfd)
 {
 
-        /* sockfd == -1 indicates an error while connecting to socket */
-        if ( sockfd >= 0 ) {
-                close(sockfd);
-        }
+	vscan_socket_end(sockfd);
 
 }
 



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click