[or-cvs] r18397: {tor} patches/06_add_compile_time_defaults: Only set the User opti (in tor/trunk/debian: . patches)
weasel at seul.org
weasel at seul.org
Wed Feb 4 23:42:40 UTC 2009
Author: weasel
Date: 2009-02-04 18:42:39 -0500 (Wed, 04 Feb 2009)
New Revision: 18397
Modified:
tor/trunk/debian/changelog
tor/trunk/debian/patches/06_add_compile_time_defaults.dpatch
Log:
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.)
Modified: tor/trunk/debian/changelog
===================================================================
--- tor/trunk/debian/changelog 2009-02-04 23:27:35 UTC (rev 18396)
+++ tor/trunk/debian/changelog 2009-02-04 23:42:39 UTC (rev 18397)
@@ -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 at debian.org> Thu, 05 Feb 2009 00:27:23 +0100
+
tor (0.2.1.11-alpha-1) experimental; urgency=high
* New upstream version:
Modified: tor/trunk/debian/patches/06_add_compile_time_defaults.dpatch
===================================================================
--- tor/trunk/debian/patches/06_add_compile_time_defaults.dpatch 2009-02-04 23:27:35 UTC (rev 18396)
+++ tor/trunk/debian/patches/06_add_compile_time_defaults.dpatch 2009-02-04 23:42:39 UTC (rev 18397)
@@ -23,10 +23,10 @@
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 @@
#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 @@
/** 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 @@
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 @@
+ 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 @@
+ 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;
+}
More information about the tor-commits
mailing list