Print this page
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>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/lib/nsswitch/ldap/common/ldap_common.h
+++ new/usr/src/lib/nsswitch/ldap/common/ldap_common.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
|
↓ 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) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
23 + * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
23 24 */
24 25
25 26 #ifndef _LDAP_COMMON_H
26 27 #define _LDAP_COMMON_H
27 28
28 29 #ifdef __cplusplus
29 30 extern "C" {
30 31 #endif
31 32
32 33 #include <ctype.h>
33 34 #include <nss_dbdefs.h>
34 35 #include <stdlib.h>
35 36 #include <string.h>
36 37 #include <strings.h>
37 38 #include <signal.h>
38 39 #include <lber.h>
39 40 #include <ldap.h>
40 41 #include <pwd.h>
41 42 #include "ns_sldap.h"
42 43
43 44 #define _ALIASES "aliases"
44 45 #define _AUTOMOUNT "automount"
45 46 #define _AUTHATTR "auth_attr"
46 47 #define _AUUSER "audit_user"
47 48 #define _BOOTPARAMS "bootparams"
48 49 #define _DEFAULT "default"
49 50 #define _ETHERS "ethers"
50 51 #define _EXECATTR "exec_attr"
51 52 #define _GROUP "group"
52 53 #define _PROJECT "project"
53 54 #define _HOSTS "hosts"
54 55 #define _HOSTS6 "hosts"
55 56 #define _NETGROUP "netgroup"
56 57 #define _NETMASKS "netmasks"
57 58 #define _NETWORKS "networks"
58 59 #define _PASSWD "passwd"
59 60 #define _PRINTERS "printers"
60 61 #define _PROFATTR "prof_attr"
61 62 #define _PROTOCOLS "protocols"
62 63 #define _PUBLICKEY "publickey"
63 64 #define _RPC "rpc"
64 65 #define _SERVICES "services"
65 66 #define _SHADOW "shadow"
66 67 #define _USERATTR "user_attr"
67 68 #define _TNRHDB "tnrhdb"
68 69 #define _TNRHTP "tnrhtp"
69 70
70 71 #define NSS_STR_PARSE_NO_ADDR (NSS_STR_PARSE_ERANGE + 100)
71 72 #define NSS_STR_PARSE_NO_RESULT (NSS_STR_PARSE_ERANGE + 101)
72 73
73 74 #define DOTTEDSUBDOMAIN(string) \
74 75 ((string != NULL) && (strchr(string, '.') != NULL))
75 76 #define SEARCHFILTERLEN 256
76 77
77 78 #define _NO_VALUE ""
78 79
79 80 #define TEST_AND_ADJUST(len, buffer, buflen, label) \
80 81 /* Use '>=' to ensure there is at least one byte left for '\0' */ \
81 82 if (len >= buflen || len < 0) { \
82 83 nss_result = NSS_STR_PARSE_ERANGE; \
83 84 goto label; \
84 85 } \
85 86 /* Adjust pointer and available buffer length */ \
86 87 buffer += len; \
87 88 buflen -= len;
88 89
89 90 /*
90 91 * We need to use UID_NOBODY and GID_NOBODY as strings. Therefore we use
91 92 * snprintf to convert [U|G]ID_NOBODY into a string. The target buffer
92 93 * size was chosen as 21 to allow the largest 64-bit number to be stored
93 94 * as string in it. Right now uid_t and gid_t are 32-bit so we don't
94 95 * really need 21 characters but it does allow for future expansion
95 96 * without having to modify this code.
96 97 */
97 98 #define NOBODY_STR_LEN 21
98 99
99 100
100 101 /*
101 102 * Superset the nss_backend_t abstract data type. This ADT has
102 103 * been extended to include ldap associated data structures.
103 104 */
104 105
105 106 typedef struct ldap_backend *ldap_backend_ptr;
106 107 typedef nss_status_t (*ldap_backend_op_t)(ldap_backend_ptr, void *);
107 108 typedef int (*fnf)(ldap_backend_ptr be, nss_XbyY_args_t *argp);
108 109
109 110 typedef enum {
110 111 NSS_LDAP_DB_NONE = 0,
111 112 NSS_LDAP_DB_PUBLICKEY = 1,
112 113 NSS_LDAP_DB_ETHERS = 2
113 114 } nss_ldap_db_type_t;
114 115
115 116 struct ldap_backend {
116 117 ldap_backend_op_t *ops;
117 118 nss_dbop_t nops;
118 119 char *tablename;
119 120 void *enumcookie;
120 121 char *filter;
121 122 char *sortattr;
122 123 int setcalled;
123 124 const char **attrs;
124 125 ns_ldap_result_t *result;
125 126 fnf ldapobj2str;
126 127 void *netgroup_cookie;
127 128 void *services_cookie;
128 129 char *toglue;
129 130 char *buffer;
130 131 int buflen;
131 132 nss_ldap_db_type_t db_type;
|
↓ open down ↓ |
99 lines elided |
↑ open up ↑ |
132 133 };
133 134
134 135 extern nss_status_t _nss_ldap_destr(ldap_backend_ptr be, void *a);
135 136 extern nss_status_t _nss_ldap_endent(ldap_backend_ptr be, void *a);
136 137 extern nss_status_t _nss_ldap_setent(ldap_backend_ptr be, void *a);
137 138 extern nss_status_t _nss_ldap_getent(ldap_backend_ptr be, void *a);
138 139 nss_backend_t *_nss_ldap_constr(ldap_backend_op_t ops[], int nops,
139 140 char *tablename, const char **attrs, fnf ldapobj2str);
140 141 extern nss_status_t _nss_ldap_nocb_lookup(ldap_backend_ptr be,
141 142 nss_XbyY_args_t *argp, char *database,
142 - char *searchfilter, char *domain,
143 + char *searchfilter, const char * const *attrs,
143 144 int (*init_filter_cb)(
144 145 const ns_ldap_search_desc_t *desc,
145 146 char **realfilter, const void *userdata),
146 147 const void *userdata);
147 148 extern nss_status_t _nss_ldap_lookup(ldap_backend_ptr be,
148 149 nss_XbyY_args_t *argp, char *database,
149 150 char *searchfilter, char *domain,
150 151 int (*init_filter_cb)(
151 152 const ns_ldap_search_desc_t *desc,
152 153 char **realfilter, const void *userdata),
153 154 const void *userdata);
154 155 extern void _clean_ldap_backend(ldap_backend_ptr be);
155 156
156 157 extern ns_ldap_attr_t *getattr(ns_ldap_result_t *result, int i);
157 158 extern const char *_strip_quotes(char *ipaddress);
158 159 extern int __nss2herrno(nss_status_t nsstat);
159 160 extern int propersubdomain(char *domain, char *subdomain);
160 161 extern int chophostdomain(char *string, char *host, char *domain);
161 162 extern char *_get_domain_name(char *cdn);
162 163 extern int _merge_SSD_filter(const ns_ldap_search_desc_t *desc,
163 164 char **realfilter, const void *userdata);
164 165 extern int _ldap_filter_name(char *filter_name, const char *name,
165 166 int filter_name_size);
166 167
167 168 extern void _nss_services_cookie_free(void **cookieP);
168 169 extern nss_status_t switch_err(int rc, ns_ldap_error_t *error);
169 170
170 171 #ifdef DEBUG
171 172 extern int printresult(ns_ldap_result_t *result);
172 173 #endif /* DEBUG */
173 174
174 175 #ifdef __cplusplus
175 176 }
176 177 #endif
177 178
178 179 #endif /* _LDAP_COMMON_H */
|
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX