~ubuntu-branches/debian/jessie/cryptsetup/jessie

« back to all changes in this revision

Viewing changes to debian/scripts/decrypt_keyctl

  • Committer: Package Import Robot
  • Author(s): Jonas Meurer
  • Date: 2014-03-04 20:14:07 UTC
  • mfrom: (0.2.13)
  • Revision ID: package-import@ubuntu.com-20140304201407-8cn7znmyssyrgduu
Tags: 2:1.6.6-1
* new upsream version 1.6.6.
* add versioned dependency on cryptsetup-bin to cryptsetup. (closes: #747670)
* change versioned build-depends on automake to >= 1.12 to reflect upstream
  requirements. Thanks to Joel Johnson. (closes: #740688)
* build and link against libgcrypt20 (>= 1.6.1). Add note about whirlpool
  bug in older libgcrypt releases and how to deal with it to debian/NEWS.
* add systemd support to askpass. Thanks to David Härdeman for the patch.
  (closes: #742600, #755074)
* fix initramfs cryptroot hook to not include modules unconditionally. Thanks
  to Dmitrijs Ledkovs for bugreport and patch. (closes: #714104)
* fix decrypt_keyctl script to ask again in case of wrong passphrase. Thanks
  to Dmitriy Matrosov for bugreport and patch. (closes: #748368)
* incorporate changes from ubuntu package:
  - don't hardcode paths to udevadm and udevsettle.
  - restore terminal settings in askpass.c. (closes: #714942)
  - migrate upstart jobs to new names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
test -x "$ASKPASS_" && PW_READER_='askpass'     # prefered method
33
33
 
34
34
KID_=$(keyctl search @u user "$ID_" 2>/dev/null)
35
 
if [ $? -ne 0 ] || [ -z "$KID_" ]; then
36
 
    # key not found, ask the user
 
35
if [ $? -ne 0 ] || [ -z "$KID_" ] || [ "$CRYPTTAB_TRIED" -gt 0 ]; then
 
36
    # key not found or wrong, ask the user
37
37
    case "$PW_READER_" in
38
38
        askpass)
39
39
            KEY_=$($ASKPASS_ "$PROMPT_") || die "Error executing $ASKPASS_"
66
66
            fi
67
67
            ;;
68
68
    esac
 
69
    if [ -n "$KID_" ]; then
 
70
        # I have cached wrong password and now i may use either `keyctl update`
 
71
        # to update $KID_ or just unlink old key, and add new. With `update` i
 
72
        # may hit "Key has expired", though. So i'll go "unlink and add" way.
 
73
        keyctl unlink $KID_ @u
 
74
        KID_=""
 
75
    fi
69
76
    KID_=$(echo -n "$KEY_" |keyctl padd user "$ID_" @u)
70
77
    [ -z "$KID_" ] && die "Error adding passphrase to kernel keyring"
71
78
    if ! keyctl timeout $KID_ $TIMEOUT_; then