]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
hs: Improve warning for bad service version
authorDavid Goulet <dgoulet@torproject.org>
Thu, 14 Oct 2021 13:56:10 +0000 (09:56 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Tue, 19 Oct 2021 13:51:24 +0000 (09:51 -0400)
Now that we don't have version 2, it gives us:

  [warn] HiddenServiceVersion must be between 3 and 3, not 2.

This commit changes it to:

  [warn] HiddenServiceVersion must be 3, not 2.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
src/feature/hs/hs_config.c

index ee4499ef5b609dadb4f3a97ba4895fc129613466..79fadf4c0de2f55baa37291d95cec60e09af0733 100644 (file)
@@ -135,9 +135,13 @@ helper_parse_uint64(const char *opt, const char *value, uint64_t min,
   *ok = 0;
   ret = tor_parse_uint64(value, 10, min, max, ok, NULL);
   if (!*ok) {
-    log_warn(LD_CONFIG, "%s must be between %" PRIu64 " and %"PRIu64
-                        ", not %s.",
-             opt, min, max, value);
+    if (min == max) {
+      log_warn(LD_CONFIG, "%s must be %" PRIu64 ", not %s.", opt, max, value);
+    } else {
+      log_warn(LD_CONFIG, "%s must be between %" PRIu64 " and %"PRIu64
+                          ", not %s.",
+               opt, min, max, value);
+    }
     goto err;
   }
   log_info(LD_CONFIG, "%s was parsed to %" PRIu64, opt, ret);