app-crypt/monkeysphere: fix patch
[portage-overlay.git] / app-crypt / monkeysphere / files / monkeysphere-0.36_openpgp2ssh_sanity_check.patch
1 diff --git a/src/monkeysphere-authentication b/src/monkeysphere-authentication
2 index edc7995..2711ff2 100755
3 --- a/src/monkeysphere-authentication
4 +++ b/src/monkeysphere-authentication
5 @@ -84,6 +84,13 @@ gpg_sphere() {
6      su_monkeysphere_user gpg --fixed-list-mode --no-greeting --quiet --no-tty "$@"
7  }
8  
9 +check_openpgp2ssh_sanity() {
10 +    if [[ `su_monkeysphere_user openpgp2ssh ABC &>/dev/null || echo $?` != "255" ]]; then
11 +    echo "openpgp2ssh command gives unexpected return code. This can lead to a scenario where no authorized keys are populated, even though they are otherwise valid. Aborting!"
12 +    exit 1
13 +    fi; 
14 +}
15 +
16  # output to stdout the core fingerprint from the gpg core secret
17  # keyring
18  core_fingerprint() {
19 @@ -163,6 +170,7 @@ case $COMMAND in
20      'update-users'|'update-user'|'update'|'u')
21         source "${MASHAREDIR}/setup"
22         setup
23 +       check_openpgp2ssh_sanity
24         source "${MASHAREDIR}/update_users"
25         OUTPUT_STDOUT= update_users "$@"
26         ;;
27 @@ -171,6 +179,7 @@ case $COMMAND in
28         (( $# > 0 )) || failure "Must specify user."
29         source "${MASHAREDIR}/setup"
30         setup
31 +       check_openpgp2ssh_sanity
32         source "${MASHAREDIR}/update_users"
33         OUTPUT_STDOUT=true update_users "$1"
34         ;;