Fix: mod_pass binary requirement and ssh key search improvment

This commit is contained in:
mrjk 2018-03-01 22:31:25 -05:00
parent ea34261619
commit ab46eae784
2 changed files with 23 additions and 3 deletions

View File

@ -6,6 +6,14 @@ IDM_MOD_DEPS="id gpg"
## Pass functions ## Pass functions
########################################## ##########################################
idm_pass_header ()
{
local id=$1
lib_require_bin pass || idm_exit 1
}
idm_pass () idm_pass ()
{ {
#set -x #set -x
@ -21,6 +29,7 @@ idm_pass ()
fi fi
# Interncal override case # Interncal override case
idm_pass_header $id
# Fallback to command # Fallback to command
lib_id_is_enabled $id lib_id_is_enabled $id
@ -32,6 +41,7 @@ idm_pass__ls ()
{ {
local id=${1} local id=${1}
lib_id_is_enabled $id || return 0 lib_id_is_enabled $id || return 0
idm_pass_header $id
{ {
PASSWORD_STORE_DIR=~/.config/pass/${id} \ PASSWORD_STORE_DIR=~/.config/pass/${id} \

View File

@ -226,12 +226,22 @@ idm_ssh_add ()
lib_id_is_enabled $id lib_id_is_enabled $id
if [[ ! -z $key ]]; then if [[ ! -z "$key" ]]; then
pub_keys=$(find ~/.ssh/id -maxdepth $maxdepth -name "${id}_*" -name '*pub' -name "*$1*" | sort) pub_keys=$(
{
# Compat mode
find ~/.ssh/id -maxdepth $maxdepth -name "${id}_*" -name '*pub' -name "*$1*" | sort
# New mode (test)
find ~/.ssh/$id -maxdepth $maxdepth -name "${id}_*" -name '*pub' -name "*$1*" | sort
} | sort | uniq
)
else else
pub_keys=$(find ~/.ssh/id -maxdepth $maxdepth -name "${id}_*" -name '*pub' | sort) pub_keys=$(find ~/.ssh/$id -maxdepth $maxdepth -name "${id}_*" -name '*pub' | sort)
fi fi
echo "$pub_keys"
# Get list of key # Get list of key
local key_list="" local key_list=""
while read -r pub_key; do while read -r pub_key; do