aboutsummaryrefslogtreecommitdiffstats
path: root/cron-sh/functions.sh
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.org>2009-06-26 19:20:19 +0000
committerEugeni Dodonov <eugeni@mandriva.org>2009-06-26 19:20:19 +0000
commit65e2c9e92c8ef52fc6d47348ddd1bf255e069701 (patch)
treec1a17bae95574c827018b72374f4715a5318e366 /cron-sh/functions.sh
parentcf3dd6d78e400692f9d34bb3d5692db4d613906b (diff)
downloadmsec-65e2c9e92c8ef52fc6d47348ddd1bf255e069701.tar
msec-65e2c9e92c8ef52fc6d47348ddd1bf255e069701.tar.gz
msec-65e2c9e92c8ef52fc6d47348ddd1bf255e069701.tar.bz2
msec-65e2c9e92c8ef52fc6d47348ddd1bf255e069701.tar.xz
msec-65e2c9e92c8ef52fc6d47348ddd1bf255e069701.zip
Simplified diff checks.
Diffstat (limited to 'cron-sh/functions.sh')
-rw-r--r--cron-sh/functions.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/cron-sh/functions.sh b/cron-sh/functions.sh
index e987d91..594d703 100644
--- a/cron-sh/functions.sh
+++ b/cron-sh/functions.sh
@@ -37,6 +37,24 @@ FILTER="\(`echo $EXCLUDEDIR | sed -e 's/ /\\\|/g'`\)"
### Functions ###
+Diffcheck() {
+ TODAY="$1"
+ YESTERDAY="$2"
+ DIFF="$3"
+ MESSAGE="$4"
+ if [[ -f ${YESTERDAY} ]]; then
+ if ! diff -u ${YESTERDAY} ${TODAY} > ${DIFF}; then
+ printf "\nSecurity Warning: change in $MESSAGE found :\n" >> ${DIFF}
+ grep '^+' ${DIFF} | grep -vw "^+++ " | sed 's|^.||'|sed -e 's/%/%%/g' | while read file; do
+ printf "\t\t- Newly added $MESSAGE : ${file}\n"
+ done >> ${DIFF}
+ grep '^-' ${DIFF} | grep -vw "^--- " | sed 's|^.||'|sed -e 's/%/%%/g' | while read file; do
+ printf "\t\t- No longer present $MESSAGE : ${file}\n"
+ done >> ${DIFF}
+ fi
+ fi
+}
+
Syslog() {
if [[ ${SYSLOG_WARN} == yes ]]; then
cat ${1} | while read line; do