Bug 214573 - security/clamav-unofficial-sigs displays errors about prohibited character in host command
Summary: security/clamav-unofficial-sigs displays errors about prohibited character in...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Kurt Jaeger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-16 14:44 UTC by patpro
Modified: 2017-05-21 07:22 UTC (History)
2 users (show)

See Also:


Attachments
Patch that fixes the problem with sed regex (2.18 KB, patch)
2016-11-18 10:36 UTC, Marko Njezic
sf: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description patpro 2016-11-16 14:44:57 UTC
When running clamav-unofficial-sigs.sh (from crontab in my case), the script displays those errors:

host: convert UTF-8 textname to IDN encoding: prohibited character found
host: convert UTF-8 textname to IDN encoding: prohibited character found

The host command is called twiec in the script and its output is parsed with sed.
Apparently this parsing is not enough, and when data is fed back into host, it triggers the error.

I've patched clamav-unofficial-sigs.sh by changing the sed regex from .*\s to .*[ \t] as show in the diff below:

--- /usr/local/bin/clamav-unofficial-sigs.sh	2016-11-06 17:24:31.000000000 +0100
+++ /tmp/clamav-unofficial-sigs-new.sh	2016-11-16 15:28:42.609203000 +0100
@@ -1881,11 +1881,11 @@
         xshok_pretty_echo_and_log "Sanesecurity Database & GPG Signature File Updates" "="
         xshok_pretty_echo_and_log "Checking for Sanesecurity updates..."
 
-        sanesecurity_mirror_ips=$(host "$sanesecurity_url" | sed 's/.*\s//')
+        sanesecurity_mirror_ips=$(host "$sanesecurity_url" | sed 's/.*[ \t]//')
 
         if [ "$(xshok_array_count  "$sanesecurity_mirror_ips")" -ge "1" ] ; then
           for sanesecurity_mirror_ip in $sanesecurity_mirror_ips ; do
-            sanesecurity_mirror_name=$(host "$sanesecurity_mirror_ip" | sed 's/.*\s//' | sed 's/\.$//')
+            sanesecurity_mirror_name=$(host "$sanesecurity_mirror_ip" | sed 's/.*[ \t]//' | sed 's/\.$//')
             sanesecurity_mirror_site_info="$sanesecurity_mirror_name $sanesecurity_mirror_ip"
             xshok_pretty_echo_and_log "Sanesecurity mirror site used: $sanesecurity_mirror_site_info"
             $rsync_bin $rsync_output_level $no_motd --files-from="$sanesecurity_include_dbs" -ctuz $connect_timeout --timeout="$rsync_max_time" "rsync://$sanesecurity_mirror_ip/sanesecurity" "$work_dir_sanesecurity" 2>/dev/null


That's enough to fix the problem.
Comment 1 Marko Njezic 2016-11-18 10:36:27 UTC
Created attachment 177137 [details]
Patch that fixes the problem with sed regex

Thanks for reporting the problem.

It is better to use character class matching inside sed regex.

I have attached SVN diff that should be used to update the port.
Comment 2 commit-hook freebsd_committer freebsd_triage 2016-12-15 06:34:32 UTC
A commit references this bug:

Author: pi
Date: Thu Dec 15 06:33:34 UTC 2016
New revision: 428603
URL: https://svnweb.freebsd.org/changeset/ports/428603

Log:
  security/clamav-unofficial-sigs: fix regexp problems

  PR:		214573
  Submitted by:	Marko Njezic <sf@maxempire.com> (maintainer)
  Reported by:	freebsdbug@patpro.net

Changes:
  head/security/clamav-unofficial-sigs/Makefile
  head/security/clamav-unofficial-sigs/files/patch-clamav-unofficial-sigs.sh
Comment 3 Kurt Jaeger freebsd_committer freebsd_triage 2017-05-21 07:22:58 UTC
Committed 6 months ago, ups.