Browse code

freshclam/manager.c: improve reporting of server failures (bb#777)

git-svn: trunk@4351

Tomasz Kojm authored on 2008/11/07 22:21:53
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Nov  7 13:20:08 CET 2008 (tk)
2
+---------------------------------
3
+ * freshclam/manager.c: improve reporting of server failures (bb#777)
4
+
1 5
 Fri Nov  7 13:28:03 EET 2008 (edwin)
2 6
 ------------------------------------
3 7
  * contrib/clamdtop/clamdtop.c: fix wrong free (thanks Nigel!)
... ...
@@ -665,14 +665,21 @@ int submitstats(const char *clamdcfg, const struct cfgstruct *copt)
665 665
 	    }
666 666
 
667 667
 	    ret = 52;
668
-	    if(strstr(post, "SUBMIT_PERMANENT_FAILURE")) {
668
+	    if((pt = strstr(post, "SUBMIT_PERMANENT_FAILURE"))) {
669 669
 		if(!submitted) {
670
-		    logg("!SubmitDetectionStats: Permanent failure\n");
671 670
 		    permfail = 1;
671
+		    if((pt + 32 <= post + sizeof(post)) && pt[24] == ':')
672
+			logg("!SubmitDetectionStats: Remote server reported permanent failure: %s\n", &pt[25]);
673
+		    else
674
+			logg("!SubmitDetectionStats: Remote server reported permanent failure\n");
675
+		}
676
+	    } else if((pt = strstr(post, "SUBMIT_TEMPORARY_FAILURE"))) {
677
+		if(!submitted) {
678
+		    if((pt + 32 <= post + sizeof(post)) && pt[24] == ':')
679
+			logg("!SubmitDetectionStats: Remote server reported temporary failure: %s\n", &pt[25]);
680
+		    else
681
+			logg("!SubmitDetectionStats: Remote server reported temporary failure\n");
672 682
 		}
673
-	    } else if(strstr(post, "SUBMIT_TEMPORARY_FAILURE")) {
674
-		if(!submitted)
675
-		    logg("!SubmitDetectionStats: Temporary failure\n");
676 683
 	    } else {
677 684
 		if(!submitted)
678 685
 		    logg("!SubmitDetectionStats: Incorrect answer from server\n");