From 658b20d919d3498111efd5a6e901d3ab19d8e669 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Thu, 11 Nov 2010 17:29:27 -0500 Subject: universalize and consolidate on --fixed-list-mode --- src/share/common | 2 +- src/share/m/ssh_proxycommand | 2 +- src/share/m/subkey_to_ssh_agent | 11 +++++++---- src/share/ma/diagnostics | 2 +- src/share/ma/list_certifiers | 2 +- src/share/ma/setup | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src/share') diff --git a/src/share/common b/src/share/common index b9a20ef..baf4270 100644 --- a/src/share/common +++ b/src/share/common @@ -654,7 +654,7 @@ process_user_id() { gpg_fetch_userid "$userID" # output gpg info for (exact) userid and store - gpgOut=$(gpg --list-key --fixed-list-mode --with-colon \ + gpgOut=$(gpg --list-key --fixed-list-mode --with-colons \ --with-fingerprint --with-fingerprint \ ="$userID" 2>/dev/null) || returnCode="$?" diff --git a/src/share/m/ssh_proxycommand b/src/share/m/ssh_proxycommand index 3ac70e1..8c71870 100644 --- a/src/share/m/ssh_proxycommand +++ b/src/share/m/ssh_proxycommand @@ -217,7 +217,7 @@ output_no_valid_key() { fi # get the gpg info for userid - gpgOut=$(gpg_user --list-key --fixed-list-mode --with-colon \ + gpgOut=$(gpg_user --list-key --with-colons \ --with-fingerprint --with-fingerprint \ ="$userID" 2>/dev/null) diff --git a/src/share/m/subkey_to_ssh_agent b/src/share/m/subkey_to_ssh_agent index 36eab4f..79291b1 100644 --- a/src/share/m/subkey_to_ssh_agent +++ b/src/share/m/subkey_to_ssh_agent @@ -47,7 +47,7 @@ subkey_to_ssh_agent() { else # get list of secret keys # (to work around bug https://bugs.g10code.com/gnupg/issue945): - secretkeys=$(gpg_user --list-secret-keys --with-colons --fixed-list-mode \ + secretkeys=$(gpg_user --list-secret-keys --with-colons \ --fingerprint | \ grep '^fpr:' | cut -f10 -d: | awk '{ print "0x" $1 "!" }') @@ -56,7 +56,7 @@ subkey_to_ssh_agent() { You might want to run 'gpg --gen-key'." fi - authsubkeys=$(gpg_user --list-secret-keys --with-colons --fixed-list-mode \ + authsubkeys=$(gpg_user --list-secret-keys --with-colons \ --fingerprint --fingerprint $secretkeys | \ cut -f1,5,10,12 -d: | grep -A1 '^ssb:[^:]*::[^:]*a[^:]*$' | \ grep '^fpr::' | cut -f3 -d: | sort -u) @@ -78,7 +78,7 @@ You might want to run 'monkeysphere gen-subkey'." for subkey in $authsubkeys; do # test that the subkey has proper capability - capability=$(gpg_user --list-secret-keys --with-colons --fixed-list-mode \ + capability=$(gpg_user --list-secret-keys --with-colons \ --fingerprint --fingerprint "0x${subkey}!" \ | egrep -B 1 "^fpr:::::::::${subkey}:$" | grep "^ssb:" | cut -d: -f12) if ! check_capability "$capability" 'a' ; then @@ -91,7 +91,10 @@ You might want to run 'monkeysphere gen-subkey'." # fingerprint, but filtering out all / characters to make sure # the filename is legit. - primaryuid=$(gpg_user --with-colons --list-key "0x${subkey}!" | grep '^pub:' | cut -f10 -d: | tr -d /) + # FIXME: this assumes that the first listed uid is the primary + # UID. does gpg guarantee that? is there some better way to + # get this info? + primaryuid=$(gpg_user --with-colons --list-key "0x${subkey}!" | grep '^uid:' | head -n1 | cut -f10 -d: | tr -d /) #kname="[monkeysphere] $primaryuid" kname="$primaryuid" diff --git a/src/share/ma/diagnostics b/src/share/ma/diagnostics index 8eca586..fadb70d 100644 --- a/src/share/ma/diagnostics +++ b/src/share/ma/diagnostics @@ -51,7 +51,7 @@ fi # sshd_config lives? sshd_config=/etc/ssh/sshd_config -seckey=$(gpg_core --list-secret-keys --fingerprint --with-colons --fixed-list-mode) +seckey=$(gpg_core --list-secret-keys --fingerprint --with-colons) keysfound=$(echo "$seckey" | grep -c ^sec:) curdate=$(date +%s) # warn when anything is 2 months away from expiration diff --git a/src/share/ma/list_certifiers b/src/share/ma/list_certifiers index 56d52da..0a8f4df 100644 --- a/src/share/ma/list_certifiers +++ b/src/share/ma/list_certifiers @@ -38,7 +38,7 @@ authgrip=$(core_fingerprint | cut -b 25-40) # fingerprint, the trust depth, the trust level (60 == marginal, 120 # == full), and the domain regex (if any): -gpg_sphere --fingerprint --with-colons --fixed-list-mode --check-sigs | \ +gpg_sphere --fingerprint --with-colons --check-sigs | \ cut -f 1,2,5,8,9,10 -d: | \ egrep '^(fpr:::::|uat:|uid:|sig:!:'"$authgrip"':[[:digit:]]+ [[:digit:]]+:)' | \ while IFS=: read -r type validity grip trustparams trustdomain fpr ; do diff --git a/src/share/ma/setup b/src/share/ma/setup index 5cc3aab..9a047aa 100644 --- a/src/share/ma/setup +++ b/src/share/ma/setup @@ -110,7 +110,7 @@ EOF # our preferences are reasonable (i.e. 3 marginal OR 1 fully # trusted certifications are sufficient to grant full validity. log debug "checking trust model for authentication ..." - local TRUST_MODEL=$(gpg_sphere "--with-colons --fixed-list-mode --list-keys" 2>/dev/null \ + local TRUST_MODEL=$(gpg_sphere "--with-colons --list-keys" 2>/dev/null \ | head -n1 | grep "^tru:" | cut -d: -f3,6,7) log debug "sphere trust model: $TRUST_MODEL" if [ "$TRUST_MODEL" != '1:3:1' ] ; then -- cgit v1.2.3