Browse code

fix scandash spam

git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4646 77e5149b-7576-45b1-b177-96237e5ba77b

aCaB authored on 2009/01/25 00:23:54
Showing 1 changed files
... ...
@@ -69,7 +69,7 @@ enum {
69 69
     FILDES
70 70
 };
71 71
 
72
-static const char *scancmd[] = { "CONTSCAN", "MULTISCAN", "STREAM", "FILDES" };
72
+static const char *scancmd[] = { "CONTSCAN", "MULTISCAN" };
73 73
 
74 74
 static void (*action)(const char *) = NULL;
75 75
 static char *actarget;
... ...
@@ -284,6 +284,7 @@ static int dsresult(int sockd, int scantype, const char *filename)
284 284
 	    waserror = 1;
285 285
 	    break;
286 286
 	}
287
+	if(!filename) logg("~%s\n", bol);
287 288
 	if(len > 7) {
288 289
 	    char *colon = colon = strrchr(bol, ':');
289 290
 	    if(!colon) {
... ...
@@ -291,20 +292,24 @@ static int dsresult(int sockd, int scantype, const char *filename)
291 291
 		waserror = 1;
292 292
 	    } else if(!memcmp(eol - 7, " FOUND", 6)) {
293 293
 		infected++;
294
-		if(scantype >= STREAM) {
295
-		    logg("~%s%s\n", filename, colon);
296
-		    if(action) action(filename);
297
-		} else {
298
-		    logg("~%s\n", bol);
299
-		    *colon = '\0';
300
-		    if(action)
301
-			action(bol);
294
+		if(filename) {
295
+		    if(scantype >= STREAM) {
296
+			logg("~%s%s\n", filename, colon);
297
+			if(action) action(filename);
298
+		    } else {
299
+			logg("~%s\n", bol);
300
+			*colon = '\0';
301
+			if(action)
302
+			    action(bol);
303
+		    }
302 304
 		}
303 305
 	    } else if(!memcmp(eol-7, " ERROR", 6)) {
304
-		if(scantype >= STREAM)
305
-		    logg("~%s%s\n", filename, colon);
306
-		else
307
-		    logg("~%s\n", bol);
306
+		if(filename) {
307
+		    if(scantype >= STREAM)
308
+			logg("~%s%s\n", filename, colon);
309
+		    else
310
+			logg("~%s\n", bol);
311
+		}
308 312
 		waserror = 1;
309 313
 	    }
310 314
 	}
... ...
@@ -562,11 +567,10 @@ int client(const struct optstruct *opts, int *infected)
562 562
 
563 563
     if(scandash) {
564 564
 	int sockd, ret;
565
-	if((sockd = dconnect()) >= 0 && (ret = dsresult(sockd, scantype, NULL)) >= 0) {
566
-	    *infected += ret;
567
-	} else {
565
+	if((sockd = dconnect()) >= 0 && (ret = dsresult(sockd, scantype, NULL)) >= 0)
566
+	    *infected = ret;
567
+	else
568 568
 	    errors++;
569
-	}
570 569
 	close(sockd);
571 570
     } else if(opts->filename) {
572 571
 	unsigned int i;