/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 00:19:53 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080906001953-5nk5uti6shzuyqdr
* plugins.d/password-prompt.c (main): If successful, output an extra
                                      newline to the console before
                                      exiting, to change to a new line
                                      away from the prompt.

* plugins.d/password-request.c (main): Bug fix: Moved calls to
                                       "init_gnutls_global()",
                                       "mkdtemp()", and "init_gpgme()"
                                       to *after* changing user &
                                       group.

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" -o -e "$PUBKEYFILE" \) \
152
 
        -a "$FORCE" -eq 0 ]; then
 
151
    if { [ -e "$SECKEYFILE" ] || [ -e "$PUBKEYFILE" ]; } \
 
152
        && [ "$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 --quiet \
258
 
        --expression='/^fpr:/{s/^fpr:.*:\\([0-9A-Z]*\\):\$/\\1/p;q}'`"
 
257
        | sed -n -e '/^fpr:/{s/^fpr:.*:\\([0-9A-Z]*\\):\$/\\1/p;q}'`"
259
258
    
260
259
    test -n "$FINGERPRINT"
261
260
    
263
262
    
264
263
    stty -echo
265
264
    echo -n "Enter passphrase: " >&2
266
 
    head --lines=1 | tr --delete '\n' \
 
265
    sed -e '1q' \
267
266
        | gpg --quiet --batch --no-tty --no-options --enable-dsa2 \
268
267
        --homedir "$RINGDIR" --trust-model always --armor --encrypt \
269
268
        --recipient "$FINGERPRINT" --comment "$FILECOMMENT" \
277
276
        fingerprint = $FINGERPRINT
278
277
        secret =
279
278
EOF
280
 
    sed --quiet --expression='
 
279
    sed -n -e '
281
280
        /^-----BEGIN PGP MESSAGE-----$/,/^-----END PGP MESSAGE-----$/{
282
281
            /^$/,${
283
282
                # Remove 24-bit Radix-64 checksum