From b0567414f1cbb35b0751a9b51fb9af2d6affebe0 Mon Sep 17 00:00:00 2001
From: Vlad Ungureanu <vladu@palantir.com>
Date: Tue, 5 Jul 2022 23:24:56 +0000
Subject: [PATCH] Add support for excluded file paths

---
 clamd.go | 1 +
 conn.go  | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/clamd.go b/clamd.go
index 5199f63..8938d2d 100644
--- a/clamd.go
+++ b/clamd.go
@@ -36,6 +36,7 @@ import (
 const (
 	RES_OK          = "OK"
 	RES_FOUND       = "FOUND"
+	RES_EXCLUDED    = "Excluded"
 	RES_ERROR       = "ERROR"
 	RES_PARSE_ERROR = "PARSE ERROR"
 )
diff --git a/conn.go b/conn.go
index 5c9f7f9..7b2c2d7 100644
--- a/conn.go
+++ b/conn.go
@@ -41,7 +41,7 @@ const CHUNK_SIZE = 1024
 const TCP_TIMEOUT = time.Second * 2
 
 var resultRegex = regexp.MustCompile(
-	`^(?P<path>[^:]+): ((?P<desc>[^:]+)(\((?P<virhash>([^:]+)):(?P<virsize>\d+)\))? )?(?P<status>FOUND|ERROR|OK)$`,
+	`^(?P<path>[^:]+): ((?P<desc>[^:]+)(\((?P<virhash>([^:]+)):(?P<virsize>\d+)\))? )?(?P<status>FOUND|ERROR|OK|Excluded)$`,
 )
 
 type CLAMDConn struct {
@@ -140,6 +140,7 @@ func parseResult(line string) *ScanResult {
 			switch matches[i] {
 			case RES_OK:
 			case RES_FOUND:
+			case RES_EXCLUDED:
 			case RES_ERROR:
 				break
 			default: