add ZPASS_RAND_SET config
This commit is contained in:
parent
ac7bbae78a
commit
5523b28a83
3 changed files with 6 additions and 3 deletions
|
|
@ -33,6 +33,7 @@ ZPASS_KEY_CACHE_TIME=${ZPASS_KEY_CACHE_TIME-60}
|
|||
ZPASS_CLIPBOARD_TIME=${ZPASS_CLIPBOARD_TIME-30}
|
||||
ZPASS_UNK_OP_CALL=${ZPASS_UNK_OP_CALL-copy}
|
||||
ZPASS_RAND_LEN=${ZPASS_RAND_LEN-20}
|
||||
ZPASS_RAND_SET=${ZPASS_RAND_SET-'a-zA-Z0-9\!-.'}
|
||||
|
||||
# datapath resolution
|
||||
# remove tildes
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ usage()
|
|||
ZPASS_CLIPBOARD_TIME '30' Time until clipboard gets cleared after copy, in seconds
|
||||
ZPASS_UNK_OP_CALL 'copy' Operation to call on unrecognized first argument
|
||||
ZPASS_RAND_LEN '20' Length of random passwords generated by 'new'
|
||||
ZPASS_RAND_SET 'a-zA-Z0-9\!-.' Character set to use for 'new' generation
|
||||
ZPASS_REMOTE_METHOD 'scp' Method to use for remote file. scp/sftp/ftps/webdav
|
||||
ZPASS_REMOTE_ADDR Server the file is on
|
||||
ZPASS_REMOTE_PORT Server port
|
||||
|
|
|
|||
|
|
@ -47,13 +47,14 @@ new()
|
|||
[ $# -lt 1 ] && return 1
|
||||
archive_exec sh -c '#LXSH_PARSE_MINIFY
|
||||
len=$1
|
||||
shift 1
|
||||
rset=$2
|
||||
shift 2
|
||||
for N
|
||||
do
|
||||
mkdir -p "$(dirname "$N")" || exit $?
|
||||
{ tr -cd "a-zA-Z0-9\!-." < /dev/urandom | head -c$len && echo; } > "$N" || exit $?
|
||||
{ tr -cd "$rset" < /dev/urandom | head -c$len && echo; } > "$N" || exit $?
|
||||
done
|
||||
' zpass "$ZPASS_RAND_LEN" "$@"
|
||||
' zpass "$ZPASS_RAND_LEN" "$ZPASS_RAND_SET" "$@"
|
||||
}
|
||||
|
||||
# $1 = path , $@ = value
|
||||
|
|
|
|||
Loading…
Reference in a new issue