Print this page
NEX-18462 SMB can't view ACL if posix ID can't be mapped
Review by: Gordon Ross <gordon.ross@nexenta.com>
Review by: Evan Layton <evan.layton@nexenta.com>
NEX-14547 Get UNIX group info. from AD/LDAP with partial RFC2307 schema
NEX-13132 smbd dumping core in nss_ldap.so.1`getbymember
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>

@@ -18,10 +18,11 @@
  *
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #include "ldap_common.h"
 #include <malloc.h>
 #include <synch.h>

@@ -102,10 +103,11 @@
         switch (rc) {
         case NS_LDAP_SUCCESS:
                 return (NSS_SUCCESS);
 
         case NS_LDAP_NOTFOUND:
+                errno = 0;
                 return (NSS_NOTFOUND);
 
         case NS_LDAP_PARTIAL:
                 return (NSS_TRYAGAIN);
 

@@ -244,18 +246,21 @@
  */
 
 /* ARGSUSED */
 nss_status_t
 _nss_ldap_nocb_lookup(ldap_backend_ptr be, nss_XbyY_args_t *argp,
-                char *database, char *searchfilter, char *domain,
+    char *database, char *searchfilter, const char * const *attrs,
                 int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
                 char **realfilter, const void *userdata),
                 const void *userdata)
 {
         ns_ldap_error_t *error = NULL;
         int             rc;
 
+        if (attrs == NULL)
+                attrs = be->attrs;
+
 #ifdef  DEBUG
         (void) fprintf(stdout, "\n[ldap_common.c: _nss_ldap_nocb_lookup]\n");
         (void) fprintf(stdout, "\tsearchfilter: %s\n", searchfilter);
         (void) fprintf(stdout, "\tdatabase: %s\n", database);
         (void) fprintf(stdout,

@@ -263,11 +268,11 @@
 #endif  /* DEBUG */
 
         (void) __ns_ldap_freeResult(&be->result);
 
         if ((rc = __ns_ldap_list(database, searchfilter, init_filter_cb,
-            be->attrs, NULL, 0, &be->result, &error, NULL,
+            attrs, NULL, 0, &be->result, &error, NULL,
             userdata)) != NS_LDAP_SUCCESS) {
                 if (argp != NULL)
                         argp->returnval = 0;
                 rc = switch_err(rc, error);
                 (void) __ns_ldap_freeError(&error);