Oops. Clean version attached. -- [ Todd J. Troxell ,''`. Student, Debian GNU/Linux Developer, SysAdmin, Geek : :' : http://debian.org || http://rapidpacket.com/~xtat `. `' `- ]
diff -ru /tmp/anon-proxy-00.02.39/debian/anon-proxy.init /home/xtat/dev/anon-proxy/anon-proxy-00.02.39/debian/anon-proxy.init --- /tmp/anon-proxy-00.02.39/debian/anon-proxy.init 2005-02-06 23:48:51.274446520 -0500 +++ /home/xtat/dev/anon-proxy/anon-proxy-00.02.39/debian/anon-proxy.init 2005-02-06 23:42:39.778922424 -0500 @@ -15,6 +15,9 @@ DAEMON=/usr/sbin/proxytest NAME=anon-proxy DESC="Anonymising Proxy Service" +USER=anon-proxy +GROUP=nogroup +PIDFILE=/var/run/anon-proxy/proxytest.pid echo "!!! YOU HAVE TO CONFIGURE THE LOCAL PROXY PORT FIRST! CALL \"dpkg-reconfigure anon-proxy\" !!!" && exit 1 OPTIONS="-j -p #PORT# -n 132.199.134.2:3000 -a -d" @@ -26,13 +29,14 @@ case "$1" in start) echo -n "Starting $DESC: $NAME" - start-stop-daemon --start --quiet -c nobody:nogroup --pidfile /var/run/$NAME.pid \ - --exec $DAEMON -- $OPTIONS > /dev/null 2>&1 + start-stop-daemon --start --quiet -c $USER:$GROUP --pidfile $PIDFILE \ + --exec $DAEMON -- $OPTIONS > /dev/null 2>&1 || true + echo "." ;; stop) echo -n "Stopping $DESC: $NAME" - /usr/bin/killall -9 proxytest || exit 0 + start-stop-daemon --quiet --stop --pidfile $PIDFILE --exec $DAEMON || true echo "." ;; #reload) @@ -54,11 +58,10 @@ # just the same as "restart". # echo -n "Restarting $DESC: $NAME" - start-stop-daemon --stop --quiet --pidfile \ - /var/run/$NAME.pid --exec $DAEMON + start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON || true sleep 1 - start-stop-daemon --start --quiet --pidfile \ - /var/run/$NAME.pid --exec $DAEMON + start-stop-daemon --start --quiet -c $USER:$GROUP --pidfile $PIDFILE \ + --exec $DAEMON -- $OPTIONS > /dev/null 2>&1 || true echo "." ;; *) diff -ru /tmp/anon-proxy-00.02.39/debian/dirs /home/xtat/dev/anon-proxy/anon-proxy-00.02.39/debian/dirs --- /tmp/anon-proxy-00.02.39/debian/dirs 2005-02-06 23:48:51.312440744 -0500 +++ /home/xtat/dev/anon-proxy/anon-proxy-00.02.39/debian/dirs 2005-02-06 18:59:58.000000000 -0500 @@ -2,3 +2,4 @@ etc/init.d usr/share/doc usr/share/man/man8 +var/run/anon-proxy diff -ru /tmp/anon-proxy-00.02.39/debian/postinst /home/xtat/dev/anon-proxy/anon-proxy-00.02.39/debian/postinst --- /tmp/anon-proxy-00.02.39/debian/postinst 2005-02-06 23:48:51.313440592 -0500 +++ /home/xtat/dev/anon-proxy/anon-proxy-00.02.39/debian/postinst 2005-02-06 23:28:04.000000000 -0500 @@ -37,6 +37,11 @@ db_get anon-proxy/remember && START=$RET db_stop + if ! getent passwd anon-proxy > /dev/null; then + adduser --quiet --system --no-create-home \ + --home /var/run/anon-proxy anon-proxy || true + fi + cp /etc/init.d/anon-proxy /etc/init.d/anon-proxy.old sed -e "s/^.*dpkg-reconfigure.*$//" -e "s/\#PORT\#/$PORT/" \ /etc/init.d/anon-proxy.old > /etc/init.d/anon-proxy @@ -58,11 +63,15 @@ fi rm -f $EE.tmp + if dpkg --compare-versions "$2" lt "0.02.39-4"; then + if [ -d /var/run/anon-proxy ]; then + chown anon-proxy /var/run/anon-proxy || true + fi + fi update-rc.d anon-proxy defaults 20 >/dev/null 2>&1 if [ "$START" = "true" ] ; then - /etc/init.d/anon-proxy stop - /etc/init.d/anon-proxy start + /etc/init.d/anon-proxy restart fi; ;; diff -ru /tmp/anon-proxy-00.02.39/debian/postrm /home/xtat/dev/anon-proxy/anon-proxy-00.02.39/debian/postrm --- /tmp/anon-proxy-00.02.39/debian/postrm 2005-02-06 23:48:51.353434512 -0500 +++ /home/xtat/dev/anon-proxy/anon-proxy-00.02.39/debian/postrm 2005-02-06 22:27:09.000000000 -0500 @@ -19,15 +19,20 @@ case "$1" in - purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + purge) update-rc.d -f anon-proxy remove >/dev/null 2>&1 - if [ "$1" = "purge" -a -e /usr/share/debconf/confmodule ]; then + if [ -e /usr/share/debconf/confmodule ]; then # Source debconf library. . /usr/share/debconf/confmodule # Remove my changes to the db. db_purge fi - + + deluser --remove-home anon-proxy > /dev/null 2>&1 || true + + ;; + + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; Only in /home/xtat/dev/anon-proxy/anon-proxy-00.02.39: .deps Only in /home/xtat/dev/anon-proxy/anon-proxy-00.02.39: Makefile diff -ru /tmp/anon-proxy-00.02.39/proxytest.cpp /home/xtat/dev/anon-proxy/anon-proxy-00.02.39/proxytest.cpp --- /tmp/anon-proxy-00.02.39/proxytest.cpp 2005-02-06 23:48:51.355434208 -0500 +++ /home/xtat/dev/anon-proxy/anon-proxy-00.02.39/proxytest.cpp 2005-02-06 21:38:51.000000000 -0500 @@ -62,6 +62,9 @@ #include "CAFirstMixNewProtocol.hpp" #include "CALastMixNewProtocol.hpp" #endif + +#define PIDFILE "/var/run/anon-proxy/proxytest.pid" + //#include "CAPayment.hpp" //#ifdef _WIN32 //HANDLE hEventThreadEnde; @@ -367,7 +370,8 @@ // UINT16 timestamp; // currentTimestamp((UINT8*)×tamp); pMix=NULL; - + // PID File + FILE *pf; int i; SINT32 maxFiles; //Setup Routines @@ -657,6 +661,11 @@ pid=fork(); if(pid!=0) exit(0); + pf = fopen(PIDFILE, "w"); + if (pf == NULL) + fprintf(stderr, "Unable to write pidfile.\n"); + fprintf(pf, "%d\n", getpid()); + fclose(pf); setsid(); #ifndef DO_TRACE chdir("/");
signature.asc
Description: Digital signature