Print this page
NEX-20555 idmap fall-back to DC discovery is broken
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
NEX-2892 NexentaStor losing connectivity to multihomed AD servers
Reviewed by: Bayard Bell <bayard.bell@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
NEX-1638 Updated DC Locator
 Includes work by: matt.barden@nexenta.com, kevin.crowe@nexenta.com

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/idmap/test-getdc/getdc_main.c
          +++ new/usr/src/cmd/idmap/test-getdc/getdc_main.c
↓ open down ↓ 2 lines elided ↑ open up ↑
   3    3   * Common Development and Distribution License ("CDDL"), version 1.0.
   4    4   * You may only use this file in accordance with the terms of version
   5    5   * 1.0 of the CDDL.
   6    6   *
   7    7   * A full copy of the text of the CDDL should have accompanied this
   8    8   * source.  A copy of the CDDL is also available via the Internet at
   9    9   * http://www.illumos.org/license/CDDL.
  10   10   */
  11   11  
  12   12  /*
  13      - * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
       13 + * Copyright 2019 Nexenta Systems, Inc.  All rights reserved.
  14   14   */
  15   15  
  16   16  
  17   17  #include <sys/note.h>
  18   18  #include <stdarg.h>
  19   19  #include <stdio.h>
  20   20  #include <addisc.h>
  21   21  #include <netinet/in.h>
  22   22  #include <arpa/inet.h>
  23   23  
  24   24  int debug;
  25   25  char *domainname = NULL;
       26 +char *sitename = NULL;
  26   27  
  27   28  void print_ds(ad_disc_ds_t *);
  28   29  void mylogger(int pri, const char *format, ...);
  29   30  
  30   31  int
  31   32  main(int argc, char *argv[])
  32   33  {
  33   34          ad_disc_t ad_ctx = NULL;
  34   35          boolean_t autodisc;
  35   36          ad_disc_ds_t *dc, *gc;
↓ open down ↓ 5 lines elided ↑ open up ↑
  41   42                  case '?':
  42   43                          (void) fprintf(stderr, "bad option: -%c\n", optopt);
  43   44                          return (1);
  44   45                  case 'd':
  45   46                          debug++;
  46   47                          break;
  47   48                  }
  48   49          }
  49   50  
  50   51          if (optind < argc)
  51      -                domainname = argv[optind];
       52 +                domainname = argv[optind++];
       53 +        if (optind < argc)
       54 +                sitename = argv[optind++];
  52   55  
  53   56          adutils_set_logger(mylogger);
  54   57          adutils_set_debug(AD_DEBUG_ALL, debug);
  55   58  
  56   59          ad_ctx = ad_disc_init();
  57   60          ad_disc_set_StatusFP(ad_ctx, stdout);
  58   61  
  59   62          if (domainname)
  60   63                  (void) ad_disc_set_DomainName(ad_ctx, domainname);
       64 +        if (sitename)
       65 +                (void) ad_disc_set_SiteName(ad_ctx, sitename);
  61   66  
  62   67          ad_disc_refresh(ad_ctx);
  63   68  
  64   69          dc = ad_disc_get_DomainController(ad_ctx,
  65   70              AD_DISC_PREFER_SITE, &autodisc);
  66   71          if (dc == NULL) {
  67   72                  (void) printf("getdc failed\n");
  68   73                  return (1);
  69   74          }
  70   75          (void) printf("Found a DC:\n");
↓ open down ↓ 84 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX