1 /* Copyright (C) 1997-2005 Luke Howard.
2    This file is part of the nss_ldap library.
3    Contributed by Luke Howard, <lukeh@padl.com>, 2000.
4 
5    The nss_ldap library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Library General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9 
10    The nss_ldap library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Library General Public License for more details.
14 
15    You should have received a copy of the GNU Library General Public
16    License along with the nss_ldap library; see the file COPYING.LIB.  If not,
17    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18    Boston, MA 02111-1307, USA.
19 
20    $Id: ldap-schema.c,v 2.35 2009/02/03 22:59:34 lukeh Exp $
21  */
22 
23 static char rcsId[] =
24   "$Id: ldap-schema.c,v 2.35 2009/02/03 22:59:34 lukeh Exp $";
25 
26 #include "config.h"
27 
28 #ifdef HAVE_PORT_BEFORE_H
29 #include <port_before.h>
30 #endif
31 
32 #if defined(HAVE_THREAD_H) && !defined(_AIX)
33 #include <thread.h>
34 #elif defined(HAVE_PTHREAD_H)
35 #include <pthread.h>
36 #endif
37 
38 #include <stdlib.h>
39 #include <unistd.h>
40 #include <netdb.h>
41 #include <stdio.h>
42 #include <string.h>
43 #include <syslog.h>
44 
45 #ifdef HAVE_LBER_H
46 #include <lber.h>
47 #endif
48 #ifdef HAVE_LDAP_H
49 #include <ldap.h>
50 #endif
51 
52 #ifndef HAVE_SNPRINTF
53 #include "snprintf.h"
54 #endif /* HAVE_SNPRINTF */
55 #include "ldap-nss.h"
56 #include "ldap-schema.h"
57 #include "util.h"
58 
59 #ifdef HAVE_PORT_AFTER_H
60 #include <port_after.h>
61 #endif
62 
63 
64 /**
65  * declare filters formerly declared in ldap-*.h
66  */
67 
68 /* rfc822 mail aliases */
69 char _nss_ldap_filt_getaliasbyname[LDAP_FILT_MAXSIZ];
70 char _nss_ldap_filt_getaliasent[LDAP_FILT_MAXSIZ];
71 
72 /* boot parameters */
73 char _nss_ldap_filt_getbootparamsbyname[LDAP_FILT_MAXSIZ];
74 
75 /* MAC address mappings */
76 char _nss_ldap_filt_gethostton[LDAP_FILT_MAXSIZ];
77 char _nss_ldap_filt_getntohost[LDAP_FILT_MAXSIZ];
78 char _nss_ldap_filt_getetherent[LDAP_FILT_MAXSIZ];
79 
80 /* groups */
81 char _nss_ldap_filt_getgrnam[LDAP_FILT_MAXSIZ];
82 char _nss_ldap_filt_getgrgid[LDAP_FILT_MAXSIZ];
83 char _nss_ldap_filt_getgrent[LDAP_FILT_MAXSIZ];
84 char _nss_ldap_filt_getgroupsbymemberanddn[LDAP_FILT_MAXSIZ];
85 char _nss_ldap_filt_getgroupsbydn[LDAP_FILT_MAXSIZ];
86 char _nss_ldap_filt_getpwnam_groupsbymember[LDAP_FILT_MAXSIZ];
87 char _nss_ldap_filt_getgroupsbymember[LDAP_FILT_MAXSIZ];
88 
89 /* IP hosts */
90 char _nss_ldap_filt_gethostbyname[LDAP_FILT_MAXSIZ];
91 char _nss_ldap_filt_gethostbyaddr[LDAP_FILT_MAXSIZ];
92 char _nss_ldap_filt_gethostent[LDAP_FILT_MAXSIZ];
93 
94 /* IP networks */
95 char _nss_ldap_filt_getnetbyname[LDAP_FILT_MAXSIZ];
96 char _nss_ldap_filt_getnetbyaddr[LDAP_FILT_MAXSIZ];
97 char _nss_ldap_filt_getnetent[LDAP_FILT_MAXSIZ];
98 
99 /* IP protocols */
100 char _nss_ldap_filt_getprotobyname[LDAP_FILT_MAXSIZ];
101 char _nss_ldap_filt_getprotobynumber[LDAP_FILT_MAXSIZ];
102 char _nss_ldap_filt_getprotoent[LDAP_FILT_MAXSIZ];
103 
104 /* users */
105 char _nss_ldap_filt_getpwnam[LDAP_FILT_MAXSIZ];
106 char _nss_ldap_filt_getpwuid[LDAP_FILT_MAXSIZ];
107 char _nss_ldap_filt_getpwent[LDAP_FILT_MAXSIZ];
108 
109 /* RPCs */
110 char _nss_ldap_filt_getrpcbyname[LDAP_FILT_MAXSIZ];
111 char _nss_ldap_filt_getrpcbynumber[LDAP_FILT_MAXSIZ];
112 char _nss_ldap_filt_getrpcent[LDAP_FILT_MAXSIZ];
113 
114 /* IP services */
115 char _nss_ldap_filt_getservbyname[LDAP_FILT_MAXSIZ];
116 char _nss_ldap_filt_getservbynameproto[LDAP_FILT_MAXSIZ];
117 char _nss_ldap_filt_getservbyport[LDAP_FILT_MAXSIZ];
118 char _nss_ldap_filt_getservbyportproto[LDAP_FILT_MAXSIZ];
119 char _nss_ldap_filt_getservent[LDAP_FILT_MAXSIZ];
120 
121 /* shadow users */
122 char _nss_ldap_filt_getspnam[LDAP_FILT_MAXSIZ];
123 char _nss_ldap_filt_getspent[LDAP_FILT_MAXSIZ];
124 
125 /* netgroups */
126 char _nss_ldap_filt_getnetgrent[LDAP_FILT_MAXSIZ];
127 char _nss_ldap_filt_innetgr[LDAP_FILT_MAXSIZ];
128 
129 /* automount */
130 char _nss_ldap_filt_setautomntent[LDAP_FILT_MAXSIZ];
131 char _nss_ldap_filt_getautomntent[LDAP_FILT_MAXSIZ];
132 char _nss_ldap_filt_getautomntbyname[LDAP_FILT_MAXSIZ];
133 
134 /**
135  * lookup filter initialization
136  */
137 void
_nss_ldap_init_filters()138 _nss_ldap_init_filters ()
139 {
140   /* rfc822 mail aliases */
141   snprintf (_nss_ldap_filt_getaliasbyname, LDAP_FILT_MAXSIZ,
142 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (nisMailAlias),
143             ATM (LM_ALIASES, cn), "%s");
144   snprintf (_nss_ldap_filt_getaliasent, LDAP_FILT_MAXSIZ,
145 	    "(%s=%s)", AT (objectClass), OC (nisMailAlias));
146 
147   /* boot parameters */
148   snprintf (_nss_ldap_filt_getbootparamsbyname, LDAP_FILT_MAXSIZ,
149 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (bootableDevice),
150             ATM (LM_BOOTPARAMS, cn), "%d");
151 
152   /* MAC address mappings */
153   snprintf (_nss_ldap_filt_gethostton, LDAP_FILT_MAXSIZ,
154 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (ieee802Device),
155             ATM (LM_ETHERS, cn), "%s");
156   snprintf (_nss_ldap_filt_getntohost, LDAP_FILT_MAXSIZ,
157 	    "(&(%s=%s)(|(%s=%s)(%s=%s)))", AT (objectClass), OC (ieee802Device),
158 	    AT (macAddress), "%s", AT (macAddress), "%s");
159   snprintf (_nss_ldap_filt_getetherent, LDAP_FILT_MAXSIZ, "(%s=%s)",
160 	    AT (objectClass), OC (ieee802Device));
161 
162   /* groups */
163   snprintf (_nss_ldap_filt_getgrnam, LDAP_FILT_MAXSIZ,
164 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (posixGroup),
165             ATM (LM_GROUP, cn), "%s");
166   snprintf (_nss_ldap_filt_getgrgid, LDAP_FILT_MAXSIZ,
167 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (posixGroup),
168             ATM (LM_GROUP, gidNumber), "%d");
169   snprintf (_nss_ldap_filt_getgrent, LDAP_FILT_MAXSIZ, "(&(%s=%s))",
170 	    AT (objectClass), OC (posixGroup));
171   snprintf (_nss_ldap_filt_getgroupsbymemberanddn, LDAP_FILT_MAXSIZ,
172 	    "(&(%s=%s)(|(%s=%s)(%s=%s)))",
173 	    AT (objectClass), OC (posixGroup), AT (memberUid), "%s", AT (uniqueMember), "%s");
174   snprintf (_nss_ldap_filt_getgroupsbydn, LDAP_FILT_MAXSIZ,
175 	    "(&(%s=%s)(%s=%s))",
176 	    AT (objectClass), OC (posixGroup), AT (uniqueMember), "%s");
177   snprintf (_nss_ldap_filt_getpwnam_groupsbymember, LDAP_FILT_MAXSIZ,
178 	    "(|(&(%s=%s)(%s=%s))(&(%s=%s)(%s=%s)))",
179 	    AT (objectClass), OC (posixGroup), AT (memberUid), "%s",
180 	    AT (objectClass), OC (posixAccount), ATM (LM_PASSWD, uid), "%s");
181   snprintf (_nss_ldap_filt_getgroupsbymember, LDAP_FILT_MAXSIZ,
182 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (posixGroup), AT (memberUid),
183 	    "%s");
184 
185   /* IP hosts */
186   snprintf (_nss_ldap_filt_gethostbyname, LDAP_FILT_MAXSIZ,
187 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (ipHost), ATM (LM_HOSTS, cn),
188             "%s");
189   snprintf (_nss_ldap_filt_gethostbyaddr, LDAP_FILT_MAXSIZ,
190 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (ipHost), AT (ipHostNumber),
191 	    "%s");
192   snprintf (_nss_ldap_filt_gethostent, LDAP_FILT_MAXSIZ, "(%s=%s)",
193 	    AT (objectClass), OC (ipHost));
194 
195   /* IP networks */
196   snprintf (_nss_ldap_filt_getnetbyname, LDAP_FILT_MAXSIZ,
197 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (ipNetwork),
198             ATM (LM_NETWORKS, cn), "%s");
199   snprintf (_nss_ldap_filt_getnetbyaddr, LDAP_FILT_MAXSIZ,
200 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (ipNetwork),
201 	    AT (ipNetworkNumber), "%s");
202   snprintf (_nss_ldap_filt_getnetent, LDAP_FILT_MAXSIZ, "(%s=%s)",
203 	    AT (objectClass), OC (ipNetwork));
204 
205   /* IP protocols */
206   snprintf (_nss_ldap_filt_getprotobyname, LDAP_FILT_MAXSIZ,
207 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (ipProtocol),
208             ATM (LM_PROTOCOLS, cn), "%s");
209   snprintf (_nss_ldap_filt_getprotobynumber, LDAP_FILT_MAXSIZ,
210 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (ipProtocol),
211 	    AT (ipProtocolNumber), "%d");
212   snprintf (_nss_ldap_filt_getprotoent, LDAP_FILT_MAXSIZ, "(%s=%s)",
213 	    AT (objectClass), OC (ipProtocol));
214 
215   /* users */
216   snprintf (_nss_ldap_filt_getpwnam, LDAP_FILT_MAXSIZ,
217 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (posixAccount),
218             ATM (LM_PASSWD, uid), "%s");
219   snprintf (_nss_ldap_filt_getpwuid, LDAP_FILT_MAXSIZ,
220 	    "(&(%s=%s)(%s=%s))",
221 	    AT (objectClass), OC (posixAccount), AT (uidNumber), "%d");
222   snprintf (_nss_ldap_filt_getpwent, LDAP_FILT_MAXSIZ,
223 	    "(%s=%s)", AT (objectClass), OC (posixAccount));
224 
225   /* RPCs */
226   snprintf (_nss_ldap_filt_getrpcbyname, LDAP_FILT_MAXSIZ,
227 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (oncRpc), ATM (LM_RPC, cn), "%s");
228   snprintf (_nss_ldap_filt_getrpcbynumber, LDAP_FILT_MAXSIZ,
229 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (oncRpc), AT (oncRpcNumber),
230 	    "%d");
231   snprintf (_nss_ldap_filt_getrpcent, LDAP_FILT_MAXSIZ, "(%s=%s)",
232 	    AT (objectClass), OC (oncRpc));
233 
234   /* IP services */
235   snprintf (_nss_ldap_filt_getservbyname, LDAP_FILT_MAXSIZ,
236 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (ipService), ATM (LM_SERVICES, cn),
237             "%s");
238   snprintf (_nss_ldap_filt_getservbynameproto, LDAP_FILT_MAXSIZ,
239 	    "(&(%s=%s)(%s=%s)(%s=%s))",
240 	    AT (objectClass), OC (ipService), ATM (LM_SERVICES, cn), "%s", AT (ipServiceProtocol),
241             "%s");
242   snprintf (_nss_ldap_filt_getservbyport, LDAP_FILT_MAXSIZ,
243 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (ipService), AT (ipServicePort),
244 	    "%d");
245   snprintf (_nss_ldap_filt_getservbyportproto, LDAP_FILT_MAXSIZ,
246 	    "(&(%s=%s)(%s=%s)(%s=%s))", AT (objectClass), OC (ipService),
247 	    AT (ipServicePort), "%d", AT (ipServiceProtocol), "%s");
248   snprintf (_nss_ldap_filt_getservent, LDAP_FILT_MAXSIZ, "(%s=%s)",
249 	    AT (objectClass), OC (ipService));
250 
251   /* shadow users */
252   snprintf (_nss_ldap_filt_getspnam, LDAP_FILT_MAXSIZ,
253 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (shadowAccount),
254             ATM (LM_SHADOW, uid), "%s");
255   snprintf (_nss_ldap_filt_getspent, LDAP_FILT_MAXSIZ,
256 	    "(%s=%s)", AT (objectClass), OC (shadowAccount));
257 
258   /* netgroups */
259   snprintf (_nss_ldap_filt_getnetgrent, LDAP_FILT_MAXSIZ,
260 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (nisNetgroup),
261             ATM (LM_NETGROUP, cn), "%s");
262   snprintf (_nss_ldap_filt_innetgr, LDAP_FILT_MAXSIZ,
263 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (nisNetgroup), AT (memberNisNetgroup), "%s");
264 
265   /* automounts */
266   snprintf (_nss_ldap_filt_setautomntent, LDAP_FILT_MAXSIZ,
267 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (automountMap), AT (automountMapName), "%s");
268   snprintf (_nss_ldap_filt_getautomntent, LDAP_FILT_MAXSIZ,
269 	    "(%s=%s)", AT (objectClass), OC (automount));
270   snprintf (_nss_ldap_filt_getautomntbyname, LDAP_FILT_MAXSIZ,
271 	    "(&(%s=%s)(%s=%s))", AT (objectClass), OC (automount), AT (automountKey), "%s");
272 }
273 
274 static void init_pwd_attributes (const char ***pwd_attrs);
275 static void init_sp_attributes (const char ***sp_attrs);
276 static void init_grp_attributes (const char ***grp_attrs, int skipmembers);
277 static void init_hosts_attributes (const char ***hosts_attrs);
278 static void init_services_attributes (const char ***services_attrs);
279 static void init_network_attributes (const char ***network_attrs);
280 static void init_proto_attributes (const char ***proto_attrs);
281 static void init_rpc_attributes (const char ***rpc_attrs);
282 static void init_ethers_attributes (const char ***ethers_attrs);
283 static void init_bp_attributes (const char ***bp_attrs);
284 static void init_alias_attributes (const char ***alias_attrs);
285 static void init_netgrp_attributes (const char ***netgrp_attrs);
286 static void init_automount_attributes (const char ***automount_attrs);
287 
288 /**
289  * attribute table initialization routines
290  */
291 void
_nss_ldap_init_attributes(const char *** attrtab,int skipmembers)292 _nss_ldap_init_attributes (const char ***attrtab, int skipmembers)
293 {
294   init_pwd_attributes (&attrtab[LM_PASSWD]);
295   init_sp_attributes (&attrtab[LM_SHADOW]);
296   init_grp_attributes (&attrtab[LM_GROUP], skipmembers);
297   init_hosts_attributes (&attrtab[LM_HOSTS]);
298   init_services_attributes (&attrtab[LM_SERVICES]);
299   init_network_attributes (&attrtab[LM_NETWORKS]);
300   init_proto_attributes (&attrtab[LM_PROTOCOLS]);
301   init_rpc_attributes (&attrtab[LM_RPC]);
302   init_ethers_attributes (&attrtab[LM_ETHERS]);
303   init_network_attributes (&attrtab[LM_NETMASKS]);
304   init_bp_attributes (&attrtab[LM_BOOTPARAMS]);
305   init_alias_attributes (&attrtab[LM_ALIASES]);
306   init_netgrp_attributes (&attrtab[LM_NETGROUP]);
307   init_automount_attributes (&attrtab[LM_AUTOMOUNT]);
308 
309   attrtab[LM_NONE] = NULL;
310 }
311 
312 static void
init_pwd_attributes(const char *** pwd_attrs)313 init_pwd_attributes (const char ***pwd_attrs)
314 {
315   int i = 0;
316   static const char *__pwd_attrs[ATTRTAB_SIZE + 1];
317 
318   (*pwd_attrs) = __pwd_attrs;
319 
320   (*pwd_attrs)[i++] = ATM (LM_PASSWD, uid);
321   (*pwd_attrs)[i++] = ATM (LM_PASSWD, userPassword);
322   (*pwd_attrs)[i++] = AT (uidNumber);
323   (*pwd_attrs)[i++] = ATM (LM_PASSWD, gidNumber);
324   (*pwd_attrs)[i++] = ATM (LM_PASSWD, cn);
325   (*pwd_attrs)[i++] = AT (homeDirectory);
326   (*pwd_attrs)[i++] = AT (loginShell);
327   (*pwd_attrs)[i++] = AT (gecos);
328   (*pwd_attrs)[i++] = ATM (LM_PASSWD, description);
329   (*pwd_attrs)[i++] = AT (objectClass);
330 #ifdef HAVE_PASSWD_PW_CHANGE
331   (*pwd_attrs)[i++] = AT (shadowLastChange);
332   (*pwd_attrs)[i++] = AT (shadowMax);
333 #endif /* HAVE_PASSWD_PW_CHANGE */
334 #ifdef HAVE_PASSWD_PW_EXPIRE
335   (*pwd_attrs)[i++] = AT (shadowExpire);
336 #endif /* HAVE_PASSWD_PW_EXPIRE */
337 #ifdef HAVE_LOGIN_CLASSES
338   (*pwd_attrs)[i++] = AT (loginClass);
339 #endif
340   (*pwd_attrs)[i] = NULL;
341 }
342 
343 static void
init_sp_attributes(const char *** sp_attrs)344 init_sp_attributes (const char ***sp_attrs)
345 {
346   static const char *__sp_attrs[ATTRTAB_SIZE + 1];
347 
348   (*sp_attrs) = __sp_attrs;
349 
350   (*sp_attrs)[0] = (char *) ATM (LM_SHADOW, uid);
351   (*sp_attrs)[1] = (char *) ATM (LM_SHADOW, userPassword);
352   (*sp_attrs)[2] = (char *) AT (shadowLastChange);
353   (*sp_attrs)[3] = (char *) AT (shadowMax);
354   (*sp_attrs)[4] = (char *) AT (shadowMin);
355   (*sp_attrs)[5] = (char *) AT (shadowWarning);
356   (*sp_attrs)[6] = (char *) AT (shadowInactive);
357   (*sp_attrs)[7] = (char *) AT (shadowExpire);
358   (*sp_attrs)[8] = (char *) AT (shadowFlag);
359   (*sp_attrs)[9] = NULL;
360 }
361 
362 static void
init_grp_attributes(const char *** grp_attrs,int skipmembers)363 init_grp_attributes (const char ***grp_attrs, int skipmembers)
364 {
365   int i = 0;
366   static const char *__grp_attrs[ATTRTAB_SIZE + 1];
367 
368   (*grp_attrs) = __grp_attrs;
369 
370   (*grp_attrs)[i++] = (char *) ATM (LM_GROUP, cn);
371   (*grp_attrs)[i++] = (char *) ATM (LM_GROUP, userPassword);
372   if (!skipmembers)
373     {
374       (*grp_attrs)[i++] = (char *) AT (memberUid);
375       if (_nss_ldap_test_config_flag (NSS_LDAP_FLAGS_RFC2307BIS))
376         (*grp_attrs)[i++] = (char *) AT (uniqueMember);
377     }
378   (*grp_attrs)[i++] = (char *) ATM (LM_GROUP, gidNumber);
379   (*grp_attrs)[i] = NULL;
380 }
381 
382 static void
init_hosts_attributes(const char *** hosts_attrs)383 init_hosts_attributes (const char ***hosts_attrs)
384 {
385   static const char *__hosts_attrs[ATTRTAB_SIZE + 1];
386 
387   (*hosts_attrs) = __hosts_attrs;
388 
389   (*hosts_attrs)[0] = (char *) ATM (LM_HOSTS, cn);
390   (*hosts_attrs)[1] = (char *) AT (ipHostNumber);
391   (*hosts_attrs)[2] = NULL;
392 }
393 
394 static void
init_services_attributes(const char *** services_attrs)395 init_services_attributes (const char ***services_attrs)
396 {
397   static const char *__services_attrs[ATTRTAB_SIZE + 1];
398 
399   (*services_attrs) = __services_attrs;
400 
401   (*services_attrs)[0] = ATM (LM_SERVICES, cn);
402   (*services_attrs)[1] = AT (ipServicePort);
403   (*services_attrs)[2] = AT (ipServiceProtocol);
404   (*services_attrs)[3] = NULL;
405 }
406 
407 static void
init_network_attributes(const char *** network_attrs)408 init_network_attributes (const char ***network_attrs)
409 {
410   static const char *__network_attrs[ATTRTAB_SIZE + 1];
411 
412   (*network_attrs) = __network_attrs;
413 
414   (*network_attrs)[0] = ATM (LM_NETWORKS, cn);
415   (*network_attrs)[1] = AT (ipNetworkNumber);
416   (*network_attrs)[2] = AT (ipNetmaskNumber);
417   (*network_attrs)[3] = NULL;
418 }
419 
420 static void
init_proto_attributes(const char *** proto_attrs)421 init_proto_attributes (const char ***proto_attrs)
422 {
423   static const char *__proto_attrs[ATTRTAB_SIZE + 1];
424 
425   (*proto_attrs) = __proto_attrs;
426 
427   (*proto_attrs)[0] = ATM (LM_PROTOCOLS, cn);
428   (*proto_attrs)[1] = AT (ipProtocolNumber);
429   (*proto_attrs)[2] = NULL;
430 }
431 
432 static void
init_rpc_attributes(const char *** rpc_attrs)433 init_rpc_attributes (const char ***rpc_attrs)
434 {
435   static const char *__rpc_attrs[ATTRTAB_SIZE + 1];
436 
437   (*rpc_attrs) = __rpc_attrs;
438 
439   (*rpc_attrs)[0] = ATM (LM_RPC, cn);
440   (*rpc_attrs)[1] = AT (oncRpcNumber);
441   (*rpc_attrs)[2] = NULL;
442 }
443 
444 static void
init_ethers_attributes(const char *** ethers_attrs)445 init_ethers_attributes (const char ***ethers_attrs)
446 {
447   static const char *__ethers_attrs[ATTRTAB_SIZE + 1];
448 
449   (*ethers_attrs) = __ethers_attrs;
450 
451   (*ethers_attrs)[0] = ATM (LM_ETHERS, cn);
452   (*ethers_attrs)[1] = AT (macAddress);
453   (*ethers_attrs)[2] = NULL;
454 }
455 
456 static void
init_bp_attributes(const char *** bp_attrs)457 init_bp_attributes (const char ***bp_attrs)
458 {
459   static const char *__bp_attrs[ATTRTAB_SIZE + 1];
460 
461   (*bp_attrs) = __bp_attrs;
462 
463   (*bp_attrs)[0] = ATM (LM_BOOTPARAMS, cn);
464   (*bp_attrs)[1] = AT (bootParameter);
465   (*bp_attrs)[2] = NULL;
466 }
467 
468 static void
init_alias_attributes(const char *** alias_attrs)469 init_alias_attributes (const char ***alias_attrs)
470 {
471   static const char *__alias_attrs[ATTRTAB_SIZE + 1];
472 
473   (*alias_attrs) = __alias_attrs;
474 
475   (*alias_attrs)[0] = ATM (LM_ALIASES, cn);
476   (*alias_attrs)[1] = AT (rfc822MailMember);
477   (*alias_attrs)[2] = NULL;
478 }
479 
480 static void
init_netgrp_attributes(const char *** netgrp_attrs)481 init_netgrp_attributes (const char ***netgrp_attrs)
482 {
483   static const char *__netgrp_attrs[ATTRTAB_SIZE + 1];
484 
485   (*netgrp_attrs) = __netgrp_attrs;
486 
487   (*netgrp_attrs)[0] = ATM (LM_NETGROUP, cn);
488   (*netgrp_attrs)[1] = AT (nisNetgroupTriple);
489   (*netgrp_attrs)[2] = AT (memberNisNetgroup);
490   (*netgrp_attrs)[3] = NULL;
491 }
492 
493 static void
init_automount_attributes(const char *** automount_attrs)494 init_automount_attributes (const char ***automount_attrs)
495 {
496   static const char *__automount_attrs[ATTRTAB_SIZE + 1];
497 
498   (*automount_attrs) = __automount_attrs;
499 
500   (*automount_attrs)[0] = AT (automountKey);
501   (*automount_attrs)[1] = AT (automountInformation);
502   (*automount_attrs)[2] = ATM (LM_AUTOMOUNT, description);
503   (*automount_attrs)[3] = NULL;
504 }
505 
506