summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2018-09-23 20:00:02 -0400
committerbill-auger <mr.j.spam.me@gmail.com>2018-10-02 19:02:25 -0400
commit89d7feaec16c19908052801075196d4207ac9f03 (patch)
tree027ec3985dfe65af92b895e55e0555089a6f0cb2
parentb4ec730abb1dafde977ed88225fcd1627a6ab4ee (diff)
pass shared lib errors through spam filter
-rw-r--r--lib/main.sh1
-rw-r--r--modules/m_spamfilter.sh16
-rw-r--r--process_event2
3 files changed, 17 insertions, 2 deletions
diff --git a/lib/main.sh b/lib/main.sh
index 4c11672..562f240 100644
--- a/lib/main.sh
+++ b/lib/main.sh
@@ -437,6 +437,7 @@ while true; do
sender="${BASH_REMATCH[1]}"
target="${BASH_REMATCH[2]}"
query="${BASH_REMATCH[3]}"
+
# Check if there is a command.
commands_call_command "$sender" "$target" "$query"
# Check return code
diff --git a/modules/m_spamfilter.sh b/modules/m_spamfilter.sh
index 115621f..3b62f0e 100644
--- a/modules/m_spamfilter.sh
+++ b/modules/m_spamfilter.sh
@@ -41,6 +41,10 @@ readonly ASCII_SET_REGEX='[^ -~]'
readonly ASCII_ART_REGEX='[^A-Za-z0-9]{4}'
readonly GIBBERISH_REGEX='[^\ ]{12}'
+# shared lib error regexes
+readonly SO_NAME_REGEX='.*\.so[^\ ]*: '
+readonly SHARED_LIBS_ERROR=': error while loading shared libraries: '
+
# known spam constants
readonly SPAM=(
'blog by freenode staff'
@@ -140,7 +144,7 @@ DBG_SPAMFILTER_CRITERIA
then was_handled=0
# ignore chat that is known spam or otherwise nonsense
- elif is_nonsense "${query}" || is_spam "${query}"
+ elif (is_nonsense "${query}" && ! is_shared_lib_error "${query}") || is_spam "${query}"
then was_handled=1
DBG_SPAMFILTER
@@ -199,6 +203,15 @@ is_nonsense() # (chat_msg)
[[ "${chat_msg}" =~ ${GIBBERISH_REGEX} ]]
}
+is_shared_lib_error() # (chat_msg)
+{
+ local chat_msg=$1
+
+ # pass long .so names that trigger the GIBBERISH_REGEX
+ [[ "${chat_msg}" =~ ${SHARED_LIBS_REGEX}${GIBBERISH_REGEX} ]] && \
+ [[ "${chat_msg}" =~ ${SHARED_LIBS_REGEX}${SO_NAME_REGEX} ]]
+}
+
is_spam() # (chat_msg)
{
local needle=$1
@@ -225,6 +238,7 @@ DBG_SPAMFILTER_CRITERIA()
echo -n "[SPAMFILTER]: sender='${sender}'" ; is_internal_user "${sender}" && echo -n " => from internal user - returning" ; echo ;
echo -n "[SPAMFILTER]: query='${query}'" ; is_public_chat "${sender}" "${query}" && echo -n " => from registered user - returning" ;
is_nonsense "${query}" && echo -n " => is nonsense - returning" ;
+ is_shared_lib_error "${query}" && echo -n " => is shared lib error - returning" ;
is_spam "${query}" && echo -n " => is known spam - returning" ; echo ;
}
DBG_SPAMFILTER() { (( ${DEBUG} )) && echo "[SPAMFILTER]: !!!triggered!!! sender=${sender}" ; }
diff --git a/process_event b/process_event
index 396982a..adea311 100644
--- a/process_event
+++ b/process_event
@@ -155,7 +155,7 @@ function process_event
if ! (( rec_recent ))
then
- send_msg "${channel_it_came_from}" "${person}: please report a bug, specifying the exact error message, package of the failing command and architecture: http://labs.parabola.nu"
+ send_msg "${channel_it_came_from}" "${person}: please report a bug, specifying the exact error message, the name of the program, and your architecture: https://labs.parabola.nu/projects/issue-tracker/issues?set_filter=1&tracker_id=1"
touch "${sharlibsrecfile}"
fi
fi