Fix for "local" socket host name

if -h local is set, be sure to never set -h flag so we use the socket
and not host connection.

Needed for trust with socket flow (sudo -u)
This commit is contained in:
2022-01-17 15:12:12 +09:00
parent e787fb2370
commit fb092feabc
2 changed files with 5 additions and 2 deletions

View File

@@ -110,7 +110,7 @@ while getopts ":o:d:h:f:p:e:i:j:raqnms" opt; do
fi; fi;
;; ;;
h|hostname) h|hostname)
if [ -z "$host" ]; then if [ -z "$_host" ]; then
# if local it is socket # if local it is socket
if [ "$OPTARG" != "local" ]; then if [ "$OPTARG" != "local" ]; then
host='-h '$OPTARG; host='-h '$OPTARG;

View File

@@ -81,7 +81,10 @@ while getopts ":f:j:h:p:e:granm" opt; do
;; ;;
h|hostname) h|hostname)
if [ -z "$host" ]; then if [ -z "$host" ]; then
host='-h '$OPTARG; # do not set if local name (uses socket)
if [ "$OPTARG" != "local" ]; then
host='-h '$OPTARG;
fi;
_host=$OPTARG; _host=$OPTARG;
HOST=$OPRTARG; HOST=$OPRTARG;
fi; fi;