X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=src%2Fsubcommands%2Fma%2Fadd-certifier;h=0c3c647663db387a98ed70e88574f7b8e9ca4cdc;hb=e4c566d5a1dd25d87d07dac1459a395321b9a5ef;hp=3bd800c25cd6ee8cd4f2c6a0899ead07e738bb60;hpb=b7e17887ac20bc5916d830f5282b07f4c0360c2a;p=monkeysphere.git diff --git a/src/subcommands/ma/add-certifier b/src/subcommands/ma/add-certifier old mode 100755 new mode 100644 index 3bd800c..0c3c647 --- a/src/subcommands/ma/add-certifier +++ b/src/subcommands/ma/add-certifier @@ -1,18 +1,21 @@ -#!/usr/bin/env bash +# -*-shell-script-*- +# This should be sourced by bash (though we welcome changes to make it POSIX sh compliant) # Monkeysphere authentication add-certifier subcommand # # The monkeysphere scripts are written by: -# Jameson Rollins +# Jameson Rollins # Jamie McClelland # Daniel Kahn Gillmor # -# They are Copyright 2008, and are all released under the GPL, version 3 -# or later. +# They are Copyright 2008-2009, and are all released under the GPL, +# version 3 or later. # retrieve key from web of trust, import it into the host keyring, and # ltsign the key in the host keyring so that it may certify other keys +add_certifier() { + local domain local trust local depth @@ -57,7 +60,7 @@ if [ -z "$keyID" ] ; then fi if [ -f "$keyID" ] ; then echo "Reading key from file '$keyID':" - importinfo=$(gpg_authentication "--import" < "$keyID" 2>&1) || failure "could not read key from '$keyID'" + importinfo=$(gpg_sphere "--import" < "$keyID" 2>&1) || failure "could not read key from '$keyID'" # FIXME: if this is tried when the key database is not # up-to-date, i got these errors (using set -x): @@ -80,13 +83,13 @@ if [ -f "$keyID" ] ; then fi else # get the key from the key server - gpg_authentication "--keyserver $KEYSERVER --recv-key '0x${keyID}!'" || failure "Could not receive a key with this ID from the '$KEYSERVER' keyserver." + gpg_sphere "--keyserver $KEYSERVER --recv-key '0x${keyID}!'" || failure "Could not receive a key with this ID from the '$KEYSERVER' keyserver." fi export keyID # get the full fingerprint of a key ID -fingerprint=$(gpg_authentication "--list-key --with-colons --with-fingerprint 0x${keyID}!" | \ +fingerprint=$(gpg_sphere "--list-key --with-colons --with-fingerprint 0x${keyID}!" | \ grep '^fpr:' | grep "$keyID" | cut -d: -f10) if [ -z "$fingerprint" ] ; then @@ -95,7 +98,7 @@ fi echo echo "key found:" -gpg_authentication "--fingerprint 0x${fingerprint}!" +gpg_sphere "--fingerprint 0x${fingerprint}!" echo "Are you sure you want to add the above key as a" read -p "certifier of users on this system? (y/N) " OK; OK=${OK:-N} @@ -104,7 +107,7 @@ if [ "${OK/y/Y}" != 'Y' ] ; then fi # export the key to the host keyring -gpg_authentication "--export 0x${fingerprint}!" | gpg_host --import +gpg_sphere "--export 0x${fingerprint}!" | gpg_core --import if [ "$trust" = marginal ]; then trustval=1 @@ -129,13 +132,15 @@ EOF # ltsign the key if echo "$ltsignCommand" | \ - gpg_host --quiet --command-fd 0 --edit-key "0x${fingerprint}!" ; then + gpg_core --quiet --command-fd 0 --edit-key "0x${fingerprint}!" ; then # update the trustdb for the authentication keyring - gpg_authentication "--check-trustdb" + gpg_sphere "--check-trustdb" echo echo "Identity certifier added." else failure "Problem adding identify certifier." fi + +}