/usr/bin/kwalletaskpass is in kwalletcli 2.11-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | #!/usr/bin/env mksh
# $MirOS: contrib/hosted/tg/code/kwalletcli/kwalletaskpass,v 1.6 2011/04/09 20:21:15 tg Exp $
#-
# Copyright © 2009, 2010, 2011
# Thorsten Glaser <tg@mirbsd.org>
#
# Provided that these terms and disclaimer and all copyright notices
# are retained or reproduced in an accompanying document, permission
# is granted to deal in this work without restriction, including un‐
# limited rights to use, publicly perform, distribute, sell, modify,
# merge, give away, or sublicence.
#
# This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
# the utmost extent permitted by applicable law, neither express nor
# implied; without malicious intent or gross negligence. In no event
# may a licensor, author or contributor be held liable for indirect,
# direct, other damage, loss, or other issues arising in any way out
# of dealing in the work, even if advised of the possibility of such
# damage or existence of a defect, except proven that it results out
# of said person’s immediate fault when using the work as intended.
unset LC_ALL LANGUAGE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES \
LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION
export LANG=C LC_CTYPE=en_US.UTF-8
set -U
if (( $# != 1 )); then
print -u2 wrong number of arguments
exit 127
fi
rv=1
trywallet=0
[[ -n $DISPLAY && $1 = 'Enter passphrase for '* ]] && trywallet=1
if (( trywallet )); then
blist=$(kwalletcli -q -f kwalletaskpass-blacklist -e "${1#Enter }")
[[ $blist = yes* ]] && trywallet=0
fi
if (( trywallet )); then
pw=$(kwalletcli -q -f kwalletaskpass -e "${1#Enter }")
rv=$?
fi
# whitelist of known binary queries
barg=
[[ $1 = 'Allow shared connection to '* || \
$1 = 'Terminate shared connection to '* || \
$1 = 'Open '*' on '*'?' || \
$1 = 'Allow forward to '* || \
$1 = 'Allow use of key '* ]] && barg=-b
if (( rv )); then
pw=$(kwalletcli_getpin -q $barg -t "$1")
rv=$?
if (( rv == 0 && trywallet )); then
q=${1#Enter }
q=${q%%:*([ ])}
if kwalletcli_getpin -qb -t "Store $q in the KDE Wallet?"; then
kwalletcli -q -f kwalletaskpass \
-e "${1#Enter }" -p "$pw"
else
kwalletcli -q -f kwalletaskpass-blacklist \
-e "${1#Enter }" -p yes
fi
fi
fi
case $rv {
(0) print -r -- "$pw"
exit 0 ;;
(1) exit 1 ;;
(*) exit 3 ;;
}
|