- import of strongswan-2.7.0

- applied patch for charon
This commit is contained in:
Martin Willi
2006-04-28 07:14:48 +00:00
parent 52923c9acb
commit 997358a6c4
2043 changed files with 346842 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
send-pr
+39
View File
@@ -0,0 +1,39 @@
# Makefile for miscelaneous programs
# Copyright (C) 2002 Michael Richardson <[email protected]>
#
# This program 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 2 of the License, or (at your
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program 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.
#
# RCSID $Id: Makefile,v 1.1 2004/03/15 20:35:31 as Exp $
FREESWANSRCDIR=../..
include ${FREESWANSRCDIR}/Makefile.inc
PROGRAM=send-pr
LIBFILES=ipsec_pr.template
include ../Makefile.program
#
# $Log: Makefile,v $
# Revision 1.1 2004/03/15 20:35:31 as
# added files from freeswan-2.04-x509-1.5.3
#
# Revision 1.2 2002/06/02 21:51:41 mcr
# changed TOPDIR->FREESWANSRCDIR in all Makefiles.
# (note that linux/net/ipsec/Makefile uses TOPDIR because this is the
# kernel sense.)
#
# Revision 1.1 2002/04/24 07:55:32 mcr
# #include patches and Makefiles for post-reorg compilation.
#
#
#
+54
View File
@@ -0,0 +1,54 @@
SEND-PR: -*- send-pr -*-
SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as
SEND-PR: will all comments (text enclosed in `<' and `>').
SEND-PR:
SEND-PR: Please consult the send-pr man page `send-pr(1)' or the Texinfo
SEND-PR: manual if you are not sure how to fill out a problem report.
SEND-PR: Note that the Synopsis field is mandatory. The Subject (for
SEND-PR: the mail) will be made the same as Synopsis unless explicitly
SEND-PR: changed.
SEND-PR:
SEND-PR: Choose from the following categories:
SEND-PR:
SEND-PR: pluto - Problems with IKE daemon
SEND-PR: klips - Problems with kernel code
SEND-PR: startup- Problems with start/configuration code
SEND-PR: doc - Problems with documentation
SEND-PR: interop- Problems with interoperability
SEND-PR: source - source code patches/contributions
SEND-PR: admin - Problems with freeswan.org machines
SEND-PR:
To: [email protected]
Subject:
From: <FROM>
Reply-To: <REPLYTO>
Cc:
X-send-pr-version: 4.0-alpha
X-GNATS-Notify:
>Submitter-Id: <SUBMITTER>
>Originator: <DEFAULT_ORIGINATOR>
>Organization:
unknown
>Synopsis: <One-line summary of the PR (one line)>
>Confidential: <[ yes | no ] (one line)>
>Severity: <[ critical | serious | non-critical ] (one line)>
>Priority: <[ high | medium | low ] (one line)>
>Category: <choose from a category listed above (one line)>
>Class: <[ sw-bug | dos | interop | mtu | log | doc-bug | support | change-request | mistaken | duplicate ] (one line)>
>Release: <DEFAULT_VERSION>
>Environment:
<DEFAULT_ENVIRONMENT>
>IPsec-barf-location: <DEFAULT_BARF>
<some URL with the output of ipsec barf.>
>Description:
<Precise description of the problem (multiple lines)>
>How-To-Repeat:
<code/input/activities to reproduce the problem (multiple lines)>
>Fix:
<How to correct or work around the problem, if known (multiple lines)>
>IPsec-look:
+291
View File
@@ -0,0 +1,291 @@
.\" -*- nroff -*-
.\" ---------------------------------------------------------------------------
.\" man page for send-pr (by Heinz G. Seidl, [email protected])
.\" updated Feb 1993 for GNATS 3.00 by Jeffrey Osier, [email protected]
.\"
.\" This file is part of the Problem Report Management System (GNATS)
.\" Copyright 1992 Cygnus Support
.\"
.\" This program 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 2 of the License, or (at your option) any later version.
.\"
.\" This program 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 Library General Public
.\" License along with this program; if not, write to the Free
.\" Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA
.\"
.\" ---------------------------------------------------------------------------
.nh
.TH SEND-PR 8 xVERSIONx "February 1993"
.SH NAME
ipsec send-pr \- send problem report (PR) to a central support site
.SH SYNOPSIS
.B ipsec send-pr
[
.I site
]
[
.B \-f
.I problem-report
]
[
.B \-t
.I mail-address
]
.br
.in +0.8i
[
.B \-P
]
[
.B \-L
]
[
.B \-s
.I severity
]
[
.B \-c
.I address
]
.br
[
.B \-\-request-id
]
[
.B \-V
]
.SH DESCRIPTION
.B ipsec send-pr
is a tool used to submit
.I problem reports
.\" SITE ADMINISTRATORS - change this if you use a local default
(PRs) to a central support site. In most cases the correct
.I site
will be the default. This argument indicates the support site which
is responsible for the category of problem involved. Some sites may
use a local address as a default.
.I site
values are defined by using the
.BR aliases (5).
.LP
.B ipsec send-pr
invokes an editor on a problem report template (after trying to fill
in some fields with reasonable default values). When you exit the
editor,
.B ipsec send-pr
sends the completed form to the
.I Problem Report Management System
(\fBGNATS\fR) at a central support site. At the support site, the PR
is assigned a unique number and is stored in the \fBGNATS\fR database
according to its category and submitter-id. \fBGNATS\fR automatically
replies with an acknowledgement, citing the category and the PR
number.
.LP
To ensure that a PR is handled promptly, it should contain your (unique)
\fIsubmitter-id\fR and one of the available \fIcategories\fR to identify the
problem area. (Use
.B `ipsec send-pr -L'
to see a list of categories.)
.LP
The
.B ipsec send-pr
template at your site should already be customized with your
submitter-id (running `\|\fBinstall-sid\fP \fIsubmitter-id\fP\|' to
accomplish this is part of the installation procedures for
.BR ipsec send-pr ).
If this hasn't been done, see your system administrator for your
submitter-id, or request one from your support site by invoking
.B `ipsec send-pr \-\-request\-id'.
If your site does not distinguish between different user sites, or if
you are not affiliated with the support site, use
.B `net'
for this field.
.LP
The more precise your problem description and the more complete your
information, the faster your support team can solve your problems.
.SH OPTIONS
.TP
.BI \-f " problem-report"
specify a file (\fIproblem-report\fR) which already contains a
complete problem report.
.B ipsec send-pr
sends the contents of the file without invoking the editor. If
the value for
.I problem-report
is
.BR `\|\-\|' ,
then
.B ipsec send-pr
reads from standard input.
.TP
.BI \-s " severity"
Give the problem report the severity
.IR severity .
.TP
.BI \-t " mail-address"
Change mail address at the support site for problem reports. The
default
.I mail-address
is the address used for the default
.IR site .
Use the
.I site
argument rather than this option in nearly all cases.
.TP
.BI \-c " address"
Put
.I address
in the
.B Cc:
header of the message.
.TP
.B \-P
print the form specified by the environment variable
.B PR_FORM
on standard output. If
.B PR_FORM
is not set, print the standard blank PR template. No mail is sent.
.TP
.B -L
print the list of available categories. No mail is sent.
.TP
.B \-\-request\-id
sends mail to the default support site, or
.I site
if specified, with a request for your
.IR submitter-id .
If you are
not affiliated with
.IR site ,
use a
.I submitter-id
of
.BR net \|'.
.TP
.B \-V
Display the
.B ipsec send-pr
version number.
.LP
Note: use
.B ipsec send-pr
to submit problem reports rather than mailing them directly. Using
both the template and
.B ipsec send-pr
itself will help ensure all necessary information will reach the
support site.
.SH ENVIRONMENT
The environment variable
.B EDITOR
specifies the editor to invoke on the template.
.br
default:
.B vi
.sp
If the environment variable
.B PR_FORM
is set, then its value is used as the file name of the template for
your problem-report editing session. You can use this to start with a
partially completed form (for example, a form with the identification
fields already completed).
.SH "HOW TO FILL OUT A PROBLEM REPORT"
Problem reports have to be in a particular form so that a program can
easily manage them. Please remember the following guidelines:
.IP \(bu 3m
describe only
.B one problem
with each problem report.
.IP \(bu 3m
For follow-up mail, use the same subject line as the one in the automatic
acknowledgent. It consists of category, PR number and the original synopsis
line. This allows the support site to relate several mail messages to a
particular PR and to record them automatically.
.IP \(bu 3m
Please try to be as accurate as possible in the subject and/or synopsis line.
.IP \(bu 3m
The subject and the synopsis line are not confidential. This is
because open-bugs lists are compiled from them. Avoid confidential
information there.
.LP
See the GNU
.B Info
file
.B send-pr.info
or the document \fIReporting Problems With send-pr\fR\ for detailed
information on reporting problems
.SH "HOW TO SUBMIT TEST CASES, CODE, ETC."
Submit small code samples with the PR. Contact the support site for
instructions on submitting larger test cases and problematic source
code.
.SH FILES
.ta \w'/tmp/pbad$$ 'u
/tmp/p$$ copy of PR used in editing session
.br
/tmp/pf$$ copy of empty PR form, for testing purposes
.br
/tmp/pbad$$ file for rejected PRs
.br
@IPSEC_DIR@/send-pr.conf script to customize send-pr.
.SH EMACS USER INTERFACE
An Emacs user interface for
.B send-pr
with completion of field values is part of the
.B send-pr
distribution (invoked with
.BR "M-x send-pr" ).
See the file
.B send-pr.info
or the ASCII file
.B INSTALL
in the top level directory of the distribution for configuration and
installation information. The Emacs LISP template file is
.B send-pr-el.in
and is installed as
.BR send-pr.el .
.SH INSTALLATION AND CONFIGURATION
See
.B send-pr.info
or
.B INSTALL
for installation instructions.
.SH SEE ALSO
.I Reporting Problems Using send-pr
(also installed as the GNU Info file
.BR send-pr.info ).
.LP
.BR gnats (l),
.BR query-pr (1),
.BR edit-pr (1),
.BR gnats (8),
.BR queue-pr (8),
.BR at-pr (8),
.BR mkcat (8),
.BR mkdist (8).
.SH AUTHORS
Jeffrey Osier, Brendan Kehoe, Jason Merrill, Heinz G. Seidl (Cygnus
Support)
.SH COPYING
Copyright (c) 1992, 1993 Free Software Foundation, Inc.
.PP
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
.PP
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
.PP
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be included in
translations approved by the Free Software Foundation instead of in
the original English.
+643
View File
@@ -0,0 +1,643 @@
#!/bin/sh
# Submit a problem report to a GNATS site.
# Copyright (C) 2001 Milan Zamazal
# Copyright (C) 1993, 2001 Free Software Foundation, Inc.
# Contributed by Brendan Kehoe ([email protected]), based on a
# version written by Heinz G. Seidl ([email protected]).
# Further edited by Milan Zamazal ([email protected]).
# mktemp support by Yngve Svendsen ([email protected]).
#
# This file is part of GNU GNATS.
#
# GNU GNATS 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 2, or (at your option)
# any later version.
#
# GNU GNATS 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 GNU GNATS; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#
# $Id: send-pr.in,v 1.1 2004/03/15 20:35:31 as Exp $
#
# The version of this send-pr.
VERSION=4.0-alpha
#SWAN_VERSION=
# The submitter-id for your site.
SUBMITTER=net
# The place where our usual binaries live.
BINDIR=@IPSEC_DIR@
# The place where the builtin binaries are located.
LIBDIR=@IPSEC_LIBDIR@
LIBEXECDIR=@IPSEC_EXECDIR@
# The default release for this host.
DEFAULT_RELEASE="gnats-4.0-alpha"
# The default organization.
DEFAULT_ORGANIZATION="net"
# How to read the passwd database.
PASSWD="cat /etc/passwd"
# Is the mktemp command available?
MKTEMP="yes"
ECHON=bsd
# By default send-pr connects directly to the database. However, it
# can be configured to use an existing template file by setting the
# TEMPLATE variable below to point to a PR template generated from
# "send-pr -P".
TEMPLATE="$LIBDIR/ipsec_pr.template"
# send-pr can use mail to submit PRs, instead of connecting to the
# database directly. MAILPROG needs to point to a compatible mailer
# (sendmail will work). If MAILPROG needs to have the address that
# the mail is being sent to specified on the command line, it should
# be specified here as well (for example, the command
# MAILPROG="mail [email protected]"
# should work). If sendmail is used, this should be set to
# MAILPROG="/usr/lib/sendmail -oi -t"
MAILPROG="/usr/sbin/sendmail -oi -t"
# The address that PRs are sent to. Normally this can be left as "bugs";
# however, if using mail to submit PRs, this should be set to the address
# where PRs should be sent.
MAILADDR="[email protected]"
if [ $ECHON = bsd ] ; then
ECHON1="echo -n"
ECHON2=
elif [ $ECHON = sysv ] ; then
ECHON1=echo
ECHON2='\c'
else
ECHON1=echo
ECHON2=
fi
# Configuration file to be read. It must be a shell script that can redefine
# the variables above to fit a local configuration.
CONFIGFILE=@IPSEC_DIR@/send-pr.conf
if [ -r $CONFIGFILE ]; then
. $CONFIGFILE
fi
#
if [ -z "$TMPDIR" ]; then
TMPDIR=/tmp
else
if [ "`echo $TMPDIR | grep '/$'`" != "" ]; then
TMPDIR="`echo $TMPDIR | sed -e 's,/$,,'`"
fi
fi
# TEMP: Temporary copy of the PR, to be edited by the user.
# BAD: The PR will end up here if the user aborts.
# REF: The 'reference' copy of the PR template, used to verify that the user
# actually did edit the template.
# FIXFIL: A sed script used to remove comments from the template before
# processing.
if [ $MKTEMP = yes ]; then
TEMP=`mktemp $TMPDIR/pXXXXXX` || exit 1
BAD=`mktemp $TMPDIR/pbadXXXXXX` || exit 1
REF=`mktemp $TMPDIR/pfXXXXXX` || exit 1
FIXFIL=`mktemp $TMPDIR/fixXXXXXX` || exit 1
else
TEMP=$TMPDIR/p$$
BAD=$TMPDIR/pbad$$
REF=$TMPDIR/pf$$
FIXFIL=$TMPDIR/fix$$
bad_temp=0
: > $TEMP || bad_temp=1
: > $BAD || bad_temp=1
: > $REF || bad_temp=1
: > $FIXFIL || bad_temp=1
if [ $bad_temp = 1 ]; then
rm -f $TEMP $BAD $REF $FIXFIL
exit 1;
fi
fi
REMOVE_TEMP="rm -f $TEMP $BAD $REF"
# find a user name
if [ "$LOGNAME" = "" ]; then
if [ "$USER" != "" ]; then
LOGNAME="$USER"
else
LOGNAME="UNKNOWN"
fi
fi
FROM="$LOGNAME"
REPLYTO="${REPLY_TO:-${REPLYTO:-$LOGNAME}}"
if [ "x$MAILPROG" != "x" ]
then
RESP_ALIAS="`query-pr --adm-field responsible --adm-key $LOGNAME --adm-subfield alias 2>/dev/null`"
else
RESP_ALIAS=""
fi
# Find out the name of the originator of this PR.
if [ -n "$NAME" ]; then
DEFAULT_ORIGINATOR="$NAME"
elif [ -f $HOME/.fullname ]; then
DEFAULT_ORIGINATOR="`sed -e '1q' $HOME/.fullname`"
else
# Must use temp file due to incompatibilities in quoting behavior
# and to protect shell metacharacters in the expansion of $LOGNAME
$PASSWD | grep "^$LOGNAME:" | awk -F: '{print $5}' | sed -e 's/,.*//' > $TEMP
if [ "x$RESP_ALIAS" != "x" ]
then
DEFAULT_ORIGINATOR="$RESP_ALIAS (`cat $TEMP`)"
else
DEFAULT_ORIGINATOR="$FROM (`cat $TEMP`)"
fi
rm -f $TEMP
fi
if [ -z "$ORGANIZATION" ]
then
ORGANIZATION="$DEFAULT_ORGANIZATION";
fi
if [ -n "$ORGANIZATION" -a "x$ORGANIZATION" != "xunknown" ]; then
if [ -f "$ORGANIZATION" ]; then
ORGANIZATION="`cat $ORGANIZATION`"
fi
if [ -n "$ORGANIZATION" ]; then
ORGANIZATION="$ORGANIZATION"
elif [ -f $HOME/.organization ]; then
ORGANIZATION="`cat $HOME/.organization`"
fi
fi
if [ "x$ORGANIZATION" = "xunknown" ]; then
cat <<__EOF__
It seems that send-pr is not installed with your organization set to a useful
value. To fix this, you need to edit the configuration file
$CONFIGFILE
and fill in the organization with the correct value.
__EOF__
ORGANIZATION="";
fi 1>&2
# If they don't have a preferred editor set, then use
if [ -z "$VISUAL" ]; then
if [ -z "$EDITOR" ]; then
EDIT=vi
else
EDIT="$EDITOR"
fi
else
EDIT="$VISUAL"
fi
# Find out some information.
SYSTEM=`( [ -f /bin/uname ] && /bin/uname -a ) || \
( [ -f /usr/bin/uname ] && /usr/bin/uname -a ) || echo "" | sed -e 's,|,\\|,'`
# Our base command name.
COMMAND=`echo $0 | sed -e 's,.*/,,'`
USAGE="Usage: $COMMAND [OPTION]...
-b --batch run without printing most messages
--barf include a full barf inline rather than just look
-c --cc=LINE put LINE to the CC header
-d --database=DATABASE submit PR to DATABASE
-f --file=FILE read the PR template from FILE (\`-' for stdin)
-p --print just print the template and exit
--request-id send a request for a user id
-s --severity=SEVERITY PR severity
-h --help display this help and exit
-V --version output version information and exit
"
REMOVE=
BATCH=
CC=
DEFAULT_SEVERITY=
BARF=${BARF-false}
if [ "$SYSTEM" != "" ]
then
DEFAULT_ENVIRONMENT="System: $SYSTEM"
fi
if [ "$SWAN_VERSION" != "" ]
then
DEFAULT_VERSION="$SWAN_VERSION";
else
DEFAULT_VERSION=`ipsec --versioncode`
fi
DEFAULT_VERSION=`echo $DEFAULT_VERSION | sed -e 's,\/,\\\/,'`
while [ $# -gt 0 ]; do
case "$1" in
-r) ;; # Ignore for backward compat.
-f | --file) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
shift ; IN_FILE="$1"
if [ "$IN_FILE" != "-" -a ! -r "$IN_FILE" ]; then
echo "$COMMAND: cannot read $IN_FILE"
exit 1
fi
;;
-b | --batch) BATCH=true ;;
--barf) BARF=true ;;
-c | --cc) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
shift ; CC="$1"
;;
-d | --database) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
shift; GNATSDB="$1"; export GNATSDB
;;
-s | --severity) if [ $# -eq 1 ]; then echo "$USAGE"; exit 1; fi
shift ; DEFAULT_SEVERITY="$1"
;;
-p | -P | --print) PRINT=true ;;
--request-id) REQUEST_ID=true ;;
-h | --help) echo "$USAGE"; exit 0 ;;
-V | --version) echo "$VERSION"; exit 0 ;;
-*) echo "$USAGE" ; exit 1 ;;
*) echo "$USAGE" ; exit 1 ;;
esac
shift
done
if [ "x$SUBMITTER" = "x" ]
then
SUBMITTER="unknown"
fi
if [ "x$SUBMITTER" = "xunknown" -a -z "$REQUEST_ID" -a -z "$IN_FILE" ]; then
cat << '__EOF__'
It seems that send-pr is not installed with your unique submitter-id.
You need to run
install-sid YOUR-SID
where YOUR-SID is the identification code you received with `send-pr'.
`send-pr' will automatically insert this value into the template field
`>Submitter-Id'. If you've downloaded `send-pr' from the Net, use `net'
for this value. If you do not know your id, run `send-pr --request-id' to
get one from your support site.
__EOF__
exit 1
fi
# So the template generation code finds it.
DEFAULT_SUBMITTERID=${SUBMITTER}
# Catch some signals. ($xs kludge needed by Sun /bin/sh)
xs=0
trap 'rm -f $REF $TEMP $FIXFIL; exit $xs' 0
trap 'echo "$COMMAND: Aborting ..."; rm -f $REF $TEMP $FIXFIL; xs=1; exit' 1 3 13 15
if [ "x$PRINT" = "xtrue" ]; then
FROM="<FROM>"
REPLYTO="<REPLYTO>"
DEFAULT_ORIGINATOR="<DEFAULT_ORIGINATOR>"
DEFAULT_SUBMITTERID="<SUBMITTER>"
fi
# If they told us to use a specific file, then do so.
if [ -n "$IN_FILE" ]; then
if [ "$IN_FILE" = "-" ]; then
# The PR is coming from the standard input.
cat > $TEMP
else
# Use the file they named.
cat $IN_FILE > $TEMP
fi
else
if [ -n "$TEMPLATE" -a -z "$PRINT_INTERN" ]; then
# If their TEMPLATE points to a bogus entry, then bail.
if [ ! -f "$TEMPLATE" -o ! -r "$TEMPLATE" -o ! -s "$TEMPLATE" ]; then
echo "$COMMAND: can't seem to read your template file (\`$TEMPLATE'), ignoring TEMPLATE"
sleep 1
PRINT_INTERN=bad_prform
fi
fi
if [ -n "$TEMPLATE" -a -z "$PRINT_INTERN" ]; then
sed "s/<FROM>/$FROM/;s/<REPLYTO>/$REPLYTO/;s/<DEFAULT_ORIGINATOR>/$DEFAULT_ORIGINATOR/;s/<SUBMITTER>/$DEFAULT_SUBMITTERID/;s|<DEFAULT_ENVIRONMENT>|$DEFAULT_ENVIRONMENT|;s/<DEFAULT_BARF>/$DEFAULT_BARF/;s/<DEFAULT_VERSION>/$DEFAULT_VERSION/;" < $TEMPLATE > $TEMP ||
( echo "$COMMAND: could not copy $TEMPLATE" ; xs=1; exit )
else
# Which genius thought of iterating through this loop twice, when the
# cp command would suffice?
for file in $TEMP ; do
cat > $file << '__EOF__'
SEND-PR: -*- send-pr -*-
SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as
SEND-PR: will all comments (text enclosed in `<' and `>').
SEND-PR:
SEND-PR: Please consult the send-pr man page `send-pr(1)' or the Texinfo
SEND-PR: manual if you are not sure how to fill out a problem report.
SEND-PR: Note that the Synopsis field is mandatory. The Subject (for
SEND-PR: the mail) will be made the same as Synopsis unless explicitly
SEND-PR: changed.
SEND-PR:
SEND-PR: Choose from the following categories:
SEND-PR:
__EOF__
# Format the categories so they fit onto lines.
CATEGORIES=`${BINDIR}/query-pr --valid-values Category`;
l=`echo "$CATEGORIES" | \
awk 'BEGIN {max = 0; } { if (length($0) > max) { max = length($0); } }
END {print max + 1;}'`
c=`expr 61 / $l`
if [ $c -eq 0 ]; then c=1; fi
echo "$CATEGORIES" | \
awk 'BEGIN {printf "SEND-PR: "; i = 0 }
{ printf ("%-'$l'.'$l's", $0);
if ((++i % '$c') == 0) { printf "\nSEND-PR: " } }
END { printf "\nSEND-PR:\n"; }' >> $file
cat >> $file << __EOF__
To: $MAILADDR
Subject:
From: $FROM
Reply-To: $REPLYTO
Cc: $CC
X-send-pr-version: $VERSION
X-GNATS-Notify:
__EOF__
#
# Iterate through the list of input fields. fieldname is the
# name of the field. fmtname is the formatted name of the field,
# with >, : and extra spaces to cause the field contents to be
# aligned.
#
${BINDIR}/query-pr --list-input-fields | awk '{a[NR]=$1""; mnr = NR+1; len = length($1) + 2; if (mlen < len) mlen = len; } END { for (x = 1; x < mnr; x++) { b = ">"a[x]":"; printf ("%s %-"mlen"s&\n", a[x], b); } }' | while read fieldname fmtname
do
fmtname="`echo "$fmtname" | sed 's/[&]$//;'`"
upname="`echo $fieldname | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/;s/-//g;'`"
# Grab the default value for this field.
eval 'default_val="$DEFAULT_'${upname}'"'
# What's stored in the field?
type=`${BINDIR}/query-pr --field-type $fieldname | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
case $type in
enum)
if [ "$default_val" != "" ]
then
desc=$default_val;
else
if [ "$fieldname" != "Category" ]
then
values=`${BINDIR}/query-pr --valid-values $fieldname | tr '\n' ' ' | sed 's/ *$//g;s/ / | /g;s/^/[ /;s/$/ ]/;'`
valslen=`echo "$values" | wc -c`
else
values="choose from a category listed above"
valslen=1;
fi
if [ "$valslen" -gt 160 ]
then
desc="<`${BINDIR}/query-pr --field-description $fieldname` (one line)>";
else
desc="<${values} (one line)>";
fi
dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
echo "/^>${fieldname}:/ s/${dpat}//" >> $FIXFIL
fi
echo "${fmtname}${desc}" >> $file
;;
multitext)
if [ "$default_val" != "" ]
then
desc=" $default_val";
else
desc=" <`${BINDIR}/query-pr --field-description $fieldname` (multiple lines)>";
dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
echo "s/^${dpat}//" >> $FIXFIL
fi
echo "${fmtname}" >> $file;
echo "$desc" >> $file;
;;
*)
if [ "$default_val" != "" ]
then
desc="${default_val}"
else
desc="<`${BINDIR}/query-pr --field-description $fieldname` (one line)>"
dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
echo "/^>${fieldname}:/ s/${dpat}//" >> $FIXFIL
fi
echo "${fmtname}${desc}" >> $file
;;
esac
done
done
fi
if [ "$PRINT" = true -o "$PRINT_INTERN" = true ]; then
cat $TEMP
xs=0; exit
fi
if $BARF
then
ipsec barf >>$TEMP
else
ipsec look >>$TEMP
fi
cp $TEMP $REF
chmod u+w $TEMP
if [ -z "$REQUEST_ID" ]; then
eval $EDIT $TEMP
else
ed -s $TEMP << '__EOF__'
/^Subject/s/^Subject:.*/Subject: request for a customer id/
/^>Category/s/^>Category:.*/>Category: send-pr/
w
q
__EOF__
fi
if cmp -s $REF $TEMP ; then
echo "$COMMAND: problem report not filled out, therefore not sent"
xs=1; exit
fi
fi
# TEMP is the PR that we are editing. When we're done, REF will contain
# the final PR to be sent.
while [ -z "$REQUEST_ID" ]; do
CNT=0
#
# Remove comments.
#
echo '/^SEND-PR:/d' >> $FIXFIL
sed -f $FIXFIL $TEMP > $REF
# REF now has the actual PR that we want to send.
#
# Check that synopsis is not empty.
#
if grep "^>Synopsis:[ ]*$" $REF > /dev/null
then
echo "$COMMAND: Synopsis must not be empty."
CNT=`expr $CNT + 1`
fi
if [ "x$MAILPROG" = "x" ]
then
# Since we're not using mail, use pr-edit to check the PR. We can't
# do much checking otherwise, sorry.
$LIBEXECDIR/pr-edit --check-initial < $REF || CNT=`expr $CNT + 1`
fi
[ $CNT -gt 0 -a -z "$BATCH" ] &&
echo "Errors were found with the problem report."
while true; do
if [ -z "$BATCH" ]; then
$ECHON1 "a)bort, e)dit or s)end? $ECHON2"
read input
else
if [ $CNT -eq 0 ]; then
input=s
else
input=a
fi
fi
case "$input" in
a*)
if [ -z "$BATCH" ]; then
echo "$COMMAND: the problem report remains in $BAD and is not sent."
mv $TEMP $BAD
else
echo "$COMMAND: the problem report is not sent."
fi
xs=1; exit
;;
e*)
eval $EDIT $TEMP
continue 2
;;
s*)
break 2
;;
esac
done
done
#
# Make sure the mail has got a Subject. If not, use the same as
# in Synopsis.
#
if grep '^Subject:[ ]*$' $REF > /dev/null
then
SYNOPSIS=`grep '^>Synopsis:' $REF | sed -e 's/^>Synopsis:[ ]*//'`
ed -s $REF << __EOF__
/^Subject:/s/:.*\$/: $SYNOPSIS/
w
q
__EOF__
fi
while :
do
if [ "x$MAILPROG" != "x" ]
then
# Use mail to send the PR.
if $MAILPROG < $REF
then
echo "$COMMAND: problem report mailed"
xs=0; exit
else
echo "$MAILPROG failed!"
fi
else
if $LIBEXECDIR/pr-edit --submit < $REF; then
echo "$COMMAND: problem report filed"
xs=0; exit
else
echo "$COMMAND: the problem report is not sent."
fi
fi
while true
do
if [ -z "$BATCH" ]; then
$ECHON1 "a)bort or s)end? (file=$REF) $ECHON2"
read input
case "$input" in
a*)
break 2 ;;
s*)
break ;;
esac
else
break 2;
fi
done
done
if [ -z "$BATCH" ]; then
echo "$COMMAND: the problem report remains in $BAD and is not sent."
mv $TEMP $BAD
else
echo "$COMMAND: the problem report is not sent, is in $REF."
fi
xs=1; exit;
#
# $Log: send-pr.in,v $
# Revision 1.1 2004/03/15 20:35:31 as
# added files from freeswan-2.04-x509-1.5.3
#
# Revision 1.10 2003/07/14 12:26:17 mcr
# use | as delimitor for $DEFAULT_ENVIRONMENT.
# switch | to \\| when in $DEFAULT_ENVIRONMENT.
# this is due to PR#236 where the "uname" output
# says GNU/Linux, screwing up sed.
#
# Revision 1.9 2003/02/03 21:51:06 mcr
# if MAILPROG fails, then offer to try again.
#
# Revision 1.8 2002/12/10 02:28:13 mcr
# adjusted template to use [email protected]
# fix sed script to deal with version sanitizer.
#
# Revision 1.7 2002/12/10 02:17:34 mcr
# need to init variables first
#
# Revision 1.6 2002/12/10 02:16:23 mcr
# adjusted send-pr to look at LIBDIR, not LIBEXECDIR
#
# Revision 1.5 2002/09/30 16:04:05 mcr
# fix for sed bug in "send-pr"
#
# Revision 1.4 2002/04/24 07:36:10 mcr
# Moved from ./utils/send-pr.sh,v
#
# Revision 1.3 2001/11/27 15:02:55 mcr
# added rcsids.
# fixed submission address to be [email protected]
# use new ipsec --versioncode to get version info.
#
#