[or-cvs] r19128: {torvm} Fix flyspray 945 and 946 until Vidalia integration improved; (in torvm/trunk/build: kamikaze/patches win32/patches win32/src/torvm-w32)
coderman at seul.org
coderman at seul.org
Wed Mar 25 15:33:31 UTC 2009
Author: coderman
Date: 2009-03-25 11:33:31 -0400 (Wed, 25 Mar 2009)
New Revision: 19128
Modified:
torvm/trunk/build/kamikaze/patches/001-kamikaze-tor-package.patch
torvm/trunk/build/kamikaze/patches/002-kamikaze-mod-basefiles.patch
torvm/trunk/build/win32/patches/vidalia-torvm.patch
torvm/trunk/build/win32/src/torvm-w32/torvm.c
Log:
Fix flyspray 945 and 946 until Vidalia integration improved; revert mangling of preinit to use torvminit for easier patching, fix poor shutdown behavior and cause VM to exit when requested by Vidalia.
Modified: torvm/trunk/build/kamikaze/patches/001-kamikaze-tor-package.patch
===================================================================
--- torvm/trunk/build/kamikaze/patches/001-kamikaze-tor-package.patch 2009-03-25 14:55:57 UTC (rev 19127)
+++ torvm/trunk/build/kamikaze/patches/001-kamikaze-tor-package.patch 2009-03-25 15:33:31 UTC (rev 19128)
@@ -313,8 +313,8 @@
+
diff -Naur a/package/tor/files/tor.init b/package/tor/files/tor.init
--- a/package/tor/files/tor.init 1970-01-01 00:00:00.000000000 +0000
-+++ b/package/tor/files/tor.init 2009-03-16 02:53:51.141268368 +0000
-@@ -0,0 +1,117 @@
++++ b/package/tor/files/tor.init 2009-03-25 13:16:19.421298376 +0000
+@@ -0,0 +1,132 @@
+#!/bin/sh
+# make sure we check the system bin dirs
+export PATH=/usr/sbin:/sbin:$PATH
@@ -356,6 +356,10 @@
+ TMP_F="${CONF_F}_tmp"; \
+ ARGS=`cat /proc/cmdline` ; \
+ ARGS="_ $ARGS _" ; \
++ echo $ARGS | grep ' FOLLOWTOR=TRUE ' >/dev/null 2>&1 ; \
++ if [ $? -eq 0 ]; then \
++ FOLLOWTOR=1; \
++ fi; \
+ echo $ARGS | grep ' HASHPW=' >/dev/null 2>&1 ; \
+ if [ $? -eq 0 ]; then \
+ HASHPW=`echo $ARGS | sed 's/.* HASHPW=//' | sed 's/ .*//'`; \
@@ -371,10 +375,15 @@
+ echo "ControlPort ${CTLPORT}" >> $TMP_F; \
+ echo "ControlListenAddress ${CTLSOCK}" >> $TMP_F; \
+ mv -f $TMP_F $CONF_F; \
-+ fi;
-+ chown $RUN_USER:$RUN_GROUP $CONF_F
-+ # start tor process
-+ $BIN --runasdaemon 1 -f $CONF_F > $SLOG_F 2>&1
++ fi; \
++ chown $RUN_USER:$RUN_GROUP $CONF_F ; \
++ if [ $FOLLOWTOR -eq 1 ]; then \
++ /etc/init.d/tor dofollow >/dev/null 2>&1 &; \
++ else \
++ $BIN --runasdaemon 1 -f $CONF_F > $SLOG_F 2>&1 ; \
++ fi;
++ iptables --flush INPUT >/dev/null 2>&1
++ iptables --flush FORWARD >/dev/null 2>&1
+ # TODO for now used fixed control port and socks port accept rule
+ iptables -t nat -I PREROUTING -i $TOR_INTF -d $MYIP -p tcp --dport 9051 -j ACCEPT
+ iptables -t nat -I PREROUTING -i $TOR_INTF -d $MYIP -p tcp --dport 9050 -j ACCEPT
@@ -404,6 +413,12 @@
+ $0 stop
+ $0 start
+
++elif [ "$1" = "dofollow" ]; then
++ $BIN --runasdaemon 0 -f $CONF_F > $SLOG_F 2>&1
++ reboot >/dev/null 2>&1 &
++ sleep 1
++ halt >/dev/null 2>&1
++
+elif [ "$1" = "status" ]; then
+ while true; do
+ clear;echo
Modified: torvm/trunk/build/kamikaze/patches/002-kamikaze-mod-basefiles.patch
===================================================================
--- torvm/trunk/build/kamikaze/patches/002-kamikaze-mod-basefiles.patch 2009-03-25 14:55:57 UTC (rev 19127)
+++ torvm/trunk/build/kamikaze/patches/002-kamikaze-mod-basefiles.patch 2009-03-25 15:33:31 UTC (rev 19128)
@@ -1253,43 +1253,179 @@
-tty1::askfirst:/bin/ash --login
diff -Naur a/package/base-files/files/etc/preinit b/package/base-files/files/etc/preinit
--- a/package/base-files/files/etc/preinit 2008-08-14 22:21:35.073308000 +0000
-+++ b/package/base-files/files/etc/preinit 2009-03-16 09:32:25.894673240 +0000
-@@ -1,88 +1,232 @@
++++ b/package/base-files/files/etc/preinit 2009-03-25 12:47:19.187854072 +0000
+@@ -1,6 +1,12 @@
#!/bin/sh
+ # Copyright (C) 2006 OpenWrt.org
+ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
++
++# bypass default kamikaze init if we're running with Tor VM modifications
++if [ -f /etc/torvminit ]; then
++ exec /etc/torvminit
++fi
++
+ . /etc/diag.sh
+
+ failsafe_ip() {
+diff -Naur a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile
+--- a/package/base-files/files/etc/profile 2009-01-07 04:38:57.851159000 +0000
++++ b/package/base-files/files/etc/profile 2009-03-16 00:59:14.150729840 +0000
+@@ -4,12 +4,8 @@
+ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
+ export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
+ export HOME=${HOME:-/root}
+-export PS1='\u@\h:\w\$ '
++export PS1='\u at Tor_VM:\w\$ '
+
+ [ -x /bin/more ] || alias more=less
+ [ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
+-
+-[ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
+-
+ [ -x /sbin/arp ] || arp() { cat /proc/net/arp; }
+-[ -z /bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
+diff -Naur a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common
+--- a/package/base-files/files/etc/rc.common 2008-09-23 12:35:34.898984000 +0000
++++ b/package/base-files/files/etc/rc.common 2009-02-01 09:47:48.118074016 +0000
+@@ -1,92 +1,4 @@
+ #!/bin/sh
-# Copyright (C) 2006 OpenWrt.org
+-
+-. $IPKG_INSTROOT/etc/functions.sh
+-
+-start() {
+- return 0
+-}
+-
+-stop() {
+- return 0
+-}
+-
+-reload() {
+- return 1
+-}
+-
+-restart() {
+- trap '' TERM
+- stop "$@"
+- start "$@"
+-}
+-
+-boot() {
+- start "$@"
+-}
+-
+-shutdown() {
+- return 0
+-}
+-
+-disable() {
+- name="$(basename "${initscript}")"
+- rm -f "$IPKG_INSTROOT"/etc/rc.d/S??$name
+- rm -f "$IPKG_INSTROOT"/etc/rc.d/K??$name
+-}
+-
+-enable() {
+- name="$(basename "${initscript}")"
+- disable
+- [ "$START" ] && ln -s "../init.d/$name" "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}"
+- [ "$STOP" ] && ln -s "../init.d/$name" "$IPKG_INSTROOT/etc/rc.d/K${STOP}${name##K[0-9][0-9]}"
+-}
+-
+-enabled() {
+- name="$(basename "${initscript}")"
+- [ -x "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}" ]
+-}
+-
+-depends() {
+- return 0
+-}
+-
+-help() {
+- cat <<EOF
+-Syntax: $initscript [command]
+-
+-Available commands:
+- start Start the service
+- stop Stop the service
+- restart Restart the service
+- reload Reload configuration files (or restart if that fails)
+- enable Enable service autostart
+- disable Disable service autostart
+-$EXTRA_HELP
+-EOF
+-}
+-
+-initscript="$1"
+-[ "$#" -ge 1 ] && shift
+-action="$1"
+-[ "$#" -ge 1 ] && shift
+-
+-. "$initscript"
+-
+-cmds=
+-for cmd in $EXTRA_COMMANDS; do
+- cmds="${cmds:+$cmds$N}$cmd) $cmd \"\$@\";;"
+-done
+-eval "case \"\$action\" in
+- start) start \"\$@\";;
+- stop) stop \"\$@\";;
+- reload) reload \"\$@\" || restart \"\$@\";;
+- restart) restart \"\$@\";;
+- boot) boot \"\$@\";;
+- shutdown) shutdown \"\$@\";;
+- enable) enable \"\$@\";;
+- enabled) enabled \"\$@\";;
+- disable) disable \"\$@\";;
+- $cmds
+- *) help;;
+-esac"
++# forcibly disable the usual init process
++# all start/stop activity is controlled by the Tor VM controller (Vidalia).
++exit 0
+diff -Naur a/package/base-files/files/etc/sysctl.conf b/package/base-files/files/etc/sysctl.conf
+--- a/package/base-files/files/etc/sysctl.conf 2009-01-30 14:13:09.991360000 +0000
++++ b/package/base-files/files/etc/sysctl.conf 2009-02-01 09:46:11.655738520 +0000
+@@ -1,16 +1,13 @@
+ kernel.panic=3
+-net.ipv4.conf.default.arp_ignore=1
+-net.ipv4.conf.all.arp_ignore=1
+ net.ipv4.ip_forward=1
+ net.ipv4.icmp_echo_ignore_broadcasts=1
+ net.ipv4.icmp_ignore_bogus_error_responses=1
+ net.ipv4.tcp_ecn=1
+-net.ipv4.tcp_fin_timeout=30
++net.ipv4.tcp_fin_timeout=10
+ net.ipv4.tcp_keepalive_time=120
+-net.ipv4.tcp_syncookies=1
++net.ipv4.tcp_syncookies=0
+ net.ipv4.tcp_timestamps=0
+-net.ipv4.netfilter.ip_conntrack_max=16384
++net.ipv4.netfilter.ip_conntrack_max=65535
+ net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=3600
+-net.ipv4.netfilter.ip_conntrack_udp_timeout=60
+-net.ipv4.netfilter.ip_conntrack_udp_timeout_stream=180
+-# net.ipv6.conf.all.forwarding=1
++net.ipv4.netfilter.ip_conntrack_udp_timeout=600
++net.ipv4.netfilter.ip_conntrack_udp_timeout_stream=1800
+diff -Naur a/package/base-files/files/etc/torvminit b/package/base-files/files/etc/torvminit
+--- a/package/base-files/files/etc/torvminit 1970-01-01 00:00:00.000000000 +0000
++++ b/package/base-files/files/etc/torvminit 2009-03-25 12:52:24.913376728 +0000
+@@ -0,0 +1,232 @@
++#!/bin/sh
+# Copyright (C) 2008-2009 The Tor Project, Inc.
+# See LICENSE file for rights and terms.
+#
-+# NOTE: This file is a full replacement of the original
-+# OpenWRT preinit boot script. This may not be apparent
-+# when viewing the diff between these implementations.
-+
- export PATH=/bin:/sbin:/usr/bin:/usr/sbin
--. /etc/diag.sh
-
--failsafe_ip() {
-- ifconfig $ifname 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255 up
+d () {
+echo " ${1}"
- }
--
--failsafe() {
-- [ -n "$ifname" ] && grep "$ifname" /proc/net/dev >/dev/null && {
-- failsafe_ip
-- netmsg 192.168.1.255 "Entering Failsafe!"
-- telnetd -l /bin/login <> /dev/null 2>&1
-- }
-- lock /tmp/.failsafe
-- ash --login
++}
+dn () {
+echo -n " ${1}"
- }
-
- mount proc /proc -t proc
- mount sysfs /sys -t sysfs
-
--size=$(awk '/MemTotal:/ {l=5242880;mt=($2*1024);print((s=mt/2)<l)&&(mt>l)?mt-l:s}' /proc/meminfo)
--mount tmpfs /tmp -t tmpfs -o size=$size,nosuid,nodev,mode=1777
++}
++
++mount proc /proc -t proc
++mount sysfs /sys -t sysfs
++
+# if we don't have /proc something is very wrong.
+# abort to shell as this is likely a test kernel image.
+if [ ! -d /proc/self ]; then
@@ -1314,42 +1450,19 @@
+fi
+export HOSTNAME
+hostname "$HOSTNAME" >/dev/null 2>&1
-
- if grep devfs /proc/filesystems > /dev/null; then
- mount devfs /dev -t devfs
-- M0=/dev/pty/m0
-- M1=/dev/pty/m1
-- HOTPLUG=/sbin/hotplug-call
--
--elif [ -x /sbin/hotplug2 ]; then
-- mount -t tmpfs tmpfs /dev -o size=512K
-- mknod /dev/console c 5 1
-- /sbin/hotplug2 --coldplug --set-rules-file /etc/hotplug2-init.rules
-- /sbin/hotplug2 --no-coldplug --persistent --set-rules-file /etc/hotplug2-init.rules &
-- M0=/dev/ptmx
-- M1=/dev/ptmx
-- HOTPLUG=
--
- elif [ -x /sbin/udevd ]; then
- mount -n -t tmpfs -o mode=0755 udev /dev
- /sbin/udevd --daemon
- /sbin/udevtrigger
- /sbin/udevsettle
-- M0=/dev/pty/ptmx
-- M1=/dev/pty/ptmx
-- HOTPLUG=
- fi
-
- mkdir -p /dev/pts /dev/shm
- mount devpts /dev/pts -t devpts
-
--# the shell really doesn't like having stdin/out closed
--# that's why we use /dev/pty/m0 and m1 as replacement
--# for /dev/console if there's no serial console available
--dd if=/dev/console of=/dev/null bs=1 count=0 >/dev/null 2>/dev/null && {
-- M0=/dev/console
-- M1=/dev/console
--}
++
++if grep devfs /proc/filesystems > /dev/null; then
++ mount devfs /dev -t devfs
++elif [ -x /sbin/udevd ]; then
++ mount -n -t tmpfs -o mode=0755 udev /dev
++ /sbin/udevd --daemon
++ /sbin/udevtrigger
++ /sbin/udevsettle
++fi
++
++mkdir -p /dev/pts /dev/shm
++mount devpts /dev/pts -t devpts
++
+# attempt mount of persistent virtual disk
+mdbin=`which makedevs`
+devtable=/etc/device_table.txt
@@ -1394,8 +1507,7 @@
+ echo ' Do not run Tor in this configuration.'
+ sleep 3
+fi
-
--exec <$M0 >$M1 2>&0
++
+mkdir -p /var/run
+mkdir -p /var/log
+mkdir -p /var/lock
@@ -1423,14 +1535,20 @@
+else
+
+PRIVIP=10.99.11.1
++PRIVINTF=eth1
+echo $ARGS | grep ' PRIVIP=' >/dev/null 2>&1
+if [ $? -eq 0 ]; then
+ PRIVIP=`echo $ARGS | sed 's/.* PRIVIP=//' | sed 's/ .*//' | sed 's/[^0-9.]//g'`
+fi
-+grep eth1: /proc/net/dev >/dev/null 2>&1
++grep $PRIVINTF: /proc/net/dev >/dev/null 2>&1
+if [ $? -eq 0 ]; then
-+ ifconfig eth1 $PRIVIP netmask 255.255.255.252 up
++ ifconfig $PRIVINTF $PRIVIP netmask 255.255.255.252 up
+fi
++# use tarpit by default to prevent RST/other fail fast with error
++iptables -I INPUT -i $PRIVINTF -j DROP
++iptables -I INPUT -i $PRIVINTF -p tcp -j TARPIT
++iptables -I FORWARD -i $PRIVINTF -j DROP
++iptables -I FORWARD -i $PRIVINTF -p tcp -j TARPIT
+
+echo $ARGS | grep ' DEBUGINIT ' >/dev/null 2>&1
+if [ $? -eq 0 ]; then
@@ -1523,174 +1641,9 @@
+ d "Run /etc/init.d/tor status"
+ d " for bootstrap status."
+fi
-
--echo "- preinit -"
--echo "Press CTRL-C for failsafe"
--trap 'FAILSAFE=true' INT
--trap 'FAILSAFE=true' USR1
--[ -e /etc/preinit.arch ] && . /etc/preinit.arch
--set_state preinit
--echo "$HOTPLUG" > /proc/sys/kernel/hotplug
--eval ${FAILSAFE:+failsafe}
--lock -w /tmp/.failsafe
--
--if [ -z "$INITRAMFS" ]; then
-- mount_root
-- [ -f /sysupgrade.tgz ] && {
-- echo "- config restore -"
-- cd /
-- mv sysupgrade.tgz /tmp
-- tar xzf /tmp/sysupgrade.tgz
-- rm -f /tmp/sysupgrade.tgz
-- sync
-- }
--
-- echo "- init -"
--
-- exec /sbin/init
++
+# end if !NOINIT
- fi
-diff -Naur a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile
---- a/package/base-files/files/etc/profile 2009-01-07 04:38:57.851159000 +0000
-+++ b/package/base-files/files/etc/profile 2009-03-16 00:59:14.150729840 +0000
-@@ -4,12 +4,8 @@
- export PATH=/bin:/sbin:/usr/bin:/usr/sbin
- export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
- export HOME=${HOME:-/root}
--export PS1='\u@\h:\w\$ '
-+export PS1='\u at Tor_VM:\w\$ '
-
- [ -x /bin/more ] || alias more=less
- [ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
--
--[ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
--
- [ -x /sbin/arp ] || arp() { cat /proc/net/arp; }
--[ -z /bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
-diff -Naur a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common
---- a/package/base-files/files/etc/rc.common 2008-09-23 12:35:34.898984000 +0000
-+++ b/package/base-files/files/etc/rc.common 2009-02-01 09:47:48.118074016 +0000
-@@ -1,92 +1,4 @@
- #!/bin/sh
--# Copyright (C) 2006 OpenWrt.org
--
--. $IPKG_INSTROOT/etc/functions.sh
--
--start() {
-- return 0
--}
--
--stop() {
-- return 0
--}
--
--reload() {
-- return 1
--}
--
--restart() {
-- trap '' TERM
-- stop "$@"
-- start "$@"
--}
--
--boot() {
-- start "$@"
--}
--
--shutdown() {
-- return 0
--}
--
--disable() {
-- name="$(basename "${initscript}")"
-- rm -f "$IPKG_INSTROOT"/etc/rc.d/S??$name
-- rm -f "$IPKG_INSTROOT"/etc/rc.d/K??$name
--}
--
--enable() {
-- name="$(basename "${initscript}")"
-- disable
-- [ "$START" ] && ln -s "../init.d/$name" "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}"
-- [ "$STOP" ] && ln -s "../init.d/$name" "$IPKG_INSTROOT/etc/rc.d/K${STOP}${name##K[0-9][0-9]}"
--}
--
--enabled() {
-- name="$(basename "${initscript}")"
-- [ -x "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}" ]
--}
--
--depends() {
-- return 0
--}
--
--help() {
-- cat <<EOF
--Syntax: $initscript [command]
--
--Available commands:
-- start Start the service
-- stop Stop the service
-- restart Restart the service
-- reload Reload configuration files (or restart if that fails)
-- enable Enable service autostart
-- disable Disable service autostart
--$EXTRA_HELP
--EOF
--}
--
--initscript="$1"
--[ "$#" -ge 1 ] && shift
--action="$1"
--[ "$#" -ge 1 ] && shift
--
--. "$initscript"
--
--cmds=
--for cmd in $EXTRA_COMMANDS; do
-- cmds="${cmds:+$cmds$N}$cmd) $cmd \"\$@\";;"
--done
--eval "case \"\$action\" in
-- start) start \"\$@\";;
-- stop) stop \"\$@\";;
-- reload) reload \"\$@\" || restart \"\$@\";;
-- restart) restart \"\$@\";;
-- boot) boot \"\$@\";;
-- shutdown) shutdown \"\$@\";;
-- enable) enable \"\$@\";;
-- enabled) enabled \"\$@\";;
-- disable) disable \"\$@\";;
-- $cmds
-- *) help;;
--esac"
-+# forcibly disable the usual init process
-+# all start/stop activity is controlled by the Tor VM controller (Vidalia).
-+exit 0
-diff -Naur a/package/base-files/files/etc/sysctl.conf b/package/base-files/files/etc/sysctl.conf
---- a/package/base-files/files/etc/sysctl.conf 2009-01-30 14:13:09.991360000 +0000
-+++ b/package/base-files/files/etc/sysctl.conf 2009-02-01 09:46:11.655738520 +0000
-@@ -1,16 +1,13 @@
- kernel.panic=3
--net.ipv4.conf.default.arp_ignore=1
--net.ipv4.conf.all.arp_ignore=1
- net.ipv4.ip_forward=1
- net.ipv4.icmp_echo_ignore_broadcasts=1
- net.ipv4.icmp_ignore_bogus_error_responses=1
- net.ipv4.tcp_ecn=1
--net.ipv4.tcp_fin_timeout=30
-+net.ipv4.tcp_fin_timeout=10
- net.ipv4.tcp_keepalive_time=120
--net.ipv4.tcp_syncookies=1
-+net.ipv4.tcp_syncookies=0
- net.ipv4.tcp_timestamps=0
--net.ipv4.netfilter.ip_conntrack_max=16384
-+net.ipv4.netfilter.ip_conntrack_max=65535
- net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=3600
--net.ipv4.netfilter.ip_conntrack_udp_timeout=60
--net.ipv4.netfilter.ip_conntrack_udp_timeout_stream=180
--# net.ipv6.conf.all.forwarding=1
-+net.ipv4.netfilter.ip_conntrack_udp_timeout=600
-+net.ipv4.netfilter.ip_conntrack_udp_timeout_stream=1800
++fi
diff -Naur a/package/base-files/files/lib/config/parse_spec.awk b/package/base-files/files/lib/config/parse_spec.awk
--- a/package/base-files/files/lib/config/parse_spec.awk 2007-03-04 04:41:46.644094000 +0000
+++ b/package/base-files/files/lib/config/parse_spec.awk 1970-01-01 00:00:00.000000000 +0000
Modified: torvm/trunk/build/win32/patches/vidalia-torvm.patch
===================================================================
--- torvm/trunk/build/win32/patches/vidalia-torvm.patch 2009-03-25 14:55:57 UTC (rev 19127)
+++ torvm/trunk/build/win32/patches/vidalia-torvm.patch 2009-03-25 15:33:31 UTC (rev 19128)
@@ -1542,8 +1542,21 @@
+
diff -Naur a/src/torcontrol/torcontrol.cpp b/src/torcontrol/torcontrol.cpp
--- a/src/torcontrol/torcontrol.cpp 2009-02-24 03:20:58.105033000 +0000
-+++ b/src/torcontrol/torcontrol.cpp 2009-03-16 10:32:51.838446000 +0000
-@@ -73,16 +73,23 @@
++++ b/src/torcontrol/torcontrol.cpp 2009-03-25 13:27:02.439544744 +0000
+@@ -57,6 +57,12 @@
+ /** Default destructor */
+ TorControl::~TorControl()
+ {
++ /* In Tor VM mode we only send shutdown on exit */
++ if (_controlConn->isConnected()) {
++ ControlCommand cmd("SIGNAL");
++ cmd.addArgument("SHUTDOWN");
++ _controlConn->send(cmd, 0);
++ }
+ /* Disconnect the control socket */
+ if (isConnected()) {
+ disconnect();
+@@ -73,16 +79,23 @@
void
TorControl::start(const QString &tor, const QStringList &args)
{
@@ -1569,7 +1582,7 @@
#else
/* Start a new Tor process */
_torProcess->start(expand_filename(tor), args);
-@@ -95,11 +102,17 @@
+@@ -95,11 +108,17 @@
TorControl::stop(QString *errmsg)
{
bool rc = false;
@@ -1592,7 +1605,7 @@
}
/** Emits a signal that the Tor process stopped */
-@@ -118,6 +131,7 @@
+@@ -118,6 +137,7 @@
bool
TorControl::isVidaliaRunningTor()
{
@@ -1600,7 +1613,7 @@
return (_torProcess->state() != QProcess::NotRunning);
}
-@@ -125,8 +139,11 @@
+@@ -125,8 +145,11 @@
bool
TorControl::isRunning()
{
@@ -1614,7 +1627,7 @@
}
/** Called when Tor has printed a log message to stdout. */
-@@ -454,6 +471,10 @@
+@@ -454,6 +477,10 @@
cmd.addArgument(TorSignal::toString(sig));
if (sig == TorSignal::Shutdown || sig == TorSignal::Halt) {
Modified: torvm/trunk/build/win32/src/torvm-w32/torvm.c
===================================================================
--- torvm/trunk/build/win32/src/torvm-w32/torvm.c 2009-03-25 14:55:57 UTC (rev 19127)
+++ torvm/trunk/build/win32/src/torvm-w32/torvm.c 2009-03-25 15:33:31 UTC (rev 19128)
@@ -444,6 +444,7 @@
if (src == INVALID_HANDLE_VALUE) {
return FALSE;
}
+ DeleteFile (destpath);
dest = CreateFile (destpath,
GENERIC_WRITE,
0,
@@ -1628,6 +1629,7 @@
}
BOOL buildcmdline (struct s_rconnelem * brif,
+ BOOL bundle,
BOOL usedebug,
BOOL noinit,
char ** cmdline)
@@ -1656,10 +1658,11 @@
else {
if (brif->isdhcp == FALSE) {
snprintf (*cmdline, cmdlen -1,
- "%s%s%s IP=%s MASK=%s GW=%s MAC=%s MTU=%d PRIVIP=%s CTLSOCK=%s:9051 HASHPW=%s",
+ "%s%s%s%s IP=%s MASK=%s GW=%s MAC=%s MTU=%d PRIVIP=%s CTLSOCK=%s:9051 HASHPW=%s",
usedebug ? dbgcmds : basecmds,
myhostname ? " USEHOSTNAME=" : "",
myhostname ? myhostname : "",
+ bundle ? " FOLLOWTOR=TRUE" : "",
brif->ipaddr,
brif->netmask,
brif->gateway,
@@ -1675,10 +1678,11 @@
myhostname = brif->dhcpname;
snprintf (*cmdline, cmdlen -1,
- "%s%s%s IP=%s MASK=%s GW=%s MAC=%s MTU=%d PRIVIP=%s ISDHCP DHCPSVR=%s DHCPNAME=%s CTLSOCK=%s:9051 HASHPW=%s",
+ "%s%s%s%s IP=%s MASK=%s GW=%s MAC=%s MTU=%d PRIVIP=%s ISDHCP DHCPSVR=%s DHCPNAME=%s CTLSOCK=%s:9051 HASHPW=%s",
usedebug ? dbgcmds : basecmds,
myhostname ? " USEHOSTNAME=" : "",
myhostname ? myhostname : "",
+ bundle ? " FOLLOWTOR=TRUE" : "",
brif->ipaddr,
brif->netmask,
brif->gateway,
@@ -1749,6 +1753,7 @@
LPTSTR pcfgtmp = NULL;
LPTSTR vcfgdest = NULL;
LPTSTR pcfgdest = NULL;
+ LPTSTR pcfgdestsave = NULL;
DWORD opts = CREATE_NEW_PROCESS_GROUP;
HANDLE tmphnd;
ZeroMemory( &si, sizeof(si) );
@@ -1775,6 +1780,10 @@
lerror ("Unable to build path for polipo dest config.");
goto cleanup;
}
+ if (!buildsyspath(SYSDIR_LCLDATA, "Polipo\\save-cfg.txt", &pcfgdestsave)) {
+ lerror ("Unable to build path for polipo saved dest config.");
+ goto cleanup;
+ }
if (!buildsyspath(SYSDIR_LCLPROGRAMS, "Vidalia\\vidalia-marble.exe", &exe)) {
lerror ("Unable to build path for vidalia marble exe.");
goto cleanup;
@@ -1787,14 +1796,21 @@
goto cleanup;
}
}
- if (!exists(vcfgdest)) {
- ldebug ("Copying default vidalia config from %s to %s", vcfgtmp, vcfgdest);
- copyvidaliacfg(vcfgtmp, vcfgdest, dir, pcfgdest);
+
+ /* for now we always force a correct vidalia config to temporarily resolve
+ * flyspray 945
+ */
+ ldebug ("Copying default vidalia config from %s to %s", vcfgtmp, vcfgdest);
+ copyvidaliacfg(vcfgtmp, vcfgdest, dir, pcfgdest);
+
+ /* same for polipo and its backup file; see flyspray 946.
+ */
+ ldebug ("Copying default polipo config from %s to %s", pcfgtmp, pcfgdest);
+ copyfile(pcfgtmp, pcfgdest);
+ if (!exists(pcfgdestsave)) {
+ ldebug ("Copying default polipo config from %s to save-file %s", pcfgtmp, pcfgdestsave);
+ copyfile(pcfgtmp, pcfgdestsave);
}
- if (!exists(pcfgdest)) {
- ldebug ("Copying default polipo config from %s to %s", pcfgtmp, pcfgdest);
- copyfile(pcfgtmp, pcfgdest);
- }
cmd = malloc(CMDMAX);
snprintf (cmd, CMDMAX -1,
@@ -2369,7 +2385,7 @@
}
if (!vmnop) {
- if (! buildcmdline(ce, indebug, noinit, &cmdline)) {
+ if (! buildcmdline(ce, bundle, indebug, noinit, &cmdline)) {
lerror ("Unable to generate command line for kernel.");
goto shutdown;
}
More information about the tor-commits
mailing list