/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos-keygen

  • Committer: Teddy Hogeborn
  • Date: 2008-09-06 15:34:21 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080906153421-605ydhwyo404krh9
* initramfs-tools-hook: Use long options where available.  Use only
                        one "test" invocation instead of several.

* mandos-keygen: Use only one "test" invocation instead of several.
                 Use long options where available.  Strip newline from
                 entered password.

* plugin-runner.c (print_out_password): Do not strip trailing newline.
  (fallback): Strip trailing newline from getpass().

* plugin-runner.xml (PLUGINS): Plugins should not print trailing
                               newlines.

* plugins.d/password-prompt.c (main): Strip trailing newline.

* plugins.d/password-request.c (main): Bug fix: Read "pubkey.txt", not
                                       "pupkey.txt".

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
        [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|*) FORCE=0;;
149
149
    esac
150
150
    
151
 
    if { [ -e "$SECKEYFILE" ] || [ -e "$PUBKEYFILE" ]; } \
152
 
        && [ "$FORCE" -eq 0 ]; then
 
151
    if [ \( -e "$SECKEYFILE" -o -e "$PUBKEYFILE" \) \
 
152
        -a "$FORCE" -eq 0 ]; then
153
153
        echo "Refusing to overwrite old key files; use --force" >&2
154
154
        exit 1
155
155
    fi
254
254
    FINGERPRINT="`gpg --quiet --batch --no-tty --no-options \
255
255
        --enable-dsa2 --homedir \"$RINGDIR\" --trust-model always \
256
256
        --fingerprint --with-colons \
257
 
        | sed -n -e '/^fpr:/{s/^fpr:.*:\\([0-9A-Z]*\\):\$/\\1/p;q}'`"
 
257
        | sed --quiet \
 
258
        --expression='/^fpr:/{s/^fpr:.*:\\([0-9A-Z]*\\):\$/\\1/p;q}'`"
258
259
    
259
260
    test -n "$FINGERPRINT"
260
261
    
262
263
    
263
264
    stty -echo
264
265
    echo -n "Enter passphrase: " >&2
265
 
    sed -e '1q' \
 
266
    head --lines=1 | tr --delete '\n' \
266
267
        | gpg --quiet --batch --no-tty --no-options --enable-dsa2 \
267
268
        --homedir "$RINGDIR" --trust-model always --armor --encrypt \
268
269
        --recipient "$FINGERPRINT" --comment "$FILECOMMENT" \
276
277
        fingerprint = $FINGERPRINT
277
278
        secret =
278
279
EOF
279
 
    sed -n -e '
 
280
    sed --quiet --expression='
280
281
        /^-----BEGIN PGP MESSAGE-----$/,/^-----END PGP MESSAGE-----$/{
281
282
            /^$/,${
282
283
                # Remove 24-bit Radix-64 checksum