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


   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*

  22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 
  27 #include <lber.h>
  28 #include <ldap.h>
  29 #include <strings.h>
  30 #include <errno.h>
  31 
  32 #include "nisdb_mt.h"
  33 
  34 #include "ldap_util.h"
  35 #include "ldap_op.h"
  36 #include "ldap_ruleval.h"
  37 #include "ldap_attr.h"
  38 #include "ldap_val.h"
  39 #include "ldap_ldap.h"
  40 
  41 extern int yp2ldap;


2073  * Note that this function doesn't perform the actual assignment. Rather,
2074  * it returns an array of __nis_value_t's, with element zero of the value
2075  * array being the new value of the first matched item, element one the
2076  * value of the second matched item, etc. In the example above, we'd
2077  * return a value array with two elements.
2078  *
2079  * If there is more than one input value (inVal->numVals > 1), the
2080  * output array elements will also be multi-valued.
2081  *
2082  * f            The match format
2083  * inVal        Input value(s)
2084  * numVal       Number of elements in the output value array
2085  * sepset       List of separators
2086  * outstr       Points to the updated position upto which the
2087  *              input string has been matched
2088  */
2089 __nis_value_t **
2090 matchMappingItem(__nis_mapping_format_t *f, __nis_value_t *inVal,
2091                 int *numVals, char *sepset, char **outstr) {
2092         __nis_value_t           **v = 0;
2093         int                     i, n, ni, numItems, nf, nv = 0;
2094         char                    *str, *valstr;
2095         __nis_mapping_format_t  *ftmp;
2096         char                    *myself = "matchMappingItem";
2097 
2098         if (f == 0 ||
2099                 inVal == 0 || inVal->numVals < 1 || inVal->type != vt_string)
2100                 return (0);
2101 
2102         /* Count the number of format elements and items in the format */
2103         for (nf = numItems = 0, ftmp = f; ftmp->type != mmt_end; ftmp++) {
2104                 nf++;
2105 
2106                 /*
2107                  * Count mmt_item and mmt_berstring (used by N2L to
2108                  * represent address %a)
2109                  */
2110                 if (ftmp->type == mmt_item)
2111                                 numItems++;
2112                 else if (ftmp->type == mmt_berstring && ftmp->match.berString &&
2113                                 ftmp->match.berString[0] == 'a')




   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2015 Gary Mills
  23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 
  28 #include <lber.h>
  29 #include <ldap.h>
  30 #include <strings.h>
  31 #include <errno.h>
  32 
  33 #include "nisdb_mt.h"
  34 
  35 #include "ldap_util.h"
  36 #include "ldap_op.h"
  37 #include "ldap_ruleval.h"
  38 #include "ldap_attr.h"
  39 #include "ldap_val.h"
  40 #include "ldap_ldap.h"
  41 
  42 extern int yp2ldap;


2074  * Note that this function doesn't perform the actual assignment. Rather,
2075  * it returns an array of __nis_value_t's, with element zero of the value
2076  * array being the new value of the first matched item, element one the
2077  * value of the second matched item, etc. In the example above, we'd
2078  * return a value array with two elements.
2079  *
2080  * If there is more than one input value (inVal->numVals > 1), the
2081  * output array elements will also be multi-valued.
2082  *
2083  * f            The match format
2084  * inVal        Input value(s)
2085  * numVal       Number of elements in the output value array
2086  * sepset       List of separators
2087  * outstr       Points to the updated position upto which the
2088  *              input string has been matched
2089  */
2090 __nis_value_t **
2091 matchMappingItem(__nis_mapping_format_t *f, __nis_value_t *inVal,
2092                 int *numVals, char *sepset, char **outstr) {
2093         __nis_value_t           **v = 0;
2094         int                     i, n, ni, numItems, nf;
2095         char                    *str, *valstr;
2096         __nis_mapping_format_t  *ftmp;
2097         char                    *myself = "matchMappingItem";
2098 
2099         if (f == 0 ||
2100                 inVal == 0 || inVal->numVals < 1 || inVal->type != vt_string)
2101                 return (0);
2102 
2103         /* Count the number of format elements and items in the format */
2104         for (nf = numItems = 0, ftmp = f; ftmp->type != mmt_end; ftmp++) {
2105                 nf++;
2106 
2107                 /*
2108                  * Count mmt_item and mmt_berstring (used by N2L to
2109                  * represent address %a)
2110                  */
2111                 if (ftmp->type == mmt_item)
2112                                 numItems++;
2113                 else if (ftmp->type == mmt_berstring && ftmp->match.berString &&
2114                                 ftmp->match.berString[0] == 'a')