commit 127b41cc3d02759bf3154ce81cf549938190131a from: Alexander Arkhipov date: Sun Dec 31 09:58:45 2023 UTC attempt making pm2gpm a bit more secure commit - 6201fa4d86dda4403f9ba41ada5e6634403cb02c commit + 127b41cc3d02759bf3154ce81cf549938190131a blob - 25103fb8fabf19a0bcbffea02011095bcad5968f blob + 2aeffa86852e766a8f3396cf8e063ad4f080e24d --- pm2gpm +++ pm2gpm @@ -1,12 +1,17 @@ -#!/bin/sh -e +#!/bin/sh -stty -echo -printf pass:; IFS= read -r pass; echo -stty echo +files=$(pm l | tr \\n ' ') +awk -vfiles="$files" -vstty="$(stty -g)" ' + BEGIN { + system("stty -echo") + printf("pass:") + getline pass + system("stty " stty) -for f in $(pm l); do - printf %s\\n "$pass" | pm s "$f" | gpm "$@" add "$f" + split(files, a) + for (f in a) + print pass + } +' | for f in $files; do + pm s "$f" | gpm "$@" add "$f" done - -# The script might have been sourced. -pass=