[tor-commits] [tor/master] Do not require a valid torrc for

asn at torproject.org asn at torproject.org
Wed Jan 27 13:44:32 UTC 2021


commit 3d993d4d8569617acf8059a6d6f7702aaf41bba4
Author: Neel Chauhan <neel at neelc.org>
Date:   Wed Jan 6 10:41:27 2021 -0800

    Do not require a valid torrc for
---
 changes/bug40235        | 5 +++++
 src/app/config/config.c | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/changes/bug40235 b/changes/bug40235
new file mode 100644
index 0000000000..baf72c3da7
--- /dev/null
+++ b/changes/bug40235
@@ -0,0 +1,5 @@
+  o Minor bugfixes (key generation):
+    - Do not require a valid torrc when using the `--keygen` argument
+      to generate a signing key. This allows us to generate keys on
+      systems or users which may not run Tor. Fixes bug 40235; bugfix
+      on 0.2.7.2-alpha. Patch by Neel Chauhan.
diff --git a/src/app/config/config.c b/src/app/config/config.c
index bf2f49ead4..e6fde2d62f 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -4338,6 +4338,7 @@ find_torrc_filename(const config_line_t *cmd_arg,
   const config_line_t *p_index;
   const char *fname_opt = defaults_file ? "--defaults-torrc" : "-f";
   const char *ignore_opt = defaults_file ? NULL : "--ignore-missing-torrc";
+  const char *keygen_opt = "--keygen";
 
   if (defaults_file)
     *ignore_missing_torrc = 1;
@@ -4359,7 +4360,8 @@ find_torrc_filename(const config_line_t *cmd_arg,
       }
 
       *using_default_fname = 0;
-    } else if (ignore_opt && !strcmp(p_index->key,ignore_opt)) {
+    } else if ((ignore_opt && !strcmp(p_index->key, ignore_opt)) ||
+               (keygen_opt && !strcmp(p_index->key, keygen_opt))) {
       *ignore_missing_torrc = 1;
     }
   }





More information about the tor-commits mailing list