[or-cvs] [tor/master] Bug #1107: Complain if PublishServerDescriptor receives 0 or 1 in a list

nickm at torproject.org nickm at torproject.org
Mon Aug 2 15:59:59 UTC 2010


Author: Chris Ball <chris at printf.net>
Date: Sat, 31 Jul 2010 18:06:40 -0400
Subject: Bug #1107: Complain if PublishServerDescriptor receives 0 or 1 in a list
Commit: 600ba86f4a1d15ae6037246a1715f995e4b0f5b0

0 or 1 should only be passed as the sole argument. Warn for now, reject
in 0.2.3.x.
---
 changes/bug1107 |    5 +++++
 src/or/config.c |   12 ++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
 create mode 100644 changes/bug1107

diff --git a/changes/bug1107 b/changes/bug1107
new file mode 100644
index 0000000..c396b5d
--- /dev/null
+++ b/changes/bug1107
@@ -0,0 +1,5 @@
+  o Minor bugfixes:
+    - Complain if PublishServerDescriptor is given multiple arguments that
+      include 0 or 1. This configuration will be rejected in future.
+      Bugfix in 0.2.0.1-alpha, closes bug 1107.
+
diff --git a/src/or/config.c b/src/or/config.c
index a4e4f89..fc84556 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -3578,6 +3578,18 @@ options_validate(or_options_t *old_options, or_options_t *options,
   if (options->AccelDir && !options->AccelName)
     REJECT("Can't use hardware crypto accelerator dir without engine name.");
 
+  if (options->PublishServerDescriptor)
+    SMARTLIST_FOREACH(options->PublishServerDescriptor, const char *, pubdes, {
+      if (!strcmp(pubdes, "1") || !strcmp(pubdes, "0"))
+        if (smartlist_len(options->PublishServerDescriptor) > 1) {
+          COMPLAIN("You have passed a list of multiple arguments to the "
+                   "PublishServerDescriptor option that includes 0 or 1. "
+                   "0 or 1 should only be used as the sole argument. "
+                   "This configuration will be rejected in a future release.");
+          break;
+        }
+    });
+
   return 0;
 #undef REJECT
 #undef COMPLAIN
-- 
1.7.1



More information about the tor-commits mailing list