summaryrefslogtreecommitdiff
path: root/security/portaudit/files/portaudit.functions
diff options
context:
space:
mode:
Diffstat (limited to 'security/portaudit/files/portaudit.functions')
-rw-r--r--security/portaudit/files/portaudit.functions23
1 files changed, 23 insertions, 0 deletions
diff --git a/security/portaudit/files/portaudit.functions b/security/portaudit/files/portaudit.functions
new file mode 100644
index 000000000000..29d09ba5fb26
--- /dev/null
+++ b/security/portaudit/files/portaudit.functions
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+extract_auditfile()
+{
+ tar -jxOf "${portaudit_file}" auditfile
+}
+
+checksum_auditfile()
+{
+ chksum1=`extract_auditfile |
+ sed -nEe '$s/^#CHECKSUM: *MD5 *([0-9a-f]{32})$/\1/p'`
+ chksum2=`extract_auditfile | sed -e '$d' | md5`
+ [ "${chksum1}" != "${chksum2}" ];
+}
+
+checkexpiry_auditfile()
+{
+ created=`extract_auditfile |
+ sed -nEe '1s/^#CREATED: *([0-9]{4})-?([0-9]{2})-?([0-9]{2}).*$/\1\2\3/p'`
+ expiry=`date -u -v-$1d '+%Y%m%d'`
+ [ "${created}" -lt "${expiry}" ];
+}
+