Skip to content
This repository was archived by the owner on Nov 4, 2022. It is now read-only.

Commit 4ef332d

Browse files
author
Maximilian Habryka
committed
stenocurl: don't override PATH
1 parent 3545c54 commit 4ef332d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

stenocurl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if [ -z "$JQ" ]; then
2626
fi
2727

2828
if [ "$#" -lt 1 -o "${1:0:1}" != "/" ]; then
29-
/bin/cat >&2 <<EOF
29+
cat >&2 <<EOF
3030
USAGE: $0 /<path> [curl args...]
3131
3232
Runs 'curl' against https://stenographerserver/path, returning data on STDOUT.
@@ -39,13 +39,13 @@ the results through tcpdump for easier handling.
3939
EOF
4040
exit 1
4141
fi
42-
PATH="$1" # starts with '/'
42+
URLPATH="$1" # starts with '/'
4343
shift
4444

4545
STENOGRAPHER_CONFIG="${STENOGRAPHER_CONFIG-/etc/stenographer/config}"
4646

4747
if [ ! -r "$STENOGRAPHER_CONFIG" ]; then
48-
/bin/cat >&2 <<EOF
48+
cat >&2 <<EOF
4949
Unable to access stenographer config at '$STENOGRAPHER_CONFIG'. You may need
5050
to set the STENOGRAPHER_CONFIG environmental variable to point to the correct
5151
location of your config, or you may need to request read access to that file.
@@ -60,20 +60,20 @@ if [ -z "$PORT" -o -z "$CERTPATH" ]; then
6060
echo "Unable to get port ($PORT) or certpath ($CERTPATH) from config ($STENOGRAPHER_CONFIG)" >&2
6161
exit 1
6262
fi
63-
URL="https://$HOST:$PORT$PATH" # PATH already starts with /
63+
URL="https://$HOST:$PORT$URLPATH" # URLPATH already starts with /
6464

65-
if ! /bin/cat "$CERTPATH/client_key.pem" > /dev/null; then
65+
if ! cat "$CERTPATH/client_key.pem" > /dev/null; then
6666
echo "You do not have permission to access Stenographer data" >&2
67-
/bin/ls -l "$CERTPATH/client_key.pem" >&2
67+
ls -l "$CERTPATH/client_key.pem" >&2
6868
while [ "$CERTPATH" != "/" ]; do
69-
CERTPATH="$(/usr/bin/dirname "$CERTPATH")"
70-
/bin/ls -l -d "$CERTPATH" >&2
69+
CERTPATH="$(dirname "$CERTPATH")"
70+
ls -l -d "$CERTPATH" >&2
7171
done
72-
echo -e "Your permissions: user=$(/usr/bin/id -n -u) groups=$(/usr/bin/groups)" >&2
72+
echo -e "Your permissions: user=$(id -n -u) groups=$(groups)" >&2
7373
exit 1
7474
fi
7575

76-
/usr/bin/curl \
76+
curl \
7777
--cert "$CERTPATH/client_cert.pem" \
7878
--key "$CERTPATH/client_key.pem" \
7979
--cacert "$CERTPATH/ca_cert.pem" \

0 commit comments

Comments
 (0)