2005-01-08 16:43:23 +01:00
|
|
|
#! /bin/sh
|
|
|
|
vuxml_file="$1"
|
|
|
|
if [ -z "${vuxml_file}" ]; then
|
|
|
|
exec >&2
|
|
|
|
echo "Usage: newentry.sh /path/to/vuxml/document"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2005-01-08 18:13:09 +01:00
|
|
|
tmp="`mktemp ${TMPDIR:-/tmp}/vuxml.XXXXXXXXXX`" || exit 1
|
2005-01-08 16:43:23 +01:00
|
|
|
doclean="yes"
|
|
|
|
cleanup() {
|
|
|
|
if [ "${doclean}" = "yes" ]; then
|
|
|
|
rm -f "${tmp}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
trap cleanup EXIT 1 2 13 15
|
|
|
|
|
|
|
|
vid="`uuidgen | tr '[:upper:]' '[:lower:]'`"
|
2005-01-08 18:13:09 +01:00
|
|
|
[ -z "$vid" ] && exit 1
|
|
|
|
discovery="`date -u '+%Y-%m'`-FIXME" || exit 1
|
|
|
|
entry="`date -u '+%Y-%m-%d'`" || exit 1
|
2005-01-08 16:43:23 +01:00
|
|
|
|
2005-01-08 18:13:09 +01:00
|
|
|
awk '/^<\?/,/^<vuxml/ { print }' "${vuxml_file}" >> "${tmp}" || exit 1
|
|
|
|
cat << EOF >> "${tmp}" || exit 1
|
2005-01-08 16:43:23 +01:00
|
|
|
<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
|
2005-01-08 18:13:09 +01:00
|
|
|
awk '/^[[:space:]]+<vuln /,/^NONE$/ { print }' \
|
|
|
|
"${vuxml_file}" >> "${tmp}" || exit 1
|
2005-01-08 16:43:23 +01:00
|
|
|
|
|
|
|
if cp "${tmp}" "${vuxml_file}"; then
|
2005-05-13 17:34:49 +02:00
|
|
|
exec ${EDITOR:-vi} "${vuxml_file}"
|
2005-01-08 16:43:23 +01:00
|
|
|
else
|
|
|
|
doclean="no"
|
|
|
|
exec >&2
|
|
|
|
echo "Could not overwrite \`${vuxml_file}'."
|
|
|
|
echo "Results are left in \`${tmp}'."
|
|
|
|
exit 1
|
|
|
|
fi
|