diff options
author | Peter Palfrader <peter@palfrader.org> | 2008-02-23 12:59:52 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2008-02-23 12:59:52 +0000 |
commit | c6a7ab729cbf01704a7e3cb3e1e4c6505a9e4a64 (patch) | |
tree | d819da93ea0c50a8499d61db5d5b27ace9ae4d3a /debian/patches | |
parent | c3ac638971b949dc99b9e8e820381a9586137d6d (diff) | |
download | tor-c6a7ab729cbf01704a7e3cb3e1e4c6505a9e4a64.tar.gz tor-c6a7ab729cbf01704a7e3cb3e1e4c6505a9e4a64.zip |
Update debian defaults in preparation for starting as root.
Previously the debian defaults were only loaded when we started Tor as
the debian-tor user. Now they are also loaded when started as root.
In addition to logging, pidfile, datadir and runasdaemon we also change
the User and Group options from their NULL default to "debian-tor" so that
Tor correctly setuids/setgids to the role user the package created.
This will allow us to start the daemon as root.
svn:r13685
Diffstat (limited to 'debian/patches')
-rwxr-xr-x | debian/patches/06_add_compile_time_defaults.dpatch | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/debian/patches/06_add_compile_time_defaults.dpatch b/debian/patches/06_add_compile_time_defaults.dpatch index 27d4b1e51c..20b645c42b 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 tor-trunk/src/or/config.c /tmp/dpep.YE8t73/tor-trunk/src/or/config.c ---- tor-trunk/src/or/config.c 2007-04-29 04:11:46.261474906 +0200 -+++ /tmp/dpep.YE8t73/tor-trunk/src/or/config.c 2007-04-29 04:12:24.827577276 +0200 -@@ -14,6 +14,7 @@ +diff -urNad trunk~/src/or/config.c trunk/src/or/config.c +--- trunk~/src/or/config.c 2008-02-23 11:08:40.000000000 +0100 ++++ trunk/src/or/config.c 2008-02-23 13:43:05.000000000 +0100 +@@ -15,6 +15,7 @@ #define CONFIG_PRIVATE #include "or.h" @@ -34,7 +34,7 @@ diff -urNad tor-trunk/src/or/config.c /tmp/dpep.YE8t73/tor-trunk/src/or/config.c #ifdef MS_WINDOWS #include <shlobj.h> #endif -@@ -595,6 +596,8 @@ +@@ -660,6 +661,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 tor-trunk/src/or/config.c /tmp/dpep.YE8t73/tor-trunk/src/or/config.c /** Magic value for or_options_t. */ #define OR_OPTIONS_MAGIC 9090909 -@@ -2991,7 +2994,7 @@ +@@ -3522,7 +3525,7 @@ int options_init_from_torrc(int argc, char **argv) { @@ -52,7 +52,7 @@ diff -urNad tor-trunk/src/or/config.c /tmp/dpep.YE8t73/tor-trunk/src/or/config.c config_line_t *cl; char *cf=NULL, *fname=NULL, *errmsg=NULL; int i, retval; -@@ -3000,6 +3003,9 @@ +@@ -3531,6 +3534,9 @@ static char **backup_argv; static int backup_argc; @@ -62,7 +62,7 @@ diff -urNad tor-trunk/src/or/config.c /tmp/dpep.YE8t73/tor-trunk/src/or/config.c if (argv) { /* first time we're called. save commandline args */ backup_argv = argv; backup_argc = argc; -@@ -3135,7 +3141,8 @@ +@@ -3666,7 +3672,8 @@ err: tor_free(fname); torrc_fname = NULL; @@ -72,7 +72,7 @@ diff -urNad tor-trunk/src/or/config.c /tmp/dpep.YE8t73/tor-trunk/src/or/config.c if (errmsg) { log(LOG_WARN,LD_CONFIG,"Failed to parse/validate config: %s", errmsg); tor_free(errmsg); -@@ -4320,3 +4327,52 @@ +@@ -5011,3 +5018,64 @@ puts(routerparse_c_id); } @@ -85,6 +85,10 @@ diff -urNad tor-trunk/src/or/config.c /tmp/dpep.YE8t73/tor-trunk/src/or/config.c + int uid; + + uid = getuid(); ++ /* If we run as root we also apply our debian defaults. */ ++ if (uid == 0) ++ return 1; ++ + pw = getpwuid(uid); + if (!pw) { + log(LOG_WARN, LD_GENERAL, "Could not get passwd information for uid %d.", uid); @@ -123,5 +127,13 @@ diff -urNad tor-trunk/src/or/config.c /tmp/dpep.YE8t73/tor-trunk/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"); ++ ++ var = config_find_option(&options_format, "Group"); ++ tor_assert(var); ++ var->initvalue = tor_strdup("debian-tor"); ++ + return 0; +} |