merged changes from Jamie McClelland.
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Tue, 5 Aug 2008 18:15:41 +0000 (14:15 -0400)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Tue, 5 Aug 2008 18:15:41 +0000 (14:15 -0400)
1  2 
src/seckey2sshagent

diff --combined src/seckey2sshagent
index 2febff8d00a4144542b5a73bf1c0b62b6fec2e27,b7b7ec29dec006c9d24e4d69a18e75903d1e8e72..4b765dc1aae94f16eb42b2654935a751bee98a1e
@@@ -57,7 -57,7 +57,7 @@@ You can check on it with
  
  # if no hex string is supplied, just print an explanation.
  # this covers seckey2sshagent --help, --usage, -h, etc...
- if [ "$(echo "$1" | tr -d '0-9a-fA-F')" ]; then
+ if [  "$(echo "$1" | tr -d '0-9a-fA-F')" ]; then
      explanation
      exit
  fi
@@@ -67,13 -67,8 +67,13 @@@ trap cleanup EXI
  GPGIDS="$1"
  
  if [ -z "$GPGIDS" ]; then
 +    # hack: we need to get the list of secret keys, because if you
 +    # --list-secret-keys with no arguments, GPG fails to print the
 +    # capability flags (i've just filed this as
 +    # https://bugs.g10code.com/gnupg/issue945)
 +    KEYIDS=$(gpg2 --with-colons --list-secret-keys | grep ^sec | cut -f5 -d:)
      # default to using all fingerprints of authentication-enabled keys 
 -    GPGIDS=$(gpg  --with-colons --fingerprint --fingerprint --list-secret-keys | egrep -A1 '^(ssb|sec):.*:[^:]*a[^:]*:$' | grep ^fpr: | cut -d: -f10)
 +    GPGIDS=$(gpg  --with-colons --fingerprint --fingerprint --list-secret-keys $KEYIDS | egrep -A1 '^(ssb|sec):.*:[^:]*a[^:]*:$' | grep ^fpr: | cut -d: -f10)
  fi
  
  for GPGID in $GPGIDS; do