aboutsummaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2009-02-04 23:42:39 +0000
committerPeter Palfrader <peter@palfrader.org>2009-02-04 23:42:39 +0000
commit6a11cded87a16579a5a6d8ca899e2b5d9c00b947 (patch)
tree05a9cc40d82c103434a46d84d68ac5fa5834d4d9 /debian
parentdecdf4537ab9d2fc8301a01f7b7ce1b47b109f98 (diff)
downloadtor-6a11cded87a16579a5a6d8ca899e2b5d9c00b947.tar
tor-6a11cded87a16579a5a6d8ca899e2b5d9c00b947.tar.gz
patches/06_add_compile_time_defaults: Only set the User option in the config if
we run as root. Do not set it when run as debian-tor as Tor then always insists on changing users which will fail. (If we run as any other user we don't set our debian defaults anyway.) svn:r18397
Diffstat (limited to 'debian')
-rw-r--r--debian/changelog9
-rwxr-xr-xdebian/patches/06_add_compile_time_defaults.dpatch28
2 files changed, 24 insertions, 13 deletions
diff --git a/debian/changelog b/debian/changelog
index 7433f7cc6..06b6b03ab 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+tor (0.2.1.11-alpha-2~1) experimental; urgency=low
+
+ * patches/06_add_compile_time_defaults: Only set the User option in
+ the config if we run as root. Do not set it when run as debian-tor
+ as Tor then always insists on changing users which will fail. (If
+ we run as any other user we don't set our debian defaults anyway.)
+
+ -- Peter Palfrader <weasel@debian.org> Thu, 05 Feb 2009 00:27:23 +0100
+
tor (0.2.1.11-alpha-1) experimental; urgency=high
* New upstream version:
diff --git a/debian/patches/06_add_compile_time_defaults.dpatch b/debian/patches/06_add_compile_time_defaults.dpatch
index e893ddd50..7dfce2ef2 100755
--- a/debian/patches/06_add_compile_time_defaults.dpatch
+++ b/debian/patches/06_add_compile_time_defaults.dpatch
@@ -23,10 +23,10 @@ esac
exit 0
@DPATCH@
-diff -urNad git-trunk-conf~/src/or/config.c git-trunk-conf/src/or/config.c
---- git-trunk-conf~/src/or/config.c 2008-03-11 15:23:01.000000000 +0100
-+++ git-trunk-conf/src/or/config.c 2008-03-11 15:30:34.139280421 +0100
-@@ -15,6 +15,7 @@
+diff -urNad tor-trunk~/src/or/config.c tor-trunk/src/or/config.c
+--- tor-trunk~/src/or/config.c 2009-01-18 01:47:33.000000000 +0100
++++ tor-trunk/src/or/config.c 2009-02-05 00:25:17.614844812 +0100
+@@ -12,6 +12,7 @@
#define CONFIG_PRIVATE
#include "or.h"
@@ -34,7 +34,7 @@ diff -urNad git-trunk-conf~/src/or/config.c git-trunk-conf/src/or/config.c
#ifdef MS_WINDOWS
#include <shlobj.h>
#endif
-@@ -658,6 +659,8 @@
+@@ -711,6 +712,8 @@
#if defined(HAVE_EVENT_GET_VERSION) && defined(HAVE_EVENT_GET_METHOD)
static void check_libevent_version(const char *m, int server);
#endif
@@ -43,7 +43,7 @@ diff -urNad git-trunk-conf~/src/or/config.c git-trunk-conf/src/or/config.c
/** Magic value for or_options_t. */
#define OR_OPTIONS_MAGIC 9090909
-@@ -3634,6 +3637,9 @@
+@@ -3917,6 +3920,9 @@
char *command_arg = NULL;
char *errmsg=NULL;
@@ -53,12 +53,12 @@ diff -urNad git-trunk-conf~/src/or/config.c git-trunk-conf/src/or/config.c
if (argv) { /* first time we're called. save commandline args */
backup_argv = argv;
backup_argc = argc;
-@@ -5051,3 +5057,60 @@
- puts(routerparse_c_id);
+@@ -5307,3 +5313,62 @@
+ return 0;
}
+/* Checks whether we are running as the debian-tor user.
-+ * Returns -1 on error, 1 if we are debian-tor, 0 if not */
++ * Returns -1 on error, 2 if we are root, 1 if we are debian-tor, 0 if we are any normal user */
+static int
+debian_running_as_debiantor()
+{
@@ -68,7 +68,7 @@ diff -urNad git-trunk-conf~/src/or/config.c git-trunk-conf/src/or/config.c
+ uid = getuid();
+ /* If we run as root we also apply our debian defaults. */
+ if (uid == 0)
-+ return 1;
++ return 2;
+
+ pw = getpwuid(uid);
+ if (!pw) {
@@ -108,9 +108,11 @@ diff -urNad git-trunk-conf~/src/or/config.c git-trunk-conf/src/or/config.c
+ tor_assert(var);
+ var->initvalue = tor_strdup("1");
+
-+ var = config_find_option(&options_format, "User");
-+ tor_assert(var);
-+ var->initvalue = tor_strdup("debian-tor");
++ if (running_as_debian == 2) {
++ var = config_find_option(&options_format, "User");
++ tor_assert(var);
++ var->initvalue = tor_strdup("debian-tor");
++ };
+
+ return 0;
+}