Print this page
12236 getmembers_DN doesn't properly handle errors from __ns_ldap_dn2uid
12240 nss_ldap does not properly look up group members by distinguished name

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libsldap/common/ns_mapping.c
          +++ new/usr/src/lib/libsldap/common/ns_mapping.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  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   22   * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
       23 + * Copyright 2020 Joyent, Inc.
  23   24   */
  24   25  
  25   26  #include <stdlib.h>
  26   27  #include <strings.h>
  27   28  #include <ctype.h>
  28   29  #include <locale.h>
  29   30  #include <syslog.h>
  30   31  #include "ns_internal.h"
  31   32  
  32   33  /*
↓ open down ↓ 161 lines elided ↑ open up ↑
 194  195          config->llHead = newp;
 195  196          return (NS_HASH_RC_SUCCESS);
 196  197  }
 197  198  
 198  199  
 199  200  /*
 200  201   * Parse an attribute map string.
 201  202   * Assume space is the only legal whitespace.
 202  203   * attributeMap syntax:
 203  204   * attributeMap      = serviceId ":" origAttribute "="
 204      - *                      attributes
      205 + *                      attributes
 205  206   * origAttribute     = attribute
 206  207   * attributes        = wattribute *( space wattribute )
 207  208   * wattribute        = whsp newAttribute whsp
 208  209   * newAttribute      = descr | "*NULL*"
 209  210   * attribute         = descr
 210  211   *
 211  212   * objectclassMap syntax:
 212  213   * objectclassMap    = serviceId ":" origObjectclass "="
 213      - *                      objectclass
      214 + *                      objectclass
 214  215   * origObjectclass   = objectclass
 215  216   * objectclass       = keystring
 216  217   */
 217  218  
 218  219  int
 219  220  __s_api_parse_map(char *cp, char **sid, char **origA, char ***mapA)
 220  221  {
 221  222          char    *sptr, *dptr, **mapp;
 222  223          int     i, max;
 223  224  
↓ open down ↓ 64 lines elided ↑ open up ↑
 288  289                          return (NS_HASH_RC_NO_MEMORY);
 289  290                  }
 290  291                  (void) strlcpy(*mapp, sptr, i);
 291  292                  mapp++;
 292  293                  sptr = dptr;
 293  294          }
 294  295          return (NS_HASH_RC_SUCCESS);
 295  296  }
 296  297  
 297  298  
 298      -static void
      299 +void
 299  300  __ns_ldap_freeASearchDesc(ns_ldap_search_desc_t *ptr)
 300  301  {
 301  302          if (ptr == NULL)
 302  303                  return;
 303  304          if (ptr->basedn)
 304  305                  free(ptr->basedn);
 305  306          if (ptr->filter)
 306  307                  free(ptr->filter);
 307  308          free(ptr);
 308  309  }
↓ open down ↓ 346 lines elided ↑ open up ↑
 655  656          int                     rc;
 656  657          int                     slen;
 657  658          void                    **param = NULL;
 658  659          void                    **paramVal = NULL;
 659  660          char                    **sdl, *srv, **sdl_save;
 660  661          char                    errstr[2 * MAXERROR];
 661  662          ns_ldap_search_desc_t   **sdlist;
 662  663          int                     cnt, max;
 663  664          int                     vers;
 664  665          ns_config_t             *cfg;
 665      -        ns_ldap_search_desc_t   *ret;
      666 +        ns_ldap_search_desc_t   *ret;
 666  667  
 667  668          if ((desc == NULL) || (errorp == NULL))
 668  669                  return (NS_LDAP_INVALID_PARAM);
 669  670  
 670  671          *desc = NULL;
 671  672          *errorp = NULL;
 672  673  
 673  674          rc = __ns_ldap_getParam(NS_LDAP_SERVICE_SEARCH_DESC_P,
 674  675              (void ***)&param, errorp);
 675  676          if (rc != NS_LDAP_SUCCESS) {
↓ open down ↓ 370 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX