"Fossies" - the Fresh Open Source Software Archive

Member "nss_ldap-265/ldap-schema.c" (6 Nov 2009, 17124 Bytes) of package /linux/privat/old/nss_ldap-265.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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
  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
  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
  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   (*pwd_attrs)[i] = NULL;
  338 }
  339 
  340 static void
  341 init_sp_attributes (const char ***sp_attrs)
  342 {
  343   static const char *__sp_attrs[ATTRTAB_SIZE + 1];
  344 
  345   (*sp_attrs) = __sp_attrs;
  346 
  347   (*sp_attrs)[0] = (char *) ATM (LM_SHADOW, uid);
  348   (*sp_attrs)[1] = (char *) ATM (LM_SHADOW, userPassword);
  349   (*sp_attrs)[2] = (char *) AT (shadowLastChange);
  350   (*sp_attrs)[3] = (char *) AT (shadowMax);
  351   (*sp_attrs)[4] = (char *) AT (shadowMin);
  352   (*sp_attrs)[5] = (char *) AT (shadowWarning);
  353   (*sp_attrs)[6] = (char *) AT (shadowInactive);
  354   (*sp_attrs)[7] = (char *) AT (shadowExpire);
  355   (*sp_attrs)[8] = (char *) AT (shadowFlag);
  356   (*sp_attrs)[9] = NULL;
  357 }
  358 
  359 static void
  360 init_grp_attributes (const char ***grp_attrs, int skipmembers)
  361 {
  362   int i = 0;
  363   static const char *__grp_attrs[ATTRTAB_SIZE + 1];
  364 
  365   (*grp_attrs) = __grp_attrs;
  366 
  367   (*grp_attrs)[i++] = (char *) ATM (LM_GROUP, cn);
  368   (*grp_attrs)[i++] = (char *) ATM (LM_GROUP, userPassword);
  369   if (!skipmembers)
  370     {
  371       (*grp_attrs)[i++] = (char *) AT (memberUid);
  372       if (_nss_ldap_test_config_flag (NSS_LDAP_FLAGS_RFC2307BIS))
  373         (*grp_attrs)[i++] = (char *) AT (uniqueMember);
  374     }
  375   (*grp_attrs)[i++] = (char *) ATM (LM_GROUP, gidNumber);
  376   (*grp_attrs)[i] = NULL;
  377 }
  378 
  379 static void
  380 init_hosts_attributes (const char ***hosts_attrs)
  381 {
  382   static const char *__hosts_attrs[ATTRTAB_SIZE + 1];
  383 
  384   (*hosts_attrs) = __hosts_attrs;
  385 
  386   (*hosts_attrs)[0] = (char *) ATM (LM_HOSTS, cn);
  387   (*hosts_attrs)[1] = (char *) AT (ipHostNumber);
  388   (*hosts_attrs)[2] = NULL;
  389 }
  390 
  391 static void
  392 init_services_attributes (const char ***services_attrs)
  393 {
  394   static const char *__services_attrs[ATTRTAB_SIZE + 1];
  395 
  396   (*services_attrs) = __services_attrs;
  397 
  398   (*services_attrs)[0] = ATM (LM_SERVICES, cn);
  399   (*services_attrs)[1] = AT (ipServicePort);
  400   (*services_attrs)[2] = AT (ipServiceProtocol);
  401   (*services_attrs)[3] = NULL;
  402 }
  403 
  404 static void
  405 init_network_attributes (const char ***network_attrs)
  406 {
  407   static const char *__network_attrs[ATTRTAB_SIZE + 1];
  408 
  409   (*network_attrs) = __network_attrs;
  410 
  411   (*network_attrs)[0] = ATM (LM_NETWORKS, cn);
  412   (*network_attrs)[1] = AT (ipNetworkNumber);
  413   (*network_attrs)[2] = AT (ipNetmaskNumber);
  414   (*network_attrs)[3] = NULL;
  415 }
  416 
  417 static void
  418 init_proto_attributes (const char ***proto_attrs)
  419 {
  420   static const char *__proto_attrs[ATTRTAB_SIZE + 1];
  421 
  422   (*proto_attrs) = __proto_attrs;
  423 
  424   (*proto_attrs)[0] = ATM (LM_PROTOCOLS, cn);
  425   (*proto_attrs)[1] = AT (ipProtocolNumber);
  426   (*proto_attrs)[2] = NULL;
  427 }
  428 
  429 static void
  430 init_rpc_attributes (const char ***rpc_attrs)
  431 {
  432   static const char *__rpc_attrs[ATTRTAB_SIZE + 1];
  433 
  434   (*rpc_attrs) = __rpc_attrs;
  435 
  436   (*rpc_attrs)[0] = ATM (LM_RPC, cn);
  437   (*rpc_attrs)[1] = AT (oncRpcNumber);
  438   (*rpc_attrs)[2] = NULL;
  439 }
  440 
  441 static void
  442 init_ethers_attributes (const char ***ethers_attrs)
  443 {
  444   static const char *__ethers_attrs[ATTRTAB_SIZE + 1];
  445 
  446   (*ethers_attrs) = __ethers_attrs;
  447 
  448   (*ethers_attrs)[0] = ATM (LM_ETHERS, cn);
  449   (*ethers_attrs)[1] = AT (macAddress);
  450   (*ethers_attrs)[2] = NULL;
  451 }
  452 
  453 static void
  454 init_bp_attributes (const char ***bp_attrs)
  455 {
  456   static const char *__bp_attrs[ATTRTAB_SIZE + 1];
  457 
  458   (*bp_attrs) = __bp_attrs;
  459 
  460   (*bp_attrs)[0] = ATM (LM_BOOTPARAMS, cn);
  461   (*bp_attrs)[1] = AT (bootParameter);
  462   (*bp_attrs)[2] = NULL;
  463 }
  464 
  465 static void
  466 init_alias_attributes (const char ***alias_attrs)
  467 {
  468   static const char *__alias_attrs[ATTRTAB_SIZE + 1];
  469 
  470   (*alias_attrs) = __alias_attrs;
  471 
  472   (*alias_attrs)[0] = ATM (LM_ALIASES, cn);
  473   (*alias_attrs)[1] = AT (rfc822MailMember);
  474   (*alias_attrs)[2] = NULL;
  475 }
  476 
  477 static void
  478 init_netgrp_attributes (const char ***netgrp_attrs)
  479 {
  480   static const char *__netgrp_attrs[ATTRTAB_SIZE + 1];
  481 
  482   (*netgrp_attrs) = __netgrp_attrs;
  483 
  484   (*netgrp_attrs)[0] = ATM (LM_NETGROUP, cn);
  485   (*netgrp_attrs)[1] = AT (nisNetgroupTriple);
  486   (*netgrp_attrs)[2] = AT (memberNisNetgroup);
  487   (*netgrp_attrs)[3] = NULL;
  488 }
  489 
  490 static void
  491 init_automount_attributes (const char ***automount_attrs)
  492 {
  493   static const char *__automount_attrs[ATTRTAB_SIZE + 1];
  494 
  495   (*automount_attrs) = __automount_attrs;
  496 
  497   (*automount_attrs)[0] = AT (automountKey);
  498   (*automount_attrs)[1] = AT (automountInformation);
  499   (*automount_attrs)[2] = ATM (LM_AUTOMOUNT, description);
  500   (*automount_attrs)[3] = NULL;
  501 }
  502