aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2005-01-08 23:43:23 +0800
committernectar <nectar@FreeBSD.org>2005-01-08 23:43:23 +0800
commit0132b650a231f2ced5c5cb269d6aafd26041bc0d (patch)
treebb4826a3421961c065f1f717869f190c0085a422 /security
parent017a5e8db418880c26f37e4b53d7c07dc8efba49 (diff)
downloadfreebsd-ports-gnome-0132b650a231f2ced5c5cb269d6aafd26041bc0d.tar.gz
freebsd-ports-gnome-0132b650a231f2ced5c5cb269d6aafd26041bc0d.tar.zst
freebsd-ports-gnome-0132b650a231f2ced5c5cb269d6aafd26041bc0d.zip
Add a target, `newentry', that will insert a VuXML <vuln> template
(including generated VID) to the top of the `vuln.xml' file. This will save a little time when adding new entries. Inspired by: a patch from simon
Diffstat (limited to 'security')
-rw-r--r--security/vuxml/Makefile3
-rw-r--r--security/vuxml/files/newentry.sh65
2 files changed, 68 insertions, 0 deletions
diff --git a/security/vuxml/Makefile b/security/vuxml/Makefile
index 8ac1215c3339..63a1b78ea742 100644
--- a/security/vuxml/Makefile
+++ b/security/vuxml/Makefile
@@ -80,4 +80,7 @@ validate:
tidy:
@${SH} ${FILESDIR}/tidy.sh "${FILESDIR}/tidy.xsl" "${VUXML_FILE}"
+newentry:
+ @${SH} ${FILESDIR}/newentry.sh "${VUXML_FILE}"
+
.include <bsd.port.mk>
diff --git a/security/vuxml/files/newentry.sh b/security/vuxml/files/newentry.sh
new file mode 100644
index 000000000000..449482dffe24
--- /dev/null
+++ b/security/vuxml/files/newentry.sh
@@ -0,0 +1,65 @@
+#! /bin/sh
+vuxml_file="$1"
+if [ -z "${vuxml_file}" ]; then
+ exec >&2
+ echo "Usage: newentry.sh /path/to/vuxml/document"
+ exit 1
+fi
+
+tmp="`mktemp -t vuxml`"
+[ "$?" -eq 0 ] || exit 1
+doclean="yes"
+cleanup() {
+ if [ "${doclean}" = "yes" ]; then
+ rm -f "${tmp}"
+ fi
+}
+trap cleanup EXIT 1 2 13 15
+
+set errexit
+vid="`uuidgen | tr '[:upper:]' '[:lower:]'`"
+discovery="`date -u '+%Y-%m'`-FIXME"
+entry="`date -u '+%Y-%m-%d'`"
+
+awk '/^<\?/,/^<vuxml/ { print }' "${vuxml_file}" >> "${tmp}"
+cat << EOF >> "${tmp}"
+ <vuln vid="${vid}">
+ <topic> -- </topic>
+ <affects>
+ <package>
+ <name></name>
+ <range><lt></lt></range>
+ </package>
+ </affects>
+ <description>
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <p>SO-AND-SO reports:</p>
+ <blockquote cite="INSERT URL HERE">
+ <p>.</p>
+ </blockquote>
+ </body>
+ </description>
+ <references>
+ </references>
+ <dates>
+ <discovery>${discovery}</discovery>
+ <entry>${entry}</entry>
+ </dates>
+ </vuln>
+
+EOF
+awk '/^[[:space:]]+<vuln /,/^NONE$/ { print }' "${vuxml_file}" >> "${tmp}"
+
+set noerrexit
+
+if cp "${tmp}" "${vuxml_file}"; then
+ exec >&2
+ echo "Template entry added. Please edit \`${vuxml_file}'."
+ exit 0
+else
+ doclean="no"
+ exec >&2
+ echo "Could not overwrite \`${vuxml_file}'."
+ echo "Results are left in \`${tmp}'."
+ exit 1
+fi