<NME> test_sessid.sh
<BEF> #!/bin/sh
PIDFILE=/tmp/tcpcrypt.pid

`dirname $0`/../launch_tcpcryptd.sh &
sleep 2
RES=$(curl http://tcpcrypt.org/sessid.php 2>/dev/null | grep -v NONE)
RET=$?
kill `cat $PIDFILE 2>/dev/null` > /dev/null 2>&1
rm -f $PIDFILE
echo "$RES"
exit $RET

<MSG> avoid symlink attacks in launch_tcpcryptd.sh

/tmp is world-writable -- if a non-privileged user creates a symlink
in /tmp/tcpcrypt.pid pointing to some file, then the superuser
executing launch_tcpcryptd.sh will truncate that file.

Modern systems will use /run or /var/run for this sort of thing,
rather than /tmp, since /var/run is not world-writable.

<DFF> @@ -1,5 +1,5 @@
 #!/bin/sh
-PIDFILE=/tmp/tcpcrypt.pid
+PIDFILE=/var/run/tcpcrypt.pid
 
 `dirname $0`/../launch_tcpcryptd.sh &
 sleep 2
@@ -8,4 +8,4 @@ RET=$?
 kill `cat $PIDFILE 2>/dev/null` > /dev/null 2>&1
 rm -f $PIDFILE
 echo "$RES"
-exit $RET
\ No newline at end of file
+exit $RET

avoid symlink attacks in launch_tcpcryptd.sh