Print this page
5910 libnisdb won't build with modern GCC

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libnisdb/nis_parse_ldap_conf.c
          +++ new/usr/src/lib/libnisdb/nis_parse_ldap_conf.c
↓ open down ↓ 11 lines elided ↑ open up ↑
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
       22 + * Copyright 2015 Gary Mills
  22   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   24   * Use is subject to license terms.
  24   25   */
  25   26  
  26   27  #include <stdio.h>
  27   28  #include <string.h>
  28   29  #include <stdlib.h>
  29   30  #include <ctype.h>
  30   31  #include <fcntl.h>
  31   32  #include <unistd.h>
↓ open down ↓ 45 lines elided ↑ open up ↑
  77   78      __nis_ldap_proxy_info *proxy_info, __nis_config_t *nis_config,
  78   79      __nis_table_mapping_t **table_mapping, __nis_config_info_t *config_info,
  79   80      __nisdb_table_mapping_t *table_info);
  80   81  static int parse_ldap_config_dn_attrs(__nis_ldap_proxy_info *proxy_info,
  81   82      __nis_config_t *nis_config, __nis_table_mapping_t **table_mapping,
  82   83      __nis_config_info_t *config_info, __nisdb_table_mapping_t *table_info);
  83   84  static int yp_parse_ldap_default_conf(__nis_ldap_proxy_info *proxy_info,
  84   85          __nis_config_t *nis_config, __nis_config_info_t *config_info,
  85   86          __nisdb_table_mapping_t *table_info);
  86   87  
       88 +/* Forward declarations */
       89 +int yp_parse_ldap_config_file(const char *, __nis_ldap_proxy_info *,
       90 +    __nis_config_t *, __nis_table_mapping_t **, __nis_config_info_t *,
       91 +    __nisdb_table_mapping_t *,  __yp_domain_context_t *);
  87   92  
       93 +
  88   94  /* helper functions */
  89   95  static config_key get_attrib_num_cmdline(const char *s,
  90   96      const char **begin_s, const char **end_s);
  91   97  static config_key get_file_attr_val(int fd, char **attr_val);
  92   98  static void get_attribute_list(
  93   99          const __nis_ldap_proxy_info *proxy_info,
  94  100          const __nis_config_t *nis_config,
  95  101          const __nis_config_info_t *config_info,
  96  102          const __nisdb_table_mapping_t *table_info,
  97  103          char **ldap_config_attributes);
↓ open down ↓ 23 lines elided ↑ open up ↑
 121  127  parse_ldap_migration(
 122  128          const char *const       *cmdline_options,
 123  129          const char              *config_file)
 124  130  {
 125  131          int                     rc      = 0;
 126  132          __nis_config_info_t     config_info
 127  133                                  = {NULL, NULL, (auth_method_t)NO_VALUE_SET,
 128  134                                          (tls_method_t)NO_VALUE_SET, NULL,
 129  135                                          NULL, NULL};
 130  136          struct stat             buf;
 131      -        int i = 0;
 132  137  
 133  138          p_error = no_parse_error;
 134  139  
 135  140          if (verbose)
 136  141                  report_info("Getting LDAP configuration", NULL);
 137  142  
 138  143          initialize_parse_structs(&proxyInfo, &ldapConfig, &ldapDBTableMapping);
 139  144  
 140  145          if (yp2ldap)
 141  146                  initialize_yp_parse_structs(&ypDomains);
↓ open down ↓ 263 lines elided ↑ open up ↑
 405  410          __nis_config_info_t *config_info,
 406  411          __nisdb_table_mapping_t *table_info)
 407  412  {
 408  413          int rc = 0;
 409  414          char            *ldap_config_attributes[n_config_keys];
 410  415          char            attr_buf[128];
 411  416          char            *attr;
 412  417          char            *attr_val;
 413  418          int             defflags;
 414  419          config_key      attrib_num;
 415      -        int     i, len, attr_len;
      420 +        int             i, len;
 416  421          void            *defp;
 417  422  
 418  423          if ((defp = defopen_r(YP_ETCCONFFILE)) != NULL) {
 419  424                  file_source = YP_ETCCONFFILE;
 420  425                  if (verbose)
 421  426                          report_info("default configuration values: ", NULL);
 422  427                  /* Set defread_r() to be case insensitive */
 423  428                  defflags = defcntl_r(DC_GETFLAGS, 0, defp);
 424  429                  TURNOFF(defflags, DC_CASE);
 425  430                  (void) defcntl_r(DC_SETFLAGS, defflags, defp);
↓ open down ↓ 213 lines elided ↑ open up ↑
 639  644  yp_parse_ldap_config_file(
 640  645          const char      *config_file,
 641  646          __nis_ldap_proxy_info   *proxy_info,
 642  647          __nis_config_t                  *nis_config,
 643  648          __nis_table_mapping_t   **table_mapping,
 644  649          __nis_config_info_t             *config_info,
 645  650          __nisdb_table_mapping_t *table_info,
 646  651          __yp_domain_context_t   *ypDomains)
 647  652  {
 648  653          int     rc = 0;
 649      -        int     numDomains = 0;
 650  654          config_key      attrib_num;
 651  655          int     fd;
 652  656          char    *attr_val = NULL;
 653  657          int             len;
 654  658  
 655  659          if ((fd = open(config_file, O_RDONLY)) == -1) {
 656  660                  p_error = parse_open_file_error;
 657  661                  report_error(config_file, NULL);
 658  662                  return (-1);
 659  663          }
↓ open down ↓ 66 lines elided ↑ open up ↑
 726  730          char            buf[BUFSIZE];
 727  731          char            *start_tag;
 728  732          char            *start_val;
 729  733          char            *end_val;
 730  734          char            *cut_here;
 731  735          char            *s;
 732  736          char            *a;
 733  737          char            *attribute_value;
 734  738          int             ret;
 735  739          config_key      attrib_num = no_more_keys;
 736      -        int             found_quote = 0;
 737  740  
 738  741          *attr_val = NULL;
 739  742  
 740  743          if ((ret = read_line(fd, buf, sizeof (buf))) > 0) {
 741  744                  for (s = buf; is_whitespace(*s); s++)
 742  745                          ;
 743  746  
 744  747                  start_tag = s;
 745  748                  while (*s != '\0' && !is_whitespace(*s))
 746  749                          s++;
↓ open down ↓ 54 lines elided ↑ open up ↑
 801  804  
 802  805          return (attrib_num);
 803  806  }
 804  807  
 805  808  static LDAP *
 806  809  connect_to_ldap_config_server(
 807  810          char                    *sever_name,
 808  811          int                     server_port,
 809  812          __nis_config_info_t     *config_info)
 810  813  {
 811      -        int             rc              = 0;
 812  814          LDAP            *ld             = NULL;
 813  815          int             ldapVersion     = LDAP_VERSION3;
 814  816          int             derefOption     = LDAP_DEREF_ALWAYS;
 815  817          int             timelimit       = LDAP_NO_LIMIT;
 816  818          int             sizelimit       = LDAP_NO_LIMIT;
 817  819          int             errnum;
 818  820          bool_t          retrying        = FALSE;
 819  821          int             sleep_seconds   = 1;
 820  822          struct berval   cred;
 821  823  
↓ open down ↓ 754 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX