diff options
author | Raphael Geissert <geissert@debian.org> | 2011-01-05 21:59:33 +0000 |
---|---|---|
committer | Raphael Geissert <geissert@debian.org> | 2011-01-05 21:59:33 +0000 |
commit | 8452c61119de87b3e0c7693ec69f9f1744c5a70b (patch) | |
tree | 16a9ab41fe2d40b054cc9cad4d0339b97a66881c /bin | |
parent | a0111bd598228968c95b0479aca20b7214224204 (diff) |
Add a DSA template and a script to generate it
Example: bin/gen-DSA 2120-1 php5 "multiple vulnerabilities" > DSA
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@15794 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/gen-DSA | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/bin/gen-DSA b/bin/gen-DSA new file mode 100755 index 0000000000..3a82678ad9 --- /dev/null +++ b/bin/gen-DSA @@ -0,0 +1,100 @@ +#!/bin/sh + +#################### +# Copyright (C) 2011 by Raphael Geissert <geissert@debian.org> +# +# +# This file is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see <http://www.gnu.org/licenses/>. +#################### + +set -e + +OLDSTABLE= +STABLE=lenny +TESTING=squeeze + +[ -f doc/DSA.template ] || { + echo "error: call this script from the root of the repository" >&2 + exit 1 +} + +[ $# -ge 3 ] || { + echo "usage: $0 DSA package vulnerability [cve(s) [bugnumber]]" >&2 + exit 1 +} + +DSAID="$1" +PACKAGE="$(printf '%s' "$2" | tr "[:upper:]" "[:lower:]")" +VULNERABILITY="$3" +CVE="$(printf '%s' "$4" | tr "[:lower:]" "[:upper:]")" +BUGNUM="$5" + +if grep -wq "DSA-$DSAID" data/DSA/list; then + echo "error: DSA-$DSAID has already been used" >&2 + exit 1 +fi + +setvar() { + local var="$1" value="$2" + + if [ -z "$value" ]; then + value="$(eval 'printf "%s" "$'"$var"'"')" + fi + + sed -i "s=\$$var=$value=g" "$tmpf" +} + +tmpf=$(mktemp) +cat doc/DSA.template > $tmpf + +name_length=$(echo -n "$DEBFULLNAME" | wc -c) +spacing=$((24-$name_length)) +SPACEDDEBFULLNAME="$DEBFULLNAME" +while [ $spacing -gt 0 ]; do + SPACEDDEBFULLNAME=" $SPACEDDEBFULLNAME" + spacing=$((spacing-1)) +done + +DATE="$(date +"%B %d, %Y")" +date_length=$(echo -n "$DATE" | wc -c) +spacing=$((22-$date_length)) +SPACEDDATE="$DATE" +while [ $spacing -gt 0 ]; do + SPACEDDATE="$SPACEDDATE " + spacing=$((spacing-1)) +done + +setvar DEBEMAIL +setvar DEBFULLNAME +setvar SPACEDDEBFULLNAME +setvar PACKAGE +setvar CVE +setvar REMLOCAL "${REMLOCAL:-remote}" +setvar DSAID +setvar BUGNUM +setvar VULNERABILITY +setvar DEBIANSPECIFIC "${DEBIANSPECIFIC:-no}" +setvar OLDSTABLE +setvar STABLE +setvar TESTING +setvar SPACEDDATE +setvar DATE + +for dist in $OLDSTABLE $STABLE $TESTING UNSTABLE; do + version="$(eval 'printf "%s" "$'"$dist"_VERSION'"')" + [ -z "$version" ] || setvar "${dist}_VERSION" "$version" +done + +cat $tmpf +rm -f "$tmpf" |