Ticket #1107: 0001-Bug-1107-Complain-if-PublishServerDescriptor-receive.patch

File 0001-Bug-1107-Complain-if-PublishServerDescriptor-receive.patch, 1.7 KB (added by cjb, 10 years ago)
  • new file changes/bug1107

    From f5ddf7d06f8de070194a50e51649d1d3ab4afc48 Mon Sep 17 00:00:00 2001
    From: Chris Ball <chris@printf.net>
    Date: Sat, 31 Jul 2010 18:06:40 -0400
    Subject: [PATCH] Bug #1107: Complain if PublishServerDescriptor receives 0 or 1 in a list
    
    0 or 1 should only be passed as the sole argument. Warn for now, reject
    in 0.2.3.x.
    ---
     changes/bug1107 |    4 ++++
     src/or/config.c |   12 ++++++++++++
     2 files changed, 16 insertions(+), 0 deletions(-)
     create mode 100644 changes/bug1107
    
    diff --git a/changes/bug1107 b/changes/bug1107
    new file mode 100644
    index 0000000..4af0795
    - +  
     1  o Minor bugfixes:
     2    - #1107: Complain if PublishServerDescriptor is given multiple arguments
     3      that include 0 or 1. This configuration will be rejected in future.
     4
  • src/or/config.c

    diff --git a/src/or/config.c b/src/or/config.c
    index a4e4f89..6312760 100644
    a b options_validate(or_options_t *old_options, or_options_t *options, 
    35783578  if (options->AccelDir && !options->AccelName)
    35793579    REJECT("Can't use hardware crypto accelerator dir without engine name.");
    35803580
     3581  if (options->PublishServerDescriptor)
     3582    SMARTLIST_FOREACH(options->PublishServerDescriptor, const char *, pubdesc, {
     3583      if (!strcmp(pubdesc, "1") || !strcmp(pubdesc, "0"))
     3584        if (smartlist_len(options->PublishServerDescriptor) > 1) {
     3585          COMPLAIN("You have passed a list of multiple arguments to the "
     3586                   "PublishServerDescriptor option that includes 0 or 1. "
     3587                   "0 or 1 should only be used as the sole argument. "
     3588                   "This configuration will be rejected in a future release.");
     3589          break;
     3590        }
     3591    });
     3592
    35813593  return 0;
    35823594#undef REJECT
    35833595#undef COMPLAIN