From 8019e159c585f0374bccac08f247830ac84ad2d4 Mon Sep 17 00:00:00 2001 From: Jameson Rollins Date: Fri, 29 Oct 2010 20:14:24 -0400 Subject: fix ssh_proxycommand marginal ui After the last big code cleanup, the bookkeeping of numbers of processed/valid keys was removed. This was done because most things don't use that info, and it was confusing return codes of top-level functions. The one thing that did use that, though, was the ssh_proxycommand. We fix this by using a global variable to keep track of the number of processed and valid keys. The proxy command can now easily determine when it should output it's marginal ui block. --- src/share/common | 7 +++++++ src/share/m/ssh_proxycommand | 36 ++++++++++-------------------------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/share/common b/src/share/common index b26b57e..025c991 100644 --- a/src/share/common +++ b/src/share/common @@ -841,6 +841,8 @@ process_keys_for_file() { esac fi + ((++KEYS_PROCESSED)) + # if key OK, add new key line if [ "$ok" -eq '0' ] ; then case "$FILE_TYPE" in @@ -862,8 +864,13 @@ process_keys_for_file() { else echo "$keyLine" >>"$keyFile" fi + + ((++KEYS_VALID)) fi done + + log debug "KEYS_PROCESSED=$KEYS_PROCESSED" + log debug "KEYS_VALID=$KEYS_VALID" } # process an authorized_user_ids file on stdin for authorized_keys diff --git a/src/share/m/ssh_proxycommand b/src/share/m/ssh_proxycommand index a4c01c6..15f52e0 100644 --- a/src/share/m/ssh_proxycommand +++ b/src/share/m/ssh_proxycommand @@ -53,6 +53,7 @@ EOF otherUids=$(echo "$gpgSigOut" | grep "^uid" | grep -v "$userID") if [ "$otherUids" ] ; then log info < 0)) && ((KEYS_VALID == 0)) ; then + log debug "output ssh marginal ui..." + output_no_valid_key +fi # FIXME: what about the case where monkeysphere successfully finds a # valid key for the host and adds it to the known_hosts file, but a -- cgit v1.2.3