[or-cvs] r19509: {torvm} Start using official Mozilla Torbutton managed by Mike by de (in torvm/trunk/build/win32: . files src/pkg src/torvm-w32)
coderman at seul.org
coderman at seul.org
Wed May 13 20:16:16 UTC 2009
Author: coderman
Date: 2009-05-13 16:16:15 -0400 (Wed, 13 May 2009)
New Revision: 19509
Added:
torvm/trunk/build/win32/files/prefs.js
Modified:
torvm/trunk/build/win32/Makefile
torvm/trunk/build/win32/files/buildall.sh
torvm/trunk/build/win32/files/defpolipo.conf
torvm/trunk/build/win32/src/pkg/bundle.nsi
torvm/trunk/build/win32/src/pkg/netinst.nsi
torvm/trunk/build/win32/src/pkg/torvm.wxs
torvm/trunk/build/win32/src/torvm-w32/apicommon.c
torvm/trunk/build/win32/src/torvm-w32/apicommon.h
torvm/trunk/build/win32/src/torvm-w32/creds.c
torvm/trunk/build/win32/src/torvm-w32/torvm.c
Log:
Start using official Mozilla Torbutton managed by Mike by default, include a torbutton prefs.js that we make default for Firefox when Tor VM is running, more usability cleanup.
Modified: torvm/trunk/build/win32/Makefile
===================================================================
--- torvm/trunk/build/win32/Makefile 2009-05-13 12:01:16 UTC (rev 19508)
+++ torvm/trunk/build/win32/Makefile 2009-05-13 20:16:15 UTC (rev 19509)
@@ -207,6 +207,11 @@
POLIPO_URL=http://www.pps.jussieu.fr/~jch/software/files/polipo/$(POLIPO_F)
POLIPO_SUM=dda211e3027310891fb555c1fe5fa2f5b274aa0f
+TORBUTTON_XPI_VER=1.2.1
+TORBUTTON_XPI_F=torbutton-$(TORBUTTON_XPI_VER)-fx.xpi
+TORBUTTON_XPI_URL=http://releases.mozilla.org/pub/mozilla.org/addons/2275/$(TORBUTTON_XPI_NAME)
+TORBUTTON_XPI_SUM=204766e5c9112aba7313e3ab98023f57f1668978
+
MARBLE_NAME=marble-latest
MARBLE_TGZ=$(MARBLE_NAME).tar.gz
MARBLE_SVN=https://svn.vidalia-project.net/svn/marble/
@@ -247,7 +252,7 @@
# buildscripts need some dire clean up...
OK:=echo -n
-ALLFILES=$(ZLIB_F) $(GZIP_F) $(BZIP2_F) $(LIBARCH_F) $(BINUTILS_F) $(GCCORE_F) $(GPP_F) $(MINGWRUN_F) $(MINGWUTIL_F) $(MAKE_F) $(W32API_F) $(MSYS_F) $(MSYSCORE_F) $(BASH_F) $(DIFFUTIL_F) $(LIBTOOL_F) $(MINIRES_F) $(MSYSZLIB_F) $(MSYSCRYPT_F) $(M4_F) $(MSYSSSL_F) $(MSYSSSH_F) $(ZLIBSRC_F) $(PTHREADS_F) $(LIBEVENT_F) $(AMAKE_F) $(ACONF_F) $(PERL_F) $(GROFF_F) $(CMAKE_F) $(QT_F) $(NSIS_F) $(SSLSRC_F) $(PYTHON_F) $(PY2EXE_F) $(WIX_F) $(WIXSRC_F) $(GNURX_F) $(POLIPO_F) $(SDL_F) $(WPCAPSRC_F) $(QEMU_F) $(OVPN_F)
+ALLFILES=$(ZLIB_F) $(GZIP_F) $(BZIP2_F) $(LIBARCH_F) $(BINUTILS_F) $(GCCORE_F) $(GPP_F) $(MINGWRUN_F) $(MINGWUTIL_F) $(MAKE_F) $(W32API_F) $(MSYS_F) $(MSYSCORE_F) $(BASH_F) $(DIFFUTIL_F) $(LIBTOOL_F) $(MINIRES_F) $(MSYSZLIB_F) $(MSYSCRYPT_F) $(M4_F) $(MSYSSSL_F) $(MSYSSSH_F) $(ZLIBSRC_F) $(PTHREADS_F) $(LIBEVENT_F) $(AMAKE_F) $(ACONF_F) $(PERL_F) $(GROFF_F) $(CMAKE_F) $(QT_F) $(NSIS_F) $(SSLSRC_F) $(PYTHON_F) $(PY2EXE_F) $(WIX_F) $(WIXSRC_F) $(GNURX_F) $(POLIPO_F) $(SDL_F) $(WPCAPSRC_F) $(QEMU_F) $(TORBUTTON_XPI_F) $(OVPN_F)
# adjust if we're dealing with non source, zip or tar archives for a package
SEVNZIP_OPT_DL=
@@ -307,6 +312,7 @@
@if [ ! -e $(WDLDIR)/$(WPCAPSRC_F) ]; then $(DLCMD) "$(WPCAPSRC_URL)" $(WPCAPSRC_SUM) "$(WDLDIR)/$(WPCAPSRC_F)"; fi
@if [ ! -e $(WDLDIR)/$(OVPN_F) ]; then $(DLCMD) "$(OVPN_URL)" $(OVPN_SUM) "$(WDLDIR)/$(OVPN_F)"; fi
@if [ ! -e $(WDLDIR)/$(QEMU_F) ]; then $(DLCMD) "$(QEMU_URL)" $(QEMU_SUM) "$(WDLDIR)/$(QEMU_F)"; fi
+ @if [ ! -e $(WDLDIR)/$(TORBUTTON_XPI_F) ]; then $(DLCMD) "$(TORBUTTON_XPI_URL)" $(TORBUTTON_XPI_SUM) "$(WDLDIR)/$(TORBUTTON_XPI_F)"; fi
@$(SEVNZIP_OPT_DL); $(OK)
@( export ddir=`pwd`/iso; if [ ! -f $ddir ]; then export ddir="$(ISODIR)"; fi; cd $(SDLDIR); if [ -d $(TORSVN_NAME) ]; then cd $(TORSVN_NAME); $(SVNCMD) up; $(OK); else $(SVNCMD) co "$(TORSVN_SVN)$(TORSVN_BR)" $(TORSVN_NAME) ; fi )
@( cd $(SDLDIR); if [ -d $(TORBUTTON_NAME) ]; then cd $(TORBUTTON_NAME); $(SVNCMD) up; $(OK); else $(SVNCMD) co "$(TORBUTTON_SVN)$(TORBUTTON_BR)" $(TORBUTTON_NAME) ; fi )
@@ -352,6 +358,7 @@
cp files/hdd.img.gz $(ISODIR)/add/; \
cp files/defvidalia.conf $(ISODIR)/add/; \
cp files/defpolipo.conf $(ISODIR)/add/; \
+ cp files/prefs.js $(ISODIR)/add/; \
gzip -d $(ISODIR)/add/hdd.img.gz; \
cp files/fstab $(ISODIR)/bin/; \
cp files/buildall.sh $(ISODIR)/dl/src; \
@@ -405,10 +412,15 @@
rm -rf $(PYCRYPTO_NAME); $(GITCMD) clone $(LOCALGITOPTS) $(SDLDIR)/$(PYCRYPTO_NAME) $(PYCRYPTO_NAME) ; \
( cd $(PYCRYPTO_NAME); $(GITCMD) checkout $(PYCRYPTO_VER); ); \
tar zcf $(ISODIR)/dl/src/$(PYCRYPTO_TGZ) $(PYCRYPTO_NAME); rm -rf $(PYCRYPTO_NAME); \
- echo "--- Exporting and archiving Tor Button version $(TORBUTTON_VER) from local mirror ..."; \
- rm -rf $(TORBUTTON_NAME); $(SVNCMD) export --revision $(TORBUTTON_VER) $(SDLDIR)/$(TORBUTTON_NAME) $(TORBUTTON_NAME) ; \
- ( cd $(TORBUTTON_NAME); $(SHELL) makexpi.sh ; ); \
- mv $(TORBUTTON_NAME)/pkg/*.xpi $(ISODIR)/dl/src/ ; rm -rf $(TORSVN_NAME); \
+ if [ -f $(WDLDIR)/$(TORBUTTON_XPI_F) ]; then \
+ echo "--- Using Mozilla.org TorButton $(TORBUTTON_XPI_F) ..."; \
+ cp -f $(WDLDIR)/$(TORBUTTON_XPI_F) $(ISODIR)/dl/src/torbutton.xpi; \
+ else \
+ echo "--- Exporting and archiving Tor Button version $(TORBUTTON_VER) from local mirror ..."; \
+ rm -rf $(TORBUTTON_NAME); $(SVNCMD) export --revision $(TORBUTTON_VER) $(SDLDIR)/$(TORBUTTON_NAME) $(TORBUTTON_NAME) ; \
+ ( cd $(TORBUTTON_NAME); $(SHELL) makexpi.sh ; ); \
+ mv $(TORBUTTON_NAME)/pkg/*.xpi $(ISODIR)/dl/src/torbutton.xpi ; rm -rf $(TORSVN_NAME); \
+ fi; \
echo "--- Creating source archives from win32 tree ..."; \
( cd src && tar zcf ../$(ISODIR)/dl/src/torvm-w32.tgz torvm-w32 ); \
( cd src && tar zcf ../$(ISODIR)/dl/src/pkg.tgz pkg ); \
Modified: torvm/trunk/build/win32/files/buildall.sh
===================================================================
--- torvm/trunk/build/win32/files/buildall.sh 2009-05-13 12:01:16 UTC (rev 19508)
+++ torvm/trunk/build/win32/files/buildall.sh 2009-05-13 20:16:15 UTC (rev 19509)
@@ -151,7 +151,7 @@
export POLIPO_FILE=polipo-20080907.tar.gz
export POLIPO_DIR=polipo-20080907
- export TORBUTTON_FILE=torbutton-1.2.1.xpi
+ export TORBUTTON_FILE=torbutton.xpi
export NSIS_DIR=nsis-2.42
export PATH="${PATH}:/${NSIS_DIR}/Bin:/${NSIS_DIR}:/${NSIS_DIR}/bin"
@@ -1008,7 +1008,6 @@
cp $TVM_VIDCONF $bdlibdir/
fi
-
# Microsoft Installer package build
TOR_WXS_DIR=contrib
# Suppress logo and irrelevant warnings about ALLUSERS path variation
Modified: torvm/trunk/build/win32/files/defpolipo.conf
===================================================================
--- torvm/trunk/build/win32/files/defpolipo.conf 2009-05-13 12:01:16 UTC (rev 19508)
+++ torvm/trunk/build/win32/files/defpolipo.conf 2009-05-13 20:16:15 UTC (rev 19509)
@@ -3,11 +3,7 @@
allowedClients = 127.0.0.1
allowedPorts = 1-65535
proxyName = "localhost"
-# assume shared use (local users) by default?
# cacheIsShared = false
-# at some point torvm will need to replace this ip (append)
-socksParentProxy = "10.10.10.1:9050"
-socksProxyType = socks5
### Memory
chunkHighMark = 33554432
# disable the on-disk cache:
@@ -19,7 +15,7 @@
disableLocalInterface = true
disableConfiguration = true
dnsQueryIPv6 = no
-dnsUseGethostbyname = yes
+dnsUseGethostbyname = no
disableVia = true
censoredHeaders = from,accept-language,x-pad,link
censorReferer = maybe
@@ -28,6 +24,6 @@
# should age match circuit dirtiness?
maxConnectionAge = 10m
maxConnectionRequests = 120
-serverMaxSlots = 8
-serverSlots = 2
+serverMaxSlots = 16
+serverSlots = 4
tunnelAllowedPorts = 1-65535
Added: torvm/trunk/build/win32/files/prefs.js
===================================================================
--- torvm/trunk/build/win32/files/prefs.js (rev 0)
+++ torvm/trunk/build/win32/files/prefs.js 2009-05-13 20:16:15 UTC (rev 19509)
@@ -0,0 +1,93 @@
+# Mozilla User Preferences
+
+/* Do not edit this file.
+ *
+ * If you make changes to this file while the application is running,
+ * the changes will be overwritten when the application exits.
+ *
+ * To make a manual change to preferences, you can visit the URL about:config
+ * For more information, see http://www.mozilla.org/unix/customizing.html#prefs
+ */
+
+user_pref("app.update.auto", false);
+user_pref("app.update.enabled", false);
+user_pref("app.update.lastUpdateTime.addon-background-update-timer", 1216566538);
+user_pref("app.update.lastUpdateTime.background-update-timer", 1216566535);
+user_pref("app.update.lastUpdateTime.blocklist-background-update-timer", 1216566538);
+user_pref("app.update.lastUpdateTime.microsummary-generator-update-timer", 1232574822);
+user_pref("app.update.lastUpdateTime.search-engine-update-timer", 1216566539);
+user_pref("browser.bookmarks.livemark_refresh_seconds", 31536000);
+user_pref("browser.cache.disk.capacity", 0);
+user_pref("browser.cache.disk.enable", false);
+user_pref("browser.download.manager.retention", 0);
+user_pref("browser.download.useDownloadDir", false);
+user_pref("browser.formfill.enable", false);
+user_pref("browser.migration.version", 1);
+user_pref("browser.places.importBookmarksHTML", false);
+user_pref("browser.places.importDefaults", false);
+user_pref("browser.places.leftPaneFolderId", -1);
+user_pref("browser.places.migratePostDataAnnotations", false);
+user_pref("browser.places.smartBookmarksVersion", 1);
+user_pref("browser.places.updateRecentTagsUri", false);
+user_pref("browser.preferences.advanced.selectedTabIndex", 0);
+user_pref("browser.rights.3.shown", true);
+user_pref("browser.safebrowsing.enabled", false);
+user_pref("browser.search.suggest.enabled", false);
+user_pref("browser.search.update", false);
+user_pref("browser.shell.checkDefaultBrowser", false);
+user_pref("browser.startup.homepage", "https://check.torproject.org/");
+user_pref("browser.startup.homepage_override.mstone", "rv:1.9.0.10");
+user_pref("dom.storage.enabled", false);
+user_pref("extensions.lastAppVersion", "3.0.10");
+user_pref("extensions.torbutton.fresh_install", false);
+user_pref("extensions.torbutton.http_port", 8118);
+user_pref("extensions.torbutton.http_proxy", "127.0.0.1");
+user_pref("extensions.torbutton.https_port", 8118);
+user_pref("extensions.torbutton.https_proxy", "127.0.0.1");
+user_pref("extensions.torbutton.locked_mode", true);
+user_pref("extensions.torbutton.proxies_applied", true);
+user_pref("extensions.torbutton.restore_tor", true);
+user_pref("extensions.torbutton.saved.auto_update", false);
+user_pref("extensions.torbutton.saved.share_proxy_settings", false);
+user_pref("extensions.torbutton.saved.socks_version", 5);
+user_pref("extensions.torbutton.settings_applied", true);
+user_pref("extensions.torbutton.tor_enabled", true);
+user_pref("extensions.torbutton.tor_memory_jar", true);
+user_pref("extensions.update.enabled", false);
+user_pref("extensions.update.notifyUser", false);
+user_pref("general.appname.override", "Netscape");
+user_pref("general.appversion.override", "5.0 (Windows; en-US)");
+user_pref("general.buildID.override", "0");
+user_pref("general.oscpu.override", "Windows NT 5.1");
+user_pref("general.platform.override", "Win32");
+user_pref("general.productSub.override", "20080404");
+user_pref("general.useragent.locale", "BUNDLELOCALE");
+user_pref("general.useragent.override", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14");
+user_pref("general.useragent.vendor", "");
+user_pref("general.useragent.vendorSub", "");
+user_pref("intl.accept_languages", "en-us, en");
+user_pref("intl.charsetmenu.browser.cache", "UTF-8");
+user_pref("network.cookie.lifetimePolicy", 2);
+user_pref("network.cookie.prefsMigrated", true);
+user_pref("network.protocol-handler.warn-external.mailto", true);
+user_pref("network.protocol-handler.warn-external.news", true);
+user_pref("network.protocol-handler.warn-external.nntp", true);
+user_pref("network.protocol-handler.warn-external.snews", true);
+user_pref("network.proxy.http", "127.0.0.1");
+user_pref("network.proxy.http_port", 8118);
+user_pref("network.proxy.ssl", "127.0.0.1");
+user_pref("network.proxy.ssl_port", 8118);
+user_pref("network.proxy.type", 1);
+user_pref("network.security.ports.banned", "8118,8123,9050,9051");
+user_pref("plugin.disable_full_page_plugin_for_types", "application/asx,video/x-ms-asf-plugin,application/x-mplayer2,video/x-ms-asf,video/x-ms-wm,audio/x-ms-wma,audio/x-ms-wax,video/x-ms-wmv,video/x-ms-wvx,application/x-drm-v2,application/x-drm");
+user_pref("plugin.scan.plid.all", false);
+user_pref("plugin.scan.SunJRE", 99.0);
+user_pref("plugin.scan.WindowsMediaPlayer", 99.0);
+user_pref("plugin.scan.4xPluginFolder", false);
+user_pref("security.enable_java", false);
+user_pref("signon.rememberSignons", false);
+user_pref("urlclassifier.keyupdatetime.https://sb-ssl.google.com/safebrowsing/newkey", 1235166825);
+user_pref("urlclassifier.tableversion.goog-black-enchash", "1.55536");
+user_pref("urlclassifier.tableversion.goog-black-url", "1.23256");
+user_pref("urlclassifier.tableversion.goog-white-domain", "1.481");
+user_pref("urlclassifier.tableversion.goog-white-url", "1.371");
Modified: torvm/trunk/build/win32/src/pkg/bundle.nsi
===================================================================
--- torvm/trunk/build/win32/src/pkg/bundle.nsi 2009-05-13 12:01:16 UTC (rev 19508)
+++ torvm/trunk/build/win32/src/pkg/bundle.nsi 2009-05-13 20:16:15 UTC (rev 19509)
@@ -53,6 +53,7 @@
ExecWait 'msiexec /i "$INSTDIR\vidalia.msi" NOSC=1 /qn'
ExecWait 'msiexec /i "$INSTDIR\thandy.msi" NOSC=1 /qn'
ExecWait 'msiexec /i "$INSTDIR\polipo.msi" NOSC=1 /qn'
+ ExecWait 'msiexec /i "$INSTDIR\torbutton.msi" NOSC=1 /qn'
ExecWait 'msiexec /i "$INSTDIR\license.msi" NOSC=1 /qn'
SetOutPath $DESKTOP
File "Uninstall_Tor.bat"
Modified: torvm/trunk/build/win32/src/pkg/netinst.nsi
===================================================================
--- torvm/trunk/build/win32/src/pkg/netinst.nsi 2009-05-13 12:01:16 UTC (rev 19508)
+++ torvm/trunk/build/win32/src/pkg/netinst.nsi 2009-05-13 20:16:15 UTC (rev 19509)
@@ -53,6 +53,7 @@
ExecWait '"$LOCALAPPDATA\Programs\Thandy\thandy.exe" update "--repo=$LOCALAPPDATA\Thandy\Vidalia Updates" /bundleinfo/vidalia/win32/'
ExecWait '"$LOCALAPPDATA\Programs\Thandy\thandy.exe" update --install "--repo=$LOCALAPPDATA\Thandy\TorVM Updates" /bundleinfo/torvm/win32/'
ExecWait '"$LOCALAPPDATA\Programs\Thandy\thandy.exe" update --install "--repo=$LOCALAPPDATA\Thandy\Polipo Updates" /bundleinfo/polipo/win32/'
+ ExecWait '"$LOCALAPPDATA\Programs\Thandy\thandy.exe" update --install "--repo=$LOCALAPPDATA\Thandy\TorButton Updates" /bundleinfo/torbutton/win32/'
ExecWait '"$LOCALAPPDATA\Programs\Thandy\thandy.exe" update --install "--repo=$LOCALAPPDATA\Thandy\Vidalia Updates" /bundleinfo/vidalia/win32/'
SetOutPath $DESKTOP
File "Uninstall_Tor.bat"
Modified: torvm/trunk/build/win32/src/pkg/torvm.wxs
===================================================================
--- torvm/trunk/build/win32/src/pkg/torvm.wxs 2009-05-13 12:01:16 UTC (rev 19508)
+++ torvm/trunk/build/win32/src/pkg/torvm.wxs 2009-05-13 20:16:15 UTC (rev 19509)
@@ -109,7 +109,7 @@
<RegistryKey Root="HKCU"
Key="Software\Microsoft\Windows\CurrentVersion\Run"
Action="createAndRemoveOnUninstall">
- <RegistryValue Name="Tor VM" Value='"[ProgramsInstDir]torvm.exe"' Type="string" />
+ <RegistryValue Name="Tor VM" Value='"[ProgramsInstDir]torvm.exe --bundle"' Type="string" />
</RegistryKey>
</Component>
</Directory>
Modified: torvm/trunk/build/win32/src/torvm-w32/apicommon.c
===================================================================
--- torvm/trunk/build/win32/src/torvm-w32/apicommon.c 2009-05-13 12:01:16 UTC (rev 19508)
+++ torvm/trunk/build/win32/src/torvm-w32/apicommon.c 2009-05-13 20:16:15 UTC (rev 19509)
@@ -646,7 +646,7 @@
return FALSE;
}
for (i = 0; i < len; i++) {
- snprintf(*hexstr+(i*2), 3, "%02hhx", (short)data[i]);
+ snprintf((*hexstr)+(i*2), 3, "%02hhx", (short)data[i]);
}
(*hexstr)[olen-1] = NULL;
return retval;
Modified: torvm/trunk/build/win32/src/torvm-w32/apicommon.h
===================================================================
--- torvm/trunk/build/win32/src/torvm-w32/apicommon.h 2009-05-13 12:01:16 UTC (rev 19508)
+++ torvm/trunk/build/win32/src/torvm-w32/apicommon.h 2009-05-13 20:16:15 UTC (rev 19509)
@@ -115,8 +115,25 @@
int getosversion (void);
int getosbits (void);
+typedef struct s_CmdInfo {
+ BOOL isrunning;
+ DWORD status;
+ HANDLE hnd;
+ HANDLE stdin_rd;
+ HANDLE stdin_wr;
+ HANDLE stdout_rd;
+ HANDLE stdout_wr;
+} CmdInfo;
+
BOOL getcompguid (TCHAR **guid);
void bgstartupinfo (STARTUPINFO *si);
+/*
+BOOL launchcommand(LPSTR cmd,
+ LPSTR dir,
+ CmdInfo **info);
+BOOL checkcommand(CmdInfo *info);
+BOOL killcommand(CmdInfo *info);
+*/
BOOL runcommand(LPSTR cmd,
LPSTR dir);
Modified: torvm/trunk/build/win32/src/torvm-w32/creds.c
===================================================================
--- torvm/trunk/build/win32/src/torvm-w32/creds.c 2009-05-13 12:01:16 UTC (rev 19508)
+++ torvm/trunk/build/win32/src/torvm-w32/creds.c 2009-05-13 20:16:15 UTC (rev 19509)
@@ -836,26 +836,75 @@
BOOL initruserprofile(userinfo * info)
{
LPTSTR relpath;
- LPTSTR imgsrc;
- LPTSTR imgdest;
+ LPTSTR mozpath;
+ LPTSTR auppath;
+ LPTSTR profpath;
+ LPTSTR filesrc;
+ LPTSTR filedest;
+ LPTSTR cmd;
+ LPTSTR coff;
ldebug ("Initializing user profile %s on host %s.", info->name, info->host);
- if (!buildfpath(PATH_FQ, VMDIR_LIB, NULL, "torvmuser.bmp", &imgsrc)) {
+ if (!buildsyspath(SYSDIR_ALLPROFILE, NULL, &auppath)) {
+ lerror ("Unable to build path for all users profile destination.");
+ return FALSE;
+ }
+ /* Trim off the "All Users" part as we just want Documents and Settings
+ * XXX: all of the path handling needs to be cleaned up, localized, collected.
+ */
+ coff = auppath + strlen(auppath) - 1;
+ while ( (coff > auppath) && (*coff != '\\') ) coff--;
+ if (coff > auppath)
+ *coff = 0;
+ profpath = malloc(CMDMAX);
+ snprintf(profpath, CMDMAX -1, "%s\\%s", auppath, info->name);
+ free(auppath);
+
+ if (!buildfpath(PATH_FQ, VMDIR_LIB, NULL, "torvmuser.bmp", &filesrc)) {
lerror ("Unable to build path for profile image in lib dir.");
return FALSE;
}
relpath = malloc(CMDMAX);
snprintf(relpath, CMDMAX -1, "Application Data\\Microsoft\\User Account Pictures\\%s.bmp", info->name);
- if (!buildsyspath(SYSDIR_ALLPROFILE, relpath, &imgdest)) {
+ if (!buildsyspath(SYSDIR_ALLPROFILE, relpath, &filedest)) {
lerror ("Unable to build path for all users profile destination.");
- free(imgsrc);
+ free(filesrc);
return FALSE;
}
- if (!copyfile(imgsrc, imgdest)) {
- ldebug ("Failed to copy user profile image from %s to %s.", imgsrc, imgdest);
+ if (!copyfile(filesrc, filedest)) {
+ ldebug ("Failed to copy user profile image from %s to %s.", filesrc, filedest);
}
+ free(filesrc);
+ free(filedest);
+ if (!buildfpath(PATH_FQ, VMDIR_LIB, NULL, "prefs.js", &filesrc)) {
+ lerror ("Unable to build path for Torbutton preference file in lib dir.");
+ return FALSE;
+ }
+ if (!buildsyspath(SYSDIR_PROGRAMS, "Mozilla Firefox\\defaults\\pref\\all.js", &filedest)) {
+ lerror ("Unable to build path for Mozilla default preference file.");
+ return FALSE;
+ }
+ if (!copyfile(filesrc, filedest)) {
+ ldebug ("Failed to copy default Torbutton prefs from %s to %s.", filesrc, filedest);
+ }
+ free(filesrc);
+ free(filedest);
+ if (!buildsyspath(SYSDIR_LCLDATA, "TorButton\\torbutton.xpi", &filesrc)) {
+ lerror ("Unable to build path for Torbutton extension file.");
+ return FALSE;
+ }
+ if (!buildsyspath(SYSDIR_PROGRAMS, "Mozilla Firefox\\firefox.exe", &mozpath)) {
+ lerror ("Unable to build path for Mozilla firefox.");
+ return FALSE;
+ }
+ cmd = malloc(CMDMAX);
+ snprintf(cmd, CMDMAX -1, "\"%s\" -install-global-extension \"%s\"", mozpath, filesrc);
+ runcommand(cmd,NULL);
+ snprintf(relpath, CMDMAX -1, "%s\\Start Menu\\Programs\\Startup\\firefox.lnk", profpath);
+ snprintf(cmd, CMDMAX -1, "makelink \"%s\" \"\" \"%s\" \"\"", mozpath, relpath);
+ runcommand(cmd,NULL);
free(relpath);
- free(imgsrc);
- free(imgdest);
+ free(mozpath);
+ free(cmd);
return TRUE;
}
@@ -924,12 +973,19 @@
BOOL disableuser (LPTSTR username)
{
+ LPSTR path;
LPSTR cmd = NULL;
cmd = malloc(CMDMAX);
ldebug("Disabling user account: %s", username);
snprintf(cmd, CMDMAX -1, "net.exe user %s /ACTIVE:NO", username);
runcommand(cmd,NULL);
free(cmd);
+ if (!buildsyspath(SYSDIR_PROGRAMS, "Mozilla Firefox\\defaults\\pref\\all.js", &path)) {
+ lerror ("Unable to build path for Mozilla default preference file.");
+ return FALSE;
+ }
+ DeleteFile(path);
+ free(path);
return TRUE;
}
Modified: torvm/trunk/build/win32/src/torvm-w32/torvm.c
===================================================================
--- torvm/trunk/build/win32/src/torvm-w32/torvm.c 2009-05-13 12:01:16 UTC (rev 19508)
+++ torvm/trunk/build/win32/src/torvm-w32/torvm.c 2009-05-13 20:16:15 UTC (rev 19509)
@@ -266,9 +266,11 @@
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
+ /* XXX: nobody cares
if (src == INVALID_HANDLE_VALUE) {
return FALSE;
}
+ */
dest = CreateFile (destpath,
GENERIC_WRITE,
0,
@@ -282,6 +284,8 @@
buff = malloc(buffsz);
if (!buff)
return FALSE;
+ snprintf(buff, buffsz -1, "RunTorAtStart=true\r\n\r\n");
+ WriteFile(dest, buff, strlen(buff), &written, NULL);
if (escquote(polipocfg, &epath)) {
snprintf(buff, buffsz -1,
@@ -292,13 +296,24 @@
}
while (ReadFile(src, buff, buffsz, &len, NULL) && (len > 0))
WriteFile(dest, buff, len, &written, NULL);
+
+ snprintf(buff, buffsz -1, "[Tor]\r\nChanged=true\r\nTorExecutable=\r\n");
+ WriteFile(dest, buff, strlen(buff), &written, NULL);
if (escquote(datadir, &epath)) {
snprintf(buff, buffsz -1,
- "DataDirectory=%s\n",
+ "DataDirectory=%s\r\n",
epath);
WriteFile(dest, buff, strlen(buff), &written, NULL);
free(epath);
}
+ snprintf(buff, buffsz -1, "ControlAddr=%s\r\n",
+ TOR_TAP_VMIP);
+ WriteFile(dest, buff, strlen(buff), &written, NULL);
+ snprintf(buff, buffsz -1, "UseRandomPassword=false\r\n");
+ WriteFile(dest, buff, strlen(buff), &written, NULL);
+ snprintf(buff, buffsz -1, "ControlPassword=%s\r\n",
+ "password"); /* XXX: TEMP static default passwd */
+ WriteFile(dest, buff, strlen(buff), &written, NULL);
free (buff);
CloseHandle (src);
CloseHandle (dest);
@@ -308,17 +323,12 @@
BOOL installtap(void)
{
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
+ BOOL retval = TRUE;
LPTSTR cmd = NULL;
LPTSTR dir = NULL;
LPTSTR devcon = NULL;
DWORD cmdlen;
- DWORD exitcode;
- DWORD opts = 0;
- opts = CREATE_NEW_PROCESS_GROUP;
-
if (!buildfpath(PATH_FQ, VMDIR_LIB, NULL, NULL, &dir)) {
lerror ("Unable to build path for lib dir.");
return FALSE;
@@ -327,49 +337,25 @@
lerror ("Unable to build path for devcon.exe utility.");
return FALSE;
}
- ZeroMemory( &pi, sizeof(pi) );
- ZeroMemory( &si, sizeof(si) );
- si.cb = sizeof(si);
+
cmdlen = strlen(devcon) + 64;
cmd = malloc(cmdlen);
snprintf (cmd, cmdlen, "\"%s\" install tortap91.inf TORTAP91", devcon);
ldebug ("Tap install pwd: %s, cmd: %s", dir, cmd);
-
- if( !CreateProcess(NULL,
- cmd,
- NULL, // process handle no inherit
- NULL, // thread handle no inherit
- FALSE, // default handle inheritance false
- opts,
- NULL, // environment block
- dir,
- &si,
- &pi) ) {
- lerror ("Failed to launch process. Error code: %d", GetLastError());
- }
- free (cmd);
-
- linfo ("waiting for TAP-Win32 driver install to complete ...");
- while ( GetExitCodeProcess(pi.hProcess, &exitcode) && (exitcode == STILL_ACTIVE) ) {
- Sleep (500);
- }
- linfo ("TAP-Win32 install exited with value %d", exitcode);
- CloseHandle(pi.hThread);
- CloseHandle(pi.hProcess);
-
- return TRUE;
+ if (runcommand(cmd,dir))
+ retval = TRUE;
+ if (cmd)
+ free(cmd);
+ return retval;
}
BOOL uninstalltap(void)
{
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
+ BOOL retval = FALSE;
LPTSTR cmd = NULL;
LPTSTR dir = NULL;
LPTSTR devcon = NULL;
DWORD cmdlen;
- DWORD exitcode;
- DWORD opts = 0;
LONG status;
HKEY key;
DWORD len;
@@ -379,8 +365,6 @@
const char name_string[] = "Name";
char svc_string[REG_NAME_MAX];
- opts = CREATE_NEW_PROCESS_GROUP;
-
if (!buildfpath(PATH_FQ, VMDIR_LIB, NULL, NULL, &dir)) {
lerror ("Unable to build path for lib dir.");
return FALSE;
@@ -390,36 +374,15 @@
return FALSE;
}
- ZeroMemory( &pi, sizeof(pi) );
- ZeroMemory( &si, sizeof(si) );
- si.cb = sizeof(si);
cmdlen = strlen(devcon) + 64;
cmd = malloc(cmdlen);
snprintf (cmd, cmdlen, "\"%s\" install tortap91.inf TORTAP91", devcon);
ldebug ("Tap un-install pwd: %s, cmd: %s", dir, cmd);
-
- ldebug ("Removing TORTAP91 device via devcon.");
- if( !CreateProcess(NULL,
- cmd,
- NULL, // process handle no inherit
- NULL, // thread handle no inherit
- FALSE, // default handle inheritance false
- opts,
- NULL, // environment block
- dir,
- &si,
- &pi) ) {
- lerror ("Failed to launch process. Error code: %d", GetLastError());
- return FALSE;
- }
- free (cmd);
+ if (runcommand(cmd,dir))
+ retval = TRUE;
+ if (cmd)
+ free (cmd);
- while ( GetExitCodeProcess(pi.hProcess, &exitcode) && (exitcode == STILL_ACTIVE) ) {
- Sleep (500);
- }
- CloseHandle(pi.hThread);
- CloseHandle(pi.hProcess);
-
ldebug ("Removal complete. Checking registry for Tor Tap connection entries.");
/* clean up registry keys left after tap adapter is removed
*/
@@ -1549,11 +1512,6 @@
*/
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);
- }
-
cmd = malloc(CMDMAX);
snprintf (cmd, CMDMAX -1,
"\"%s\" -tor-address %s %s",
@@ -2016,6 +1974,7 @@
LPTSTR logfile = NULL;
LPTSTR ctliparg = NULL;
LPTSTR ctlportarg = NULL;
+ LPTSTR polipodir;
DWORD taptimeout = 60; /* the tap device can't be configured until the VM connects it */
int c, optidx = 0;
@@ -2284,7 +2243,7 @@
ldebug ("Done waiting.");
if (! isrunning(&pi)) {
- lerror ("Qemu VM failed to start properly.");
+ lerror ("Virtual machine failed to start properly.");
goto shutdown;
}
if (! isconnected(tapconn->guid)) {
@@ -2309,11 +2268,25 @@
while ( (!tryconnect(TOR_TAP_VMIP, 9051)) && (i > 0) ) {
ldebug("Control port connect attempt failed, trying again... [%d left]", i);
Sleep(1000);
+ if (!isrunning(&pi))
+ i = 0;
+ else
+ i--;
}
if (i > 0) {
ldebug("Control port connected. Starting controller ...");
+
+ /* XXX: Why does vidalia have trouble immediately after start?
+ * May need a few seconds for Tor in the VM to get up to speed
+ * even though control socket is accepting in event loop.
+ */
+ Sleep(2000);
dispmsg(" - Launching Vidalia");
runvidalia(indebug);
+ /* XXX: Next step to launch polipo and vidalia separately, then handle restart/kill as needed.
+ * buildsyspath(SYSDIR_LCLPROGRAMS, "Polipo", &polipdir);
+ * runcommand("polipo.exe -c polipo.conf", polipodir);
+ */
/* XXX: Now we wait for the ALL READY socket to be listening before switching.
* If we don't get bootstrapped within this period of time something is broken/blocked.
@@ -2331,32 +2304,36 @@
}
if (i > 0) {
/* Once/if bootstrapped allow the user to run applications with restricted privs. */
- cleanruserfiles(TOR_RESTRICTED_USER);
userswitcher();
}
}
}
- dispmsg("");
- dispmsg("GOOD! Tor VM is running.");
- dispmsg(" - Waiting for VM to exit ...");
- if (bundle)
- dispmsg(" NOTE: Select the \"Exit\" option in Vidalia to shutdown.");
- else
- dispmsg(" NOTE: Close the \"QEMU (Tor VM)\" window to shutdown.");
- dispmsg("");
- /* TODO: once the pcap bridge is up we can re-enable the firewall IF we
- * add an exception for the control port on the Tap adapter.
- */
- waitforit(&pi);
-
- linfo ("Tor VM closed, restoring host network and services.");
+ if (isrunning(&pi)) {
+ dispmsg("");
+ dispmsg("GOOD! Tor VM is running.");
+ dispmsg(" - Waiting for VM to exit ...");
+ if (bundle)
+ dispmsg(" NOTE: Select the \"Exit\" option in Vidalia to shutdown.");
+ else
+ dispmsg(" NOTE: Close the \"QEMU (Tor VM)\" window to shutdown.");
+ dispmsg("");
+ /* TODO: once the pcap bridge is up we can re-enable the firewall IF we
+ * add an exception for the control port on the Tap adapter.
+ */
+ waitforit(&pi);
+ linfo ("Tor VM closed, restoring host network and services.");
+ }
+ else {
+ lerror ("Virtual machine failed to start properly.");
+ linfo ("Tor VM Qemu failed to start properly.");
+ }
dispmsg("Shutting down.");
dispmsg("CAUTION: Restoring network settings. Do NOT close this window!");
if (bundle) {
disableuser(TOR_RESTRICTED_USER);
- cleanruserfiles(TOR_RESTRICTED_USER);
+ /* cleanruserfiles(TOR_RESTRICTED_USER); */
}
shutdown:
More information about the tor-commits
mailing list