3 # Generate a krb5.conf file with an [appdefault] krb5-strength section that
4 # contains all the key/value pairs given on the command line. This script is
5 # used by C tests to set up the environment.
7 # Written by Russ Allbery <eagle@eyrie.org>
9 # The Board of Trustees of the Leland Stanford Junior University
11 # See LICENSE for licensing terms.
15 # Command-line arguments are the source krb5.conf template, the directory into
16 # which to write the resulting krb5.conf file, and then any number of key and
17 # value pairs to put into krb5.conf.
20 if [ -z "$tmpdir" ] ; then
21 echo 'Syntax: make-krb5-conf <source> <tmpdir> <key> <value> ...' >&2
27 # Copy over the template and ensure it's writable.
28 cp "$source" "$tmpdir"/krb5.conf
29 chmod 644 "$tmpdir"/krb5.conf
31 # Add the appdefaults section.
32 cat <<EOF >>"$tmpdir"/krb5.conf
38 # Add the key-value pairs.
39 while [ -n "$1" ] ; do
40 echo " $1 = $2" >>"$tmpdir"/krb5.conf
45 # End the appdefaults section.
46 echo ' }' >>"$tmpdir"/krb5.conf