+SWAN Solaris runsocks
authorshort <>
Wed, 7 Jan 2004 14:42:28 +0000 (14:42 +0000)
committershort <>
Wed, 7 Jan 2004 14:42:28 +0000 (14:42 +0000)
.bashrc
bin/runsocks [new file with mode: 0755]

diff --git a/.bashrc b/.bashrc
index 24121d4..6962315 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -108,6 +108,7 @@ export HISTSIZE=100000
 export HISTFILESIZE="$HISTSIZE"
 export CVS_RSH="ssh"
 grep -qw "$TERM" /etc/termcap || export TERM=vt220
+export SOCKS5_SERVER=icsocks.holland.sun.com
 
 # Force strcoll() to sort case-sensitively! (empty/undef doesn't work)
 export LC_COLLATE=C
diff --git a/bin/runsocks b/bin/runsocks
new file mode 100755 (executable)
index 0000000..adc8a57
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# Put the path to the socks shared library in our LD_LIBRARY_PATH so when we
+# preload the library, ld.so will find it...
+#
+if test -n "${SOCKS5_SHLIB_RUNPATH}" ; then
+       SOCKS5_SHLIB_RUNPATH="${SOCKS5_SHLIB_RUNPATH}/"
+elif test -n "/usr/local/lib"; then
+       SOCKS5_SHLIB_RUNPATH="/usr/local/lib/"
+else 
+       SOCKS5_SHLIB_RUNPATH="./"
+fi
+
+#
+# Some OS's use PRELOADS=lib while others use _RLD_LIST=lib:DEFAULT.  Hopefully 
+# this can handle all those cases.  At any rate, this is basically causing the
+# socks5 shared libary to be used to resolve symbols before other libraries,
+# hence we get socks's connect before we get libc's connect...
+#
+# Also, on SunOS 4*, LD_LIBRARY_PATH has no effect on, so we need to put the path
+# in front of it.  We make the path overridable with SOCKS5_SHLIB_RUNPATH...
+#
+case `uname -rs` in
+SunOS*4.*)
+       LD_PRELOAD=${SOCKS5_SHLIB_RUNPATH}libsocks5_sh.so
+       export LD_PRELOAD
+       ;;
+*)
+       if test -z "$LD_LIBRARY_PATH" ; then
+               LD_LIBRARY_PATH=${SOCKS5_SHLIB_RUNPATH}
+       else
+               LD_LIBRARY_PATH=${SOCKS5_SHLIB_RUNPATH}:${LD_LIBRARY_PATH}
+               export LD_LIBRARY_PATH
+       fi
+
+       LD_PRELOAD=libsocks5_sh.so
+       export LD_LIBRARY_PATH
+       ;;
+esac
+# 
+# Run the actual program...
+#
+export LD_PRELOAD
+exec "$@"