mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 15:32:35 +00:00
Shell scripts are now headed with: env /usr/bin/env bash
This commit is contained in:
parent
14f3e4fed8
commit
fbd72c295d
9 changed files with 21 additions and 17 deletions
5
CHANGES
5
CHANGES
|
@ -61,6 +61,11 @@ porting:
|
||||||
functions and dependend option openssl-method can still be
|
functions and dependend option openssl-method can still be
|
||||||
used when configuring socat with --enable-openssl-method
|
used when configuring socat with --enable-openssl-method
|
||||||
|
|
||||||
|
Shell scripts in socat distribution are now headed with:
|
||||||
|
#! /usr/bin/env bash
|
||||||
|
to make them better portable to systems without /bin/bash
|
||||||
|
Thanks to Maya Rashish for sending a patch
|
||||||
|
|
||||||
testing:
|
testing:
|
||||||
test.sh: Show a warning when phase-1 (insecure phase) of a security
|
test.sh: Show a warning when phase-1 (insecure phase) of a security
|
||||||
test fails
|
test fails
|
||||||
|
|
3
FAQ
3
FAQ
|
@ -24,8 +24,7 @@ Q: I succeeded to configure and make socat, but ./test.sh says something
|
||||||
like:
|
like:
|
||||||
./test.sh: No such file or directory
|
./test.sh: No such file or directory
|
||||||
|
|
||||||
A: You need a bash shell, and its location must be correctly specified in the
|
A: You need a bash shell in your executable path (locations in $PATH)
|
||||||
first line of test.sh, e.g. /usr/local/bin/bash instead of /bin/bash.
|
|
||||||
|
|
||||||
|
|
||||||
Q: configure disables readline / openssl / libwrap support because it does not
|
Q: configure disables readline / openssl / libwrap support because it does not
|
||||||
|
|
2
proxy.sh
2
proxy.sh
|
@ -1,4 +1,4 @@
|
||||||
#! /bin/bash
|
#! /usr/bin/env bash
|
||||||
# source: proxy.sh
|
# source: proxy.sh
|
||||||
# Copyright Gerhard Rieger and contributors (see file CHANGES)
|
# Copyright Gerhard Rieger and contributors (see file CHANGES)
|
||||||
# Published under the GNU General Public License V.2, see file COPYING
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#! /bin/bash
|
#! /usr/bin/env bash
|
||||||
# source: proxyecho.sh
|
# source: proxyecho.sh
|
||||||
# Copyright Gerhard Rieger and contributors (see file CHANGES)
|
# Copyright Gerhard Rieger and contributors (see file CHANGES)
|
||||||
# Published under the GNU General Public License V.2, see file COPYING
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#! /bin/bash
|
#! /usr/bin/env bash
|
||||||
# source: readline-test.sh
|
# source: readline-test.sh
|
||||||
# Copyright Gerhard Rieger and contributors (see file CHANGES)
|
# Copyright Gerhard Rieger and contributors (see file CHANGES)
|
||||||
# Published under the GNU General Public License V.2, see file COPYING
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#! /bin/bash
|
#! /usr/bin/env bash
|
||||||
# source: readline.sh
|
# source: readline.sh
|
||||||
# Copyright Gerhard Rieger and contributors (see file CHANGES)
|
# Copyright Gerhard Rieger and contributors (see file CHANGES)
|
||||||
# Published under the GNU General Public License V.2, see file COPYING
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#! /bin/bash
|
#! /usr/bin/env bash
|
||||||
# source: socks4a-echo.sh
|
# source: socks4a-echo.sh
|
||||||
#set -vx
|
#set -vx
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#! /bin/bash
|
#! /usr/bin/env bash
|
||||||
# source: socks4echo.sh
|
# source: socks4echo.sh
|
||||||
|
|
||||||
# Copyright Gerhard Rieger and contributors (see file CHANGES)
|
# Copyright Gerhard Rieger and contributors (see file CHANGES)
|
||||||
|
|
18
test.sh
18
test.sh
|
@ -1,4 +1,4 @@
|
||||||
#! /bin/bash
|
#! /usr/bin/env bash
|
||||||
# source: test.sh
|
# source: test.sh
|
||||||
# Copyright Gerhard Rieger and contributors (see file CHANGES)
|
# Copyright Gerhard Rieger and contributors (see file CHANGES)
|
||||||
# Published under the GNU General Public License V.2, see file COPYING
|
# Published under the GNU General Public License V.2, see file COPYING
|
||||||
|
@ -750,7 +750,7 @@ for addr in proxy; do
|
||||||
done
|
done
|
||||||
echo $OPTS
|
echo $OPTS
|
||||||
# prepare dummy server
|
# prepare dummy server
|
||||||
$SOCAT tcp-l:$PORT,reuseaddr,crlf exec:"/bin/bash proxyecho.sh" || echo "cannot start proxyecho.sh" >&2 &
|
$SOCAT tcp-l:$PORT,reuseaddr,crlf exec:"/usr/bin/env bash proxyecho.sh" || echo "cannot start proxyecho.sh" >&2 &
|
||||||
pid=$!
|
pid=$!
|
||||||
sleep 1
|
sleep 1
|
||||||
for o in $(filloptionvalues $OPTS|tr ',' ' '); do
|
for o in $(filloptionvalues $OPTS|tr ',' ' '); do
|
||||||
|
@ -1951,7 +1951,7 @@ waitip4proto () {
|
||||||
while [ $timeout -gt 0 ]; do
|
while [ $timeout -gt 0 ]; do
|
||||||
case "$UNAME" in
|
case "$UNAME" in
|
||||||
Linux) if [ "$SS" ]; then
|
Linux) if [ "$SS" ]; then
|
||||||
l=$($SS -n -w -l |grep '^raw .* .*[0-9*]:'$proto' [ ]*0\.0\.0\.0:\*')
|
l=$($SS -n -w -l |grep '^\(raw\|UNCONN\) .* .*[0-9*]:'$proto' [ ]*0\.0\.0\.0:\*')
|
||||||
else
|
else
|
||||||
l=$(netstat -n -w -l |grep '^raw .* .*[0-9*]:'$proto' [ ]*0\.0\.0\.0:\*')
|
l=$(netstat -n -w -l |grep '^raw .* .*[0-9*]:'$proto' [ ]*0\.0\.0\.0:\*')
|
||||||
fi ;;
|
fi ;;
|
||||||
|
@ -1997,7 +1997,7 @@ waitip6proto () {
|
||||||
case "$UNAME" in
|
case "$UNAME" in
|
||||||
Linux)
|
Linux)
|
||||||
if [ "$SS" ]; then
|
if [ "$SS" ]; then
|
||||||
l=$($SS -n -w -l |grep '^raw .* .*[0-9*]:'$proto' [ ]*0\.0\.0\.0:\*')
|
l=$($SS -n -w -l |grep '^\(raw\|UNCONN\) .* \*:'$proto' [ ]*\*:\*')
|
||||||
else
|
else
|
||||||
l=$(netstat -n -w -l |grep '^raw[6 ] .* .*:[0-9*]*:'$proto' [ ]*:::\*')
|
l=$(netstat -n -w -l |grep '^raw[6 ] .* .*:[0-9*]*:'$proto' [ ]*:::\*')
|
||||||
fi ;;
|
fi ;;
|
||||||
|
@ -4648,7 +4648,7 @@ te="$td/test$N.stderr"
|
||||||
tdiff="$td/test$N.diff"
|
tdiff="$td/test$N.diff"
|
||||||
da="test$N $(date) $RANDOM"; da="$da$($ECHO '\r')"
|
da="test$N $(date) $RANDOM"; da="$da$($ECHO '\r')"
|
||||||
#CMD2="$TRACE $SOCAT tcp4-l:$PORT,crlf SYSTEM:\"read; read; $ECHO \\\"HTTP/1.0 200 OK\n\\\"; cat\""
|
#CMD2="$TRACE $SOCAT tcp4-l:$PORT,crlf SYSTEM:\"read; read; $ECHO \\\"HTTP/1.0 200 OK\n\\\"; cat\""
|
||||||
CMD2="$TRACE $SOCAT $opts tcp4-l:$PORT,reuseaddr,crlf exec:\"/bin/bash proxyecho.sh\""
|
CMD2="$TRACE $SOCAT $opts tcp4-l:$PORT,reuseaddr,crlf exec:\"/usr/bin/env bash proxyecho.sh\""
|
||||||
CMD="$TRACE $SOCAT $opts - proxy:$LOCALHOST:127.0.0.1:1000,pf=ip4,proxyport=$PORT"
|
CMD="$TRACE $SOCAT $opts - proxy:$LOCALHOST:127.0.0.1:1000,pf=ip4,proxyport=$PORT"
|
||||||
printf "test $F_n $TEST... " $N
|
printf "test $F_n $TEST... " $N
|
||||||
eval "$CMD2 2>\"${te}2\" &"
|
eval "$CMD2 2>\"${te}2\" &"
|
||||||
|
@ -4694,7 +4694,7 @@ te="$td/test$N.stderr"
|
||||||
tdiff="$td/test$N.diff"
|
tdiff="$td/test$N.diff"
|
||||||
da="test$N $(date) $RANDOM"; da="$da$($ECHO '\r')"
|
da="test$N $(date) $RANDOM"; da="$da$($ECHO '\r')"
|
||||||
#CMD2="$TRACE $SOCAT $opts tcp6-l:$PORT,crlf SYSTEM:\"read; read; $ECHO \\\"HTTP/1.0 200 OK\n\\\"; cat\""
|
#CMD2="$TRACE $SOCAT $opts tcp6-l:$PORT,crlf SYSTEM:\"read; read; $ECHO \\\"HTTP/1.0 200 OK\n\\\"; cat\""
|
||||||
CMD2="$TRACE $SOCAT $opts tcp6-l:$PORT,reuseaddr,crlf exec:\"/bin/bash proxyecho.sh\""
|
CMD2="$TRACE $SOCAT $opts tcp6-l:$PORT,reuseaddr,crlf exec:\"/usr/bin/env bash proxyecho.sh\""
|
||||||
CMD="$TRACE $SOCAT $opts - proxy:$LOCALHOST6:127.0.0.1:1000,proxyport=$PORT"
|
CMD="$TRACE $SOCAT $opts - proxy:$LOCALHOST6:127.0.0.1:1000,proxyport=$PORT"
|
||||||
printf "test $F_n $TEST... " $N
|
printf "test $F_n $TEST... " $N
|
||||||
eval "$CMD2 2>\"${te}2\" &"
|
eval "$CMD2 2>\"${te}2\" &"
|
||||||
|
@ -4928,7 +4928,7 @@ te="$td/test$N.stderr"
|
||||||
tdiff="$td/test$N.diff"
|
tdiff="$td/test$N.diff"
|
||||||
da="test$N $(date) $RANDOM"; da="$da$($ECHO '\r')"
|
da="test$N $(date) $RANDOM"; da="$da$($ECHO '\r')"
|
||||||
#CMD2="$TRACE $SOCAT $opts tcp-l:$PORT,crlf SYSTEM:\"read; read; $ECHO \\\"HTTP/1.0 200 OK\n\\\"; cat\""
|
#CMD2="$TRACE $SOCAT $opts tcp-l:$PORT,crlf SYSTEM:\"read; read; $ECHO \\\"HTTP/1.0 200 OK\n\\\"; cat\""
|
||||||
CMD2="$TRACE $SOCAT $opts tcp4-l:$PORT,reuseaddr,crlf exec:\"/bin/bash proxyecho.sh -w 2\""
|
CMD2="$TRACE $SOCAT $opts tcp4-l:$PORT,reuseaddr,crlf exec:\"/usr/bin/env bash proxyecho.sh -w 2\""
|
||||||
CMD="$TRACE $SOCAT $opts - proxy:$LOCALHOST:127.0.0.1:1000,pf=ip4,proxyport=$PORT"
|
CMD="$TRACE $SOCAT $opts - proxy:$LOCALHOST:127.0.0.1:1000,pf=ip4,proxyport=$PORT"
|
||||||
printf "test $F_n $TEST... " $N
|
printf "test $F_n $TEST... " $N
|
||||||
eval "$CMD2 2>\"${te}1\" &"
|
eval "$CMD2 2>\"${te}1\" &"
|
||||||
|
@ -6436,10 +6436,10 @@ tp="$td/test$N.pid"
|
||||||
$PRINTF "test $F_n $TEST... " $N
|
$PRINTF "test $F_n $TEST... " $N
|
||||||
(sleep 1; kill -"$SIG" "$(cat "$tpp")") &
|
(sleep 1; kill -"$SIG" "$(cat "$tpp")") &
|
||||||
# a simple "system:echo $PPID..." does not work on NetBSD, OpenBSD
|
# a simple "system:echo $PPID..." does not work on NetBSD, OpenBSD
|
||||||
#$TRACE $SOCAT $opts echo SYSTEM:'exec /bin/bash -c "echo \$PPID '">$tpp"'; echo \$$ '">$tp; read x\"",nofork 2>"$te"; stat=$?
|
#$TRACE $SOCAT $opts echo SYSTEM:'exec /usr/bin/env bash -c "echo \$PPID '">$tpp"'; echo \$$ '">$tp; read x\"",nofork 2>"$te"; stat=$?
|
||||||
tsh="$td/test$N.sh"
|
tsh="$td/test$N.sh"
|
||||||
cat <<EOF >"$tsh"
|
cat <<EOF >"$tsh"
|
||||||
#! /bin/bash
|
#! /usr/bin/env bash
|
||||||
echo \$PPID >"$tpp"
|
echo \$PPID >"$tpp"
|
||||||
echo \$\$ >"$tp"
|
echo \$\$ >"$tp"
|
||||||
read x
|
read x
|
||||||
|
|
Loading…
Reference in a new issue