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_map.c
          +++ new/usr/src/lib/libnisdb/nis_parse_ldap_map.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   *
  14   14   * When distributing Covered Code, include this CDDL HEADER in each
  15   15   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16   16   * If applicable, add the following below this CDDL HEADER, with the
  17   17   * fields enclosed by brackets "[]" replaced with your own identifying
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  /*
       23 + * Copyright 2015 Gary Mills
  23   24   * Copyright 2001-2003 Sun Microsystems, Inc.  All rights reserved.
  24   25   * Use is subject to license terms.
  25   26   */
  26   27  
  27      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  28      -
  29   28  #include <stdio.h>
  30   29  #include <string.h>
  31   30  #include <stdlib.h>
  32   31  #include <ctype.h>
  33   32  #include <fcntl.h>
  34   33  #include <unistd.h>
  35   34  #include <locale.h>
  36   35  
  37   36  #include "ldap_parse.h"
  38   37  #include "nis_parse_ldap_conf.h"
       38 +#include "nis_parse_ldap_yp_util.h"
       39 +#include "nis_parse_ldap_util.h"
  39   40  
  40   41  /* other attribute functions */
  41   42  static char *getIndex(const char **s_cur, const char *end_s);
  42   43  static bool_t get_ttls(const char *s, const char *s_end,
  43   44      __nis_table_mapping_t *t_mapping);
  44   45  static __nis_object_dn_t *parse_object_dn(const char *s, const char *end);
  45   46  static int      parse_name_fields(const char *name_s, const char *name_s_end,
  46   47          __nis_table_mapping_t *t_mapping);
  47   48  static void get_mapping_rule(const char *s, int len,
  48   49      __nis_table_mapping_t *tbl, bool_t to_ldap);
↓ open down ↓ 37 lines elided ↑ open up ↑
  86   87  add_mapping_attribute(
  87   88          config_key              attrib_num,
  88   89          const char              *attrib_val,
  89   90          int                     attrib_len,
  90   91          __nis_table_mapping_t   **table_mapping)
  91   92  {
  92   93          const char              *s;
  93   94          const char              *attrib_end;
  94   95          const char              *db_id_end;
  95   96          const char              *begin_token;
  96      -        const char              *end_token;
  97   97          char                    *index_string;
  98   98          __nis_object_dn_t       *objectDN;
  99   99          __nis_table_mapping_t   *t_mapping;
 100  100          __nis_table_mapping_t   *t;
 101  101  
 102  102          bool_t                  new_mapping     = FALSE;
 103  103          int                             nm;
 104  104          char                    *tmp_dbId;
 105  105  
 106  106          attrib_end = attrib_val + attrib_len;
↓ open down ↓ 264 lines elided ↑ open up ↑
 371  371  int
 372  372  add_ypdomains_attribute(
 373  373          config_key              attrib_num,
 374  374          const char              *attrib_val,
 375  375          int                             attrib_len,
 376  376          __yp_domain_context_t   *ypDomains)
 377  377  {
 378  378          const char              *s;
 379  379          const char              *attrib_end;
 380  380          int                             numDomains = 0;
 381      -        int                     i;
 382      -        char                    *tmp_str;
 383      -        int                             ret = 0;
 384  381  
 385  382          attrib_end = attrib_val + attrib_len;
 386  383          for (s = attrib_val; s < attrib_end; s++) {
 387  384                  if (*s == COLON_CHAR) {
 388  385                          break;
 389  386                  }
 390  387          }
 391  388          while (s > attrib_val && is_whitespace(s[-1]))
 392  389                  s--;
 393  390  
↓ open down ↓ 1110 lines elided ↑ open up ↑
1504 1501                                  end_token = end_s;
1505 1502                                  s = get_next_token(&begin_token, &end_token,
1506 1503                                          &t);
1507 1504                                  if (s == NULL || t != quoted_string_token) {
1508 1505                                      p_error =
1509 1506                                          parse_format_string_expected_error;
1510 1507                                      break;
1511 1508                                  }
1512 1509  
1513 1510                                  if (end_token == begin_token + 1 ||
1514      -                                    *begin_token == ESCAPE_CHAR &&
1515      -                                    end_token == begin_token + 2) {
     1511 +                                    (*begin_token == ESCAPE_CHAR &&
     1512 +                                    end_token == begin_token + 2)) {
1516 1513                                          e->type = me_split;
1517 1514                                          e->element.split.item = item;
1518 1515                                          e->element.split.delim = *begin_token;
1519 1516                                  } else {
1520 1517                                          str = s_strndup(begin_token,
1521 1518                                                  end_token - begin_token);
1522 1519                                          if (str == NULL)
1523 1520                                                  break;
1524 1521                                          if (!get_mapping_format(str, &fmt,
1525 1522                                              NULL, &n, FALSE))
↓ open down ↓ 119 lines elided ↑ open up ↑
1645 1642                          p_error = parse_unexpected_data_end_rule;
1646 1643                          break;
1647 1644                  } else if (t == close_paren_token) {
1648 1645                          doElide = FALSE;
1649 1646                          elide = '\0';
1650 1647                  } else if (t == comma_token) {
1651 1648                          begin_token = s;
1652 1649                          end_token = end_s;
1653 1650                          s = get_next_token(&begin_token, &end_token, &t);
1654 1651                          if (s != NULL && t == quoted_string_token &&
1655      -                                (end_token == begin_token + 1 ||
1656      -                                    *begin_token == ESCAPE_CHAR &&
1657      -                                    end_token == begin_token + 2)) {
     1652 +                            (end_token == begin_token + 1 ||
     1653 +                            (*begin_token == ESCAPE_CHAR &&
     1654 +                            end_token == begin_token + 2))) {
1658 1655                                  if (numSubElements != 1 ||
1659 1656                                      subElement->type == me_extract ||
1660 1657                                      subElement->type == me_split) {
1661 1658                                          p_error = parse_cannot_elide;
1662 1659                                          break;
1663 1660                                  }
1664 1661                                  if (subElement->type == me_item &&
1665 1662                                      !subElement->element.item.repeat) {
1666 1663                                          p_error = parse_cannot_elide;
1667 1664                                          break;
↓ open down ↓ 392 lines elided ↑ open up ↑
2060 2057                          }
2061 2058  
2062 2059                          begin_token = s;
2063 2060                          end_token = end_s;
2064 2061                          s = get_next_token(&begin_token, &end_token, &t);
2065 2062                          if (s == NULL || t != quoted_string_token) {
2066 2063                                  p_error = parse_format_string_expected_error;
2067 2064                                  break;
2068 2065                          }
2069 2066                          if (end_token == begin_token + 1 ||
2070      -                            *begin_token == ESCAPE_CHAR &&
2071      -                            end_token == begin_token + 2) {
     2067 +                            (*begin_token == ESCAPE_CHAR &&
     2068 +                            end_token == begin_token + 2)) {
2072 2069                                          /* me_split */
2073 2070                                  delim = (unsigned char)end_token[-1];
2074 2071                                  s = skip_token(s, end_s, close_paren_token);
2075 2072                                  if (s == NULL)
2076 2073                                          break;
2077 2074                                  subelement->element.split.item = item;
2078 2075                                  subelement->element.split.delim = delim;
2079 2076                                  subelement->type = me_split;
2080 2077                                  return (s);
2081 2078                          }
↓ open down ↓ 643 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX