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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libnisdb/ldap_ruleval.c
          +++ new/usr/src/lib/libnisdb/ldap_ruleval.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  
  27   28  #include <lber.h>
  28   29  #include <ldap.h>
  29   30  #include <strings.h>
  30   31  
  31   32  #include "nisdb_mt.h"
↓ open down ↓ 70 lines elided ↑ open up ↑
 102  103  /*
 103  104   * Grow 'old' from 'oldCount' to 'newCount' elements, initialize the
 104  105   * new portion to 'rvIn' (empty if not supplied), and return a pointer
 105  106   * to the result. Following a call to this function, the caller must
 106  107   * refer only to the returned array, not to 'old'.
 107  108   */
 108  109  __nis_rule_value_t *
 109  110  growRuleValue(int oldCount, int newCount, __nis_rule_value_t *old,
 110  111                  __nis_rule_value_t *rvIn) {
 111  112          __nis_rule_value_t      *rv;
 112      -        int                     i, j;
      113 +        int                     i;
 113  114          char                    *myself = "growRuleValue";
 114  115  
 115  116          if (newCount <= 0 || newCount <= oldCount)
 116  117                  return (old);
 117  118  
 118  119          if (oldCount <= 0) {
 119  120                  oldCount = 0;
 120  121                  old = 0;
 121  122          }
 122  123  
↓ open down ↓ 295 lines elided ↑ open up ↑
 418  419  
 419  420  /*
 420  421   * Given a table mapping, a NIS+ DB query, and (optionally) an existing
 421  422   * and compatible __nis_rule_value_t, return a new __nis_rule_value_t
 422  423   * with the values from the query added.
 423  424   */
 424  425  __nis_rule_value_t *
 425  426  buildNisPlusRuleValue(__nis_table_mapping_t *t, db_query *q,
 426  427                          __nis_rule_value_t *rv) {
 427  428          int                     i;
 428      -        __nis_single_value_t    *sv;
 429      -        char                    *myself = "buildNisPlusRuleValue";
 430  429  
 431  430          if (t == 0 || q == 0)
 432  431                  return (0);
 433  432  
 434  433          rv = initRuleValue(1, rv);
 435  434          if (rv == 0)
 436  435                  return (0);
 437  436  
 438  437          for (i = 0; i < q->components.components_len; i++) {
 439      -                int     ic;
 440      -                int     iv, v, dup;
 441      -                int     len;
 442  438  
 443  439                  /* Ignore out-of-range column index */
 444  440                  if (q->components.components_val[i].which_index >=
 445  441                                  t->numColumns)
 446  442                          continue;
 447  443  
 448  444                  /*
 449  445                   * Add the query value. A NULL value indicates deletion,
 450  446                   * but addCol2RuleValue() takes care of that for us.
 451  447                   */
↓ open down ↓ 158 lines elided ↑ open up ↑
 610  606   * otherwise not.
 611  607   */
 612  608  __nis_rule_value_t *
 613  609  addLdapRuleValue(__nis_table_mapping_t *t,
 614  610                          __nis_mapping_rule_t *r,
 615  611                          __nis_mapping_item_type_t lnative,
 616  612                          __nis_mapping_item_type_t rnative,
 617  613                          __nis_rule_value_t *rv,
 618  614                          int doAssign, int *stat) {
 619  615          int                     i, j;
 620      -        char                    **new;
 621  616          __nis_value_t           *rval, *lval;
 622      -        __nis_buffer_t          b = {0, 0};
 623  617          __nis_mapping_item_t    *litem;
 624  618          int                     numItems;
 625  619          char                    **dn = 0;
 626  620          int                     numDN = 0;
 627  621          char                    *myself = "addLdapRuleValue";
 628  622  
 629  623  
 630  624          /* Do we have the required values ? */
 631  625          if (rv == 0)
 632  626                  return (0);
↓ open down ↓ 105 lines elided ↑ open up ↑
 738  732          for (i = 0, j = 0; i < lval->numVals; i++) {
 739  733                  /* Special case: rval->numVals < 0 means deletion */
 740  734                  if (rval->numVals < 0) {
 741  735                          (void) addAttr2RuleValue(rval->type,
 742  736                                  lval->val[i].value, 0, 0, rv);
 743  737                          continue;
 744  738                  }
 745  739                  /* If we're out of values, repeat the last one */
 746  740                  if (j >= rval->numVals)
 747  741                          j = (rval->numVals > 0) ? rval->numVals-1 : 0;
 748      -                for (0; j < rval->numVals; j++) {
      742 +                for (; j < rval->numVals; j++) {
 749  743                          /*
 750  744                           * If this is the 'dn', and the value ends in a
 751  745                           * comma, append the appropriate search base.
 752  746                           */
 753  747                          if (strcasecmp("dn", lval->val[i].value) == 0 &&
 754  748                                          lastChar(&rval->val[j]) == ',' &&
 755  749                                          t->objectDN->write.scope !=
 756  750                                                  LDAP_SCOPE_UNKNOWN) {
 757  751                                  void    *nval;
 758  752                                  int     nlen = -1;
↓ open down ↓ 324 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX