Browse code

clamdscan side of bb#1429

git-svn: trunk@4872

aCaB authored on 2009/02/28 17:11:04
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Sat Feb 28 09:04:22 CET 2009 (acab)
2
+-----------------------------------
3
+ * clamdscan/proto.c: bail out if the command is rejected (bb#1429)
4
+
1 5
 Thu Feb 26 10:09:21 CET 2009 (acab)
2 6
 -----------------------------------
3 7
  * shared/misc.h: check for in_addr_t (bb#1426)
... ...
@@ -28,6 +28,7 @@
28 28
 #include <unistd.h>
29 29
 #include <string.h>
30 30
 #include <errno.h>
31
+#include <stdlib.h>
31 32
 #include <sys/types.h>
32 33
 #include <sys/stat.h>
33 34
 #include <fcntl.h>
... ...
@@ -114,7 +115,13 @@ int recvln(struct RCVLN *s, char **rbol, char **reol) {
114 114
 		    continue;
115 115
 		}
116 116
 		if(s->r || s->cur!=s->buf) {
117
-		    logg("!Communication error\n");
117
+		    *s->cur = '\0';
118
+		    if(strcmp(s->buf, "UNKNOWN COMMAND\n"))
119
+			logg("!Communication error\n");
120
+		    else {
121
+			logg("!Command rejected by clamd (wrong clamd version?)\n");
122
+			exit(2);
123
+		    }
118 124
 		    return -1;
119 125
 		}
120 126
 		*rbol = NULL;