m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-05-10 18:12:10 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-05-10 18:12:10 +0200
commit1d6ed690232de70c522226315b8b5a0e5c1706c1 (patch)
tree6b9b35b111c520d4ddeac16f5ba730a296ab3852
parent36a5583120ad8a6f939a8971284424d580c48ab2 (diff)
reencryption: Properly escape input to sed
-rwxr-xr-xsrc/password-store.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index 65283b8..7ef58bd 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -103,7 +103,7 @@ reencrypt_path() {
set_gpg_recipients "$passfile_dir"
if [[ $prev_gpg_recipients != "${GPG_RECIPIENTS[*]}" ]]; then
for index in "${!GPG_RECIPIENTS[@]}"; do
- local group="$(sed -n "s/^cfg:group:${GPG_RECIPIENTS[$index]}:\\(.*\\)\$/\\1/p" <<<"$groups" | head -n 1)"
+ local group="$(sed -n "s/^cfg:group:$(sed 's/[\/&]/\\&/g' <<<"${GPG_RECIPIENTS[$index]}"):\\(.*\\)\$/\\1/p" <<<"$groups" | head -n 1)"
[[ -z $group ]] && continue
IFS=";" eval 'GPG_RECIPIENTS+=( $group )' # http://unix.stackexchange.com/a/92190
unset GPG_RECIPIENTS[$index]