Skip to content

Commit

Permalink
zimbraHealth: fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
kreatoo committed Jan 5, 2025
1 parent 23cb946 commit 09ab426
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions zimbraHealth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,13 @@ func CheckIpAccess() {
common.LogError("Error creating request: " + err.Error())
}

resp, err = httpClient.Do(req)
resp, err := httpClient.Do(req)

defer resp.Body.Close()

body, err := io.ReadAll(resp.Body)

bodyStr := string(body)

if err != nil {
common.LogError("Error getting response: " + err.Error())
Expand All @@ -213,7 +219,7 @@ func CheckIpAccess() {
return
}

if ! strings.Contains(resp.Contents, message) {
if ! strings.Contains(bodyStr, message) {
common.PrettyPrintStr("Access with IP", true, "accessible")
common.AlarmCheckDown("accesswithip", "Can access to zimbra through plain IP: " + ipAddress, false)
} else {
Expand Down

0 comments on commit 09ab426

Please sign in to comment.