[tor-commits] [tor/maint-0.4.5] hs: Improve warning for bad service version

dgoulet at torproject.org dgoulet at torproject.org
Tue Oct 19 15:03:04 UTC 2021


commit d0053fdfb537b15fe31326f778dd4380cab17255
Author: David Goulet <dgoulet at torproject.org>
Date:   Thu Oct 14 09:56:10 2021 -0400

    hs: Improve warning for bad service version
    
    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 at torproject.org>
---
 src/feature/hs/hs_config.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/feature/hs/hs_config.c b/src/feature/hs/hs_config.c
index 7ffc7ecb96..f8d71674de 100644
--- a/src/feature/hs/hs_config.c
+++ b/src/feature/hs/hs_config.c
@@ -179,8 +179,12 @@ static bool
 check_value_oob(int i, const char *name, int low, int high)
 {
   if (i < low || i > high) {
-    log_warn(LD_CONFIG, "%s must be between %d and %d, not %d.",
-             name, low, high, i);
+    if (low == high) {
+      log_warn(LD_CONFIG, "%s must be %d, not %d.", name, low, i);
+    } else {
+      log_warn(LD_CONFIG, "%s must be between %d and %d, not %d.",
+               name, low, high, i);
+    }
     return true;
   }
   return false;





More information about the tor-commits mailing list