1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate #ifndef _LDAP_PARSE_H 30*7c478bd9Sstevel@tonic-gate #define _LDAP_PARSE_H 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #include <lber.h> 33*7c478bd9Sstevel@tonic-gate #include <ldap.h> 34*7c478bd9Sstevel@tonic-gate #include <rpcsvc/nis.h> 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #include "nis_hashitem.h" 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate /* Pick up N2L file names */ 39*7c478bd9Sstevel@tonic-gate #include <ndbm.h> 40*7c478bd9Sstevel@tonic-gate #include "yptol/shim.h" 41*7c478bd9Sstevel@tonic-gate #include "yptol/yptol.h" 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 44*7c478bd9Sstevel@tonic-gate extern "C" { 45*7c478bd9Sstevel@tonic-gate #endif 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate /* 48*7c478bd9Sstevel@tonic-gate * New <ldap.h> doesn't define LDAP_SCOPE_UNKNOWN, but we still need it. 49*7c478bd9Sstevel@tonic-gate */ 50*7c478bd9Sstevel@tonic-gate #ifndef LDAP_SCOPE_UNKNOWN 51*7c478bd9Sstevel@tonic-gate #define LDAP_SCOPE_UNKNOWN 0xFF 52*7c478bd9Sstevel@tonic-gate #endif 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate /* Attribute/value hash list element */ 55*7c478bd9Sstevel@tonic-gate typedef struct { 56*7c478bd9Sstevel@tonic-gate __nis_hash_item_mt item; /* item.name is the attr name */ 57*7c478bd9Sstevel@tonic-gate int numValues; 58*7c478bd9Sstevel@tonic-gate char **value; /* Array of values */ 59*7c478bd9Sstevel@tonic-gate bool_t isDefault; /* True if value is a default */ 60*7c478bd9Sstevel@tonic-gate } __nis_ldap_attribute_t; 61*7c478bd9Sstevel@tonic-gate 62*7c478bd9Sstevel@tonic-gate /* YP Domains structure */ 63*7c478bd9Sstevel@tonic-gate typedef struct { 64*7c478bd9Sstevel@tonic-gate int numDomains; /* number of domains listed in mapping file */ 65*7c478bd9Sstevel@tonic-gate char **domainLabels; /* the labels for particular domain names */ 66*7c478bd9Sstevel@tonic-gate char **domains; /* Array of LDAP domains */ 67*7c478bd9Sstevel@tonic-gate int numYppasswdd; /* Number of yppasswddDomainLabels */ 68*7c478bd9Sstevel@tonic-gate char **yppasswddDomainLabels; /* yppasswdd domain labels */ 69*7c478bd9Sstevel@tonic-gate } __yp_domain_context_t; 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate /* 72*7c478bd9Sstevel@tonic-gate * Begin object mappings 73*7c478bd9Sstevel@tonic-gate * 74*7c478bd9Sstevel@tonic-gate * Note that the definitions, where necessary, proceed from the bottom 75*7c478bd9Sstevel@tonic-gate * (i.e., the "atomic" components) up. 76*7c478bd9Sstevel@tonic-gate */ 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate /* 79*7c478bd9Sstevel@tonic-gate * String match/print descriptor 80*7c478bd9Sstevel@tonic-gate * 81*7c478bd9Sstevel@tonic-gate * Intended for use together with a __nis_mapping_match_type_t, which will 82*7c478bd9Sstevel@tonic-gate * determine which field of the union is valid. 83*7c478bd9Sstevel@tonic-gate * 84*7c478bd9Sstevel@tonic-gate * string Pointer to a NUL-terminated string 85*7c478bd9Sstevel@tonic-gate * single Represents a single-character match such as '[a-bTe-w]', 86*7c478bd9Sstevel@tonic-gate * which would become 87*7c478bd9Sstevel@tonic-gate * { 88*7c478bd9Sstevel@tonic-gate * 3, numRange 89*7c478bd9Sstevel@tonic-gate * {'a', 'T', 'e'}, lo 90*7c478bd9Sstevel@tonic-gate * {'b', 'T', 'w'} hi 91*7c478bd9Sstevel@tonic-gate * } 92*7c478bd9Sstevel@tonic-gate * Each pair lo[i]/hi[i] (0 <= i < numRange) defines the 93*7c478bd9Sstevel@tonic-gate * range of the wild-card match. 94*7c478bd9Sstevel@tonic-gate * limit No use currrently defined; will probably be removed 95*7c478bd9Sstevel@tonic-gate * berString Pointer to a string containing a single formatting 96*7c478bd9Sstevel@tonic-gate * character as defined by ber_printf(3LDAP). Example: "i" 97*7c478bd9Sstevel@tonic-gate * for a binary integer. 98*7c478bd9Sstevel@tonic-gate */ 99*7c478bd9Sstevel@tonic-gate typedef union { 100*7c478bd9Sstevel@tonic-gate char *string; 101*7c478bd9Sstevel@tonic-gate struct { 102*7c478bd9Sstevel@tonic-gate int numRange; 103*7c478bd9Sstevel@tonic-gate unsigned char *lo; /* Array of numRange elements */ 104*7c478bd9Sstevel@tonic-gate unsigned char *hi; /* Array of numRange elements */ 105*7c478bd9Sstevel@tonic-gate } single; 106*7c478bd9Sstevel@tonic-gate enum { 107*7c478bd9Sstevel@tonic-gate bos, 108*7c478bd9Sstevel@tonic-gate eos 109*7c478bd9Sstevel@tonic-gate } limit; 110*7c478bd9Sstevel@tonic-gate char *berString; 111*7c478bd9Sstevel@tonic-gate } __nis_mapping_match_t; 112*7c478bd9Sstevel@tonic-gate 113*7c478bd9Sstevel@tonic-gate /* 114*7c478bd9Sstevel@tonic-gate * String match/print types and descriptor 115*7c478bd9Sstevel@tonic-gate * 116*7c478bd9Sstevel@tonic-gate * Used to describe print or match conversions. The 'match' field has 117*7c478bd9Sstevel@tonic-gate * the following interpretation: 118*7c478bd9Sstevel@tonic-gate * 119*7c478bd9Sstevel@tonic-gate * Type __nis_mapping_match_t Comment 120*7c478bd9Sstevel@tonic-gate * 121*7c478bd9Sstevel@tonic-gate * mmt_item <unused> Value as indicated by corresponding 122*7c478bd9Sstevel@tonic-gate * element in __nis_mapping_item_t or 123*7c478bd9Sstevel@tonic-gate * __nis_mapping_sub_element_t array 124*7c478bd9Sstevel@tonic-gate * mmt_string string 125*7c478bd9Sstevel@tonic-gate * mmt_single single 126*7c478bd9Sstevel@tonic-gate * mmt_limit limit Probably not needed 127*7c478bd9Sstevel@tonic-gate * mmt_any <unused> Match any number of any character 128*7c478bd9Sstevel@tonic-gate * mmt_berstring berString 129*7c478bd9Sstevel@tonic-gate * mmt_begin <unused> Indicates beginning of format; optional 130*7c478bd9Sstevel@tonic-gate * mmt_end <unused> Indicates end of format; REQUIRED to 131*7c478bd9Sstevel@tonic-gate * mark the end of an array of 132*7c478bd9Sstevel@tonic-gate * __nis_mapping_format_t's 133*7c478bd9Sstevel@tonic-gate */ 134*7c478bd9Sstevel@tonic-gate typedef enum {mmt_item, mmt_string, mmt_single, mmt_limit, mmt_any, 135*7c478bd9Sstevel@tonic-gate mmt_berstring, mmt_begin, mmt_end} 136*7c478bd9Sstevel@tonic-gate __nis_mapping_match_type_t; 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate typedef struct { 139*7c478bd9Sstevel@tonic-gate __nis_mapping_match_type_t type; 140*7c478bd9Sstevel@tonic-gate __nis_mapping_match_t match; 141*7c478bd9Sstevel@tonic-gate } __nis_mapping_format_t; 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gate /* Forward */ 144*7c478bd9Sstevel@tonic-gate struct __nis_mapping_element_struct; 145*7c478bd9Sstevel@tonic-gate struct __nis_mapping_item_struct; 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate /* 148*7c478bd9Sstevel@tonic-gate * LDAP search triple 149*7c478bd9Sstevel@tonic-gate * 150*7c478bd9Sstevel@tonic-gate * Used to represent a search triple like 151*7c478bd9Sstevel@tonic-gate * ou=Group,?one?cn=staff 152*7c478bd9Sstevel@tonic-gate * or 153*7c478bd9Sstevel@tonic-gate * ou=Group,?one?(&(cn=staff)(gidNumber=10)) 154*7c478bd9Sstevel@tonic-gate * or 155*7c478bd9Sstevel@tonic-gate * ou=Hosts,?one?("cn=%s", (cname, "%s.*")) 156*7c478bd9Sstevel@tonic-gate * 157*7c478bd9Sstevel@tonic-gate * base The base DN; defaultSearchBase appended if 'base' ends with 158*7c478bd9Sstevel@tonic-gate * a comma. 159*7c478bd9Sstevel@tonic-gate * scope One of LDAP_SCOPE_BASE, LDAP_SCOPE_ONELEVEL, or 160*7c478bd9Sstevel@tonic-gate * LDAP_SCOPE_SUBTREE; LDAP_SCOPE_UNKNOWN means that this 161*7c478bd9Sstevel@tonic-gate * __nis_search_triple_t is inactive 162*7c478bd9Sstevel@tonic-gate * attrs Either a filter, or a list of attribute/value pairs, depending 163*7c478bd9Sstevel@tonic-gate * on context. 164*7c478bd9Sstevel@tonic-gate * element Pointer to a value element. If 'element' is non-NULL, the 165*7c478bd9Sstevel@tonic-gate * 'attrs' value is derived by evaluating 'element'. 166*7c478bd9Sstevel@tonic-gate */ 167*7c478bd9Sstevel@tonic-gate typedef struct { 168*7c478bd9Sstevel@tonic-gate char *base; 169*7c478bd9Sstevel@tonic-gate int scope; 170*7c478bd9Sstevel@tonic-gate char *attrs; 171*7c478bd9Sstevel@tonic-gate struct __nis_mapping_element_struct *element; 172*7c478bd9Sstevel@tonic-gate } __nis_search_triple_t; 173*7c478bd9Sstevel@tonic-gate 174*7c478bd9Sstevel@tonic-gate /* 175*7c478bd9Sstevel@tonic-gate * NIS+ index spec 176*7c478bd9Sstevel@tonic-gate * 177*7c478bd9Sstevel@tonic-gate * Represents a NIS+ index list, such as 178*7c478bd9Sstevel@tonic-gate * name=staff,gid=10 179*7c478bd9Sstevel@tonic-gate * 180*7c478bd9Sstevel@tonic-gate * numIndexes The number of entries in the 'name'/'value' arrays 181*7c478bd9Sstevel@tonic-gate * name Array of column names 182*7c478bd9Sstevel@tonic-gate * value Array of column values; uses __nis_mapping_format_t so that 183*7c478bd9Sstevel@tonic-gate * wild-cards can be represented 184*7c478bd9Sstevel@tonic-gate * 185*7c478bd9Sstevel@tonic-gate * Example 186*7c478bd9Sstevel@tonic-gate * name=staff,gid=10 187*7c478bd9Sstevel@tonic-gate * 2, numIndexes 188*7c478bd9Sstevel@tonic-gate * { name 189*7c478bd9Sstevel@tonic-gate * "name", 190*7c478bd9Sstevel@tonic-gate * "gid" 191*7c478bd9Sstevel@tonic-gate * }, 192*7c478bd9Sstevel@tonic-gate * { value 193*7c478bd9Sstevel@tonic-gate * { 194*7c478bd9Sstevel@tonic-gate * {mmt_begin}, 195*7c478bd9Sstevel@tonic-gate * {mmt_string, "staff"}, 196*7c478bd9Sstevel@tonic-gate * {mmt_end} 197*7c478bd9Sstevel@tonic-gate * }, 198*7c478bd9Sstevel@tonic-gate * { 199*7c478bd9Sstevel@tonic-gate * {mmt_begin}, 200*7c478bd9Sstevel@tonic-gate * {mmt_string, "gid"}, 201*7c478bd9Sstevel@tonic-gate * {mmt_end} 202*7c478bd9Sstevel@tonic-gate * } 203*7c478bd9Sstevel@tonic-gate * } 204*7c478bd9Sstevel@tonic-gate */ 205*7c478bd9Sstevel@tonic-gate typedef struct { 206*7c478bd9Sstevel@tonic-gate int numIndexes; 207*7c478bd9Sstevel@tonic-gate char **name; 208*7c478bd9Sstevel@tonic-gate __nis_mapping_format_t **value; 209*7c478bd9Sstevel@tonic-gate } __nis_index_t; 210*7c478bd9Sstevel@tonic-gate 211*7c478bd9Sstevel@tonic-gate /* What to do with the LDAP data when a NIS+ entry is deleted */ 212*7c478bd9Sstevel@tonic-gate typedef enum {dd_always, dd_perDbId, dd_never} __nis_delete_disp_t; 213*7c478bd9Sstevel@tonic-gate 214*7c478bd9Sstevel@tonic-gate /* Type of an element in a mapping rule */ 215*7c478bd9Sstevel@tonic-gate typedef enum {me_item, me_print, me_split, me_match, me_extract} 216*7c478bd9Sstevel@tonic-gate __nis_mapping_element_type_t; 217*7c478bd9Sstevel@tonic-gate 218*7c478bd9Sstevel@tonic-gate /* Type of an item in a mapping rule */ 219*7c478bd9Sstevel@tonic-gate typedef enum {mit_any, mit_nisplus, mit_ldap} __nis_mapping_item_type_t; 220*7c478bd9Sstevel@tonic-gate 221*7c478bd9Sstevel@tonic-gate /* 222*7c478bd9Sstevel@tonic-gate * NIS+ object name, with index 223*7c478bd9Sstevel@tonic-gate * 224*7c478bd9Sstevel@tonic-gate * Used to represent a name like 225*7c478bd9Sstevel@tonic-gate * [name = staff, gid = 10]group.org_dir 226*7c478bd9Sstevel@tonic-gate * (Note: spaces around "=" and after "," to make cstyle happy; such spaces 227*7c478bd9Sstevel@tonic-gate * are not usually part of the syntax, but they are allowed.) 228*7c478bd9Sstevel@tonic-gate * 229*7c478bd9Sstevel@tonic-gate * index The index part of the name. numIndexes == 0 means there is 230*7c478bd9Sstevel@tonic-gate * no index. 231*7c478bd9Sstevel@tonic-gate * name The object name proper. If it doesn't end in a dot, the 232*7c478bd9Sstevel@tonic-gate * nisplusLDAPbaseDomain is appended. 233*7c478bd9Sstevel@tonic-gate */ 234*7c478bd9Sstevel@tonic-gate typedef struct { 235*7c478bd9Sstevel@tonic-gate __nis_index_t index; 236*7c478bd9Sstevel@tonic-gate char *name; 237*7c478bd9Sstevel@tonic-gate } __nis_obj_spec_t; 238*7c478bd9Sstevel@tonic-gate 239*7c478bd9Sstevel@tonic-gate /* 240*7c478bd9Sstevel@tonic-gate * Complete representation of a subset of either the DIT or a NIS+ object. 241*7c478bd9Sstevel@tonic-gate * Intended for use in a __nis_mapping_item_t, where the 'type' field 242*7c478bd9Sstevel@tonic-gate * determines which field of the __nis_triple_or_obj_t is active. 243*7c478bd9Sstevel@tonic-gate */ 244*7c478bd9Sstevel@tonic-gate typedef union { 245*7c478bd9Sstevel@tonic-gate __nis_search_triple_t triple; 246*7c478bd9Sstevel@tonic-gate __nis_obj_spec_t obj; 247*7c478bd9Sstevel@tonic-gate } __nis_triple_or_obj_t; 248*7c478bd9Sstevel@tonic-gate 249*7c478bd9Sstevel@tonic-gate /* 250*7c478bd9Sstevel@tonic-gate * Mapping item 251*7c478bd9Sstevel@tonic-gate * 252*7c478bd9Sstevel@tonic-gate * The mapping item is a single LDAP attribute, or a NIS+ table column, such as 253*7c478bd9Sstevel@tonic-gate * ldap:gidNumber:ou=Group, ?one?cn=staff 254*7c478bd9Sstevel@tonic-gate * or 255*7c478bd9Sstevel@tonic-gate * nisplus:gid[name = staff]group.org_dir 256*7c478bd9Sstevel@tonic-gate * (Note: spaces around "=" and after "," to make cstyle happy; such spaces 257*7c478bd9Sstevel@tonic-gate * are not usually part of the syntax, but they are allowed.) 258*7c478bd9Sstevel@tonic-gate * 259*7c478bd9Sstevel@tonic-gate * type mit_ldap or mit_nisplus 260*7c478bd9Sstevel@tonic-gate * name Attribute/column name 261*7c478bd9Sstevel@tonic-gate * searchSpec LDAP search triple, or NIS+ indexed object name 262*7c478bd9Sstevel@tonic-gate * repeat True if item should be repeated if necessary. This is used 263*7c478bd9Sstevel@tonic-gate * to represent implied lists, such as '(memberUid)', which 264*7c478bd9Sstevel@tonic-gate * denotes all values of the 'memberUid' attribute. 265*7c478bd9Sstevel@tonic-gate * exItem forward mapping item for supporting removespec syntax. 266*7c478bd9Sstevel@tonic-gate * 267*7c478bd9Sstevel@tonic-gate */ 268*7c478bd9Sstevel@tonic-gate typedef struct __nis_mapping_item_struct { 269*7c478bd9Sstevel@tonic-gate __nis_mapping_item_type_t type; 270*7c478bd9Sstevel@tonic-gate char *name; 271*7c478bd9Sstevel@tonic-gate __nis_triple_or_obj_t searchSpec; 272*7c478bd9Sstevel@tonic-gate bool_t repeat; 273*7c478bd9Sstevel@tonic-gate struct __nis_mapping_item_struct *exItem; 274*7c478bd9Sstevel@tonic-gate } __nis_mapping_item_t; 275*7c478bd9Sstevel@tonic-gate 276*7c478bd9Sstevel@tonic-gate /* 277*7c478bd9Sstevel@tonic-gate * Sub-element of a mapping rule element 278*7c478bd9Sstevel@tonic-gate * 279*7c478bd9Sstevel@tonic-gate * Each element/sub-element represents the value(s) derived according to 280*7c478bd9Sstevel@tonic-gate * the semantics of the element. Although not explicitly represented here, 281*7c478bd9Sstevel@tonic-gate * values are either strings or BER byte sequences. 282*7c478bd9Sstevel@tonic-gate * 283*7c478bd9Sstevel@tonic-gate * type Type of the 'element' union 284*7c478bd9Sstevel@tonic-gate * element.item A single item 285*7c478bd9Sstevel@tonic-gate * element.print printf(3C)-style value 286*7c478bd9Sstevel@tonic-gate * fmt Array of formatting elements, terminated by 'mmt_end' 287*7c478bd9Sstevel@tonic-gate * numItems Number of items in the 'item' array 288*7c478bd9Sstevel@tonic-gate * item Array of 'numItems' items 289*7c478bd9Sstevel@tonic-gate * doElide Should the last character of the (string) value be 290*7c478bd9Sstevel@tonic-gate * removed ? 291*7c478bd9Sstevel@tonic-gate * elide Character to be removed 292*7c478bd9Sstevel@tonic-gate * element.split Item value string split into multiple values 293*7c478bd9Sstevel@tonic-gate * item A single item 294*7c478bd9Sstevel@tonic-gate * delim The separator character for the split 295*7c478bd9Sstevel@tonic-gate * element.extract Extraction of a sub-string from an item value 296*7c478bd9Sstevel@tonic-gate * fmt Array of formatting elements, terminated by 'mmt_end' 297*7c478bd9Sstevel@tonic-gate * item A single item 298*7c478bd9Sstevel@tonic-gate * 299*7c478bd9Sstevel@tonic-gate * Examples (see __nis_mapping_element_t below for examples using the 'item' 300*7c478bd9Sstevel@tonic-gate * field of __nis_mapping_sub_element_t). For notational convenience, 301*7c478bd9Sstevel@tonic-gate * __nis_mapping_item_t's are shortened to just the item name. 302*7c478bd9Sstevel@tonic-gate * 303*7c478bd9Sstevel@tonic-gate * (1) String value consisting of the string "{crypt}" followed by the 304*7c478bd9Sstevel@tonic-gate * value of the 'passwd' column. The NIS+LDAPmapping(4) representation 305*7c478bd9Sstevel@tonic-gate * is 306*7c478bd9Sstevel@tonic-gate * ("{crypt}%s", passwd) 307*7c478bd9Sstevel@tonic-gate * and the element.print contains 308*7c478bd9Sstevel@tonic-gate * { fmt 309*7c478bd9Sstevel@tonic-gate * {mmt_begin}, 310*7c478bd9Sstevel@tonic-gate * {mmt_string, "{crypt}"}, 311*7c478bd9Sstevel@tonic-gate * {mmt_item}, 312*7c478bd9Sstevel@tonic-gate * {mmt_end} 313*7c478bd9Sstevel@tonic-gate * }, 314*7c478bd9Sstevel@tonic-gate * 1, numItems 315*7c478bd9Sstevel@tonic-gate * { item 316*7c478bd9Sstevel@tonic-gate * {"passwd"} 317*7c478bd9Sstevel@tonic-gate * } 318*7c478bd9Sstevel@tonic-gate * FALSE, doElide 319*7c478bd9Sstevel@tonic-gate * '\0' elide (unused) 320*7c478bd9Sstevel@tonic-gate * 321*7c478bd9Sstevel@tonic-gate * (2) Split a value such as "member1,member2,member3" into multiple 322*7c478bd9Sstevel@tonic-gate * (three, here) values using ',' as the separator. 323*7c478bd9Sstevel@tonic-gate * (members, ",") 324*7c478bd9Sstevel@tonic-gate * element.split 325*7c478bd9Sstevel@tonic-gate * {"members"}, item 326*7c478bd9Sstevel@tonic-gate * ',' delim 327*7c478bd9Sstevel@tonic-gate * 328*7c478bd9Sstevel@tonic-gate * (3) Given a 'cname' column with the value "some.dom.ain.", extract 329*7c478bd9Sstevel@tonic-gate * "some", which becomes the value of the expression. 330*7c478bd9Sstevel@tonic-gate * (cname, "%s.*") 331*7c478bd9Sstevel@tonic-gate * element.extract 332*7c478bd9Sstevel@tonic-gate * { fmt 333*7c478bd9Sstevel@tonic-gate * {mmt_begin}, 334*7c478bd9Sstevel@tonic-gate * {mmt_item}, 335*7c478bd9Sstevel@tonic-gate * {mmt_string, "."}, 336*7c478bd9Sstevel@tonic-gate * {mmt_any}, 337*7c478bd9Sstevel@tonic-gate * {mmt_end} 338*7c478bd9Sstevel@tonic-gate * }, 339*7c478bd9Sstevel@tonic-gate * {"cname"} item 340*7c478bd9Sstevel@tonic-gate */ 341*7c478bd9Sstevel@tonic-gate typedef struct { 342*7c478bd9Sstevel@tonic-gate __nis_mapping_element_type_t type; 343*7c478bd9Sstevel@tonic-gate union { 344*7c478bd9Sstevel@tonic-gate __nis_mapping_item_t item; 345*7c478bd9Sstevel@tonic-gate struct { 346*7c478bd9Sstevel@tonic-gate __nis_mapping_format_t *fmt; 347*7c478bd9Sstevel@tonic-gate int numItems; 348*7c478bd9Sstevel@tonic-gate __nis_mapping_item_t *item; 349*7c478bd9Sstevel@tonic-gate bool_t doElide; 350*7c478bd9Sstevel@tonic-gate unsigned char elide; 351*7c478bd9Sstevel@tonic-gate } print; 352*7c478bd9Sstevel@tonic-gate struct { 353*7c478bd9Sstevel@tonic-gate __nis_mapping_item_t item; 354*7c478bd9Sstevel@tonic-gate unsigned char delim; 355*7c478bd9Sstevel@tonic-gate } split; 356*7c478bd9Sstevel@tonic-gate struct { 357*7c478bd9Sstevel@tonic-gate __nis_mapping_format_t *fmt; 358*7c478bd9Sstevel@tonic-gate __nis_mapping_item_t item; 359*7c478bd9Sstevel@tonic-gate } extract; 360*7c478bd9Sstevel@tonic-gate } element; 361*7c478bd9Sstevel@tonic-gate } __nis_mapping_sub_element_t; 362*7c478bd9Sstevel@tonic-gate 363*7c478bd9Sstevel@tonic-gate /* 364*7c478bd9Sstevel@tonic-gate * Mapping rule element 365*7c478bd9Sstevel@tonic-gate * 366*7c478bd9Sstevel@tonic-gate * Each element/sub-element represents the value(s) derived according to 367*7c478bd9Sstevel@tonic-gate * the semantics of the element. Although not explicitly represented here, 368*7c478bd9Sstevel@tonic-gate * values are either strings or BER byte sequences. 369*7c478bd9Sstevel@tonic-gate * 370*7c478bd9Sstevel@tonic-gate * type Type of the 'element' union 371*7c478bd9Sstevel@tonic-gate * element.item A single item 372*7c478bd9Sstevel@tonic-gate * element.print printf(3C)-style value 373*7c478bd9Sstevel@tonic-gate * fmt Array of formatting elements, terminated by 'mmt_end' 374*7c478bd9Sstevel@tonic-gate * numSubElements Number of sub-elements in the 'subElement' array 375*7c478bd9Sstevel@tonic-gate * subElement Array of 'numSubElements' sub-elements 376*7c478bd9Sstevel@tonic-gate * doElide Should the last character of the (string) value(s) be 377*7c478bd9Sstevel@tonic-gate * removed ? 378*7c478bd9Sstevel@tonic-gate * elide Character to be removed 379*7c478bd9Sstevel@tonic-gate * element.split Item value string split into multiple values 380*7c478bd9Sstevel@tonic-gate * item A single item 381*7c478bd9Sstevel@tonic-gate * delim The separator character for the split 382*7c478bd9Sstevel@tonic-gate * element.match Assignment of item values by matching to a format 383*7c478bd9Sstevel@tonic-gate * fmt Array of formatting elements, terminated by 'mmt_end' 384*7c478bd9Sstevel@tonic-gate * numItems Number of items in the 'item' array 385*7c478bd9Sstevel@tonic-gate * item Array of 'numItems' items 386*7c478bd9Sstevel@tonic-gate * element.extract Extraction of a sub-string from an item value 387*7c478bd9Sstevel@tonic-gate * fmt Array of formatting elements, terminated by 'mmt_end' 388*7c478bd9Sstevel@tonic-gate * item A single item 389*7c478bd9Sstevel@tonic-gate * 390*7c478bd9Sstevel@tonic-gate * Examples; items represented by just the item name. 391*7c478bd9Sstevel@tonic-gate * 392*7c478bd9Sstevel@tonic-gate * (1) The value of the 'name' column. 393*7c478bd9Sstevel@tonic-gate * name 394*7c478bd9Sstevel@tonic-gate * element.item 395*7c478bd9Sstevel@tonic-gate * {"name"} item 396*7c478bd9Sstevel@tonic-gate * 397*7c478bd9Sstevel@tonic-gate * (2) Example (1) for a sub-element showed how to construct a value from 398*7c478bd9Sstevel@tonic-gate * a printf(3C)-style format string and one or more item values. 399*7c478bd9Sstevel@tonic-gate * However that example is only valid when used as a sub-expression 400*7c478bd9Sstevel@tonic-gate * (in place of an item in a 'print' list, for example). If 401*7c478bd9Sstevel@tonic-gate * ("{crypt}%s", passwd) 402*7c478bd9Sstevel@tonic-gate * was part of a rule like 403*7c478bd9Sstevel@tonic-gate * userPassword=("{crypt}%s", passwd) 404*7c478bd9Sstevel@tonic-gate * the representation would use a __nis_mapping_element_t as follows. 405*7c478bd9Sstevel@tonic-gate * element.print 406*7c478bd9Sstevel@tonic-gate * { fmt 407*7c478bd9Sstevel@tonic-gate * {mmt_begin}, 408*7c478bd9Sstevel@tonic-gate * {mmt_string, "{crypt}"}, 409*7c478bd9Sstevel@tonic-gate * {mmt_item}, 410*7c478bd9Sstevel@tonic-gate * {mmt_end} 411*7c478bd9Sstevel@tonic-gate * }, 412*7c478bd9Sstevel@tonic-gate * 1, numSubElements 413*7c478bd9Sstevel@tonic-gate * { subElement 414*7c478bd9Sstevel@tonic-gate * me_item, type 415*7c478bd9Sstevel@tonic-gate * {"passwd"} item 416*7c478bd9Sstevel@tonic-gate * }, 417*7c478bd9Sstevel@tonic-gate * FALSE, doElide 418*7c478bd9Sstevel@tonic-gate * '\0' elide (unused) 419*7c478bd9Sstevel@tonic-gate * 420*7c478bd9Sstevel@tonic-gate * (3) Match a value such as "{dh-1024}abcdef000234" to a template format 421*7c478bd9Sstevel@tonic-gate * "{%s}%s", assign "dh-1024" to the 'auth_type' column, and 422*7c478bd9Sstevel@tonic-gate * "abcdef000234" to the 'public_data' column. 423*7c478bd9Sstevel@tonic-gate * ("{%s}%s", auth_type, public_data) 424*7c478bd9Sstevel@tonic-gate * element.match 425*7c478bd9Sstevel@tonic-gate * { fmt 426*7c478bd9Sstevel@tonic-gate * {mmt_begin}, 427*7c478bd9Sstevel@tonic-gate * {mmt_string, "{"}, 428*7c478bd9Sstevel@tonic-gate * {mmt_item}, 429*7c478bd9Sstevel@tonic-gate * {mmt_string, "}"}, 430*7c478bd9Sstevel@tonic-gate * {mmt_item}, 431*7c478bd9Sstevel@tonic-gate * {mmt_end} 432*7c478bd9Sstevel@tonic-gate * } 433*7c478bd9Sstevel@tonic-gate * 2, numItems 434*7c478bd9Sstevel@tonic-gate * { item 435*7c478bd9Sstevel@tonic-gate * {"auth_type"}, 436*7c478bd9Sstevel@tonic-gate * {"public_data"} 437*7c478bd9Sstevel@tonic-gate * } 438*7c478bd9Sstevel@tonic-gate */ 439*7c478bd9Sstevel@tonic-gate typedef struct __nis_mapping_element_struct { 440*7c478bd9Sstevel@tonic-gate __nis_mapping_element_type_t type; 441*7c478bd9Sstevel@tonic-gate union { 442*7c478bd9Sstevel@tonic-gate __nis_mapping_item_t item; 443*7c478bd9Sstevel@tonic-gate struct { 444*7c478bd9Sstevel@tonic-gate __nis_mapping_format_t *fmt; 445*7c478bd9Sstevel@tonic-gate int numSubElements; 446*7c478bd9Sstevel@tonic-gate __nis_mapping_sub_element_t *subElement; 447*7c478bd9Sstevel@tonic-gate bool_t doElide; 448*7c478bd9Sstevel@tonic-gate unsigned char elide; 449*7c478bd9Sstevel@tonic-gate } print; 450*7c478bd9Sstevel@tonic-gate struct { 451*7c478bd9Sstevel@tonic-gate __nis_mapping_item_t item; 452*7c478bd9Sstevel@tonic-gate unsigned char delim; 453*7c478bd9Sstevel@tonic-gate } split; 454*7c478bd9Sstevel@tonic-gate struct { 455*7c478bd9Sstevel@tonic-gate __nis_mapping_format_t *fmt; 456*7c478bd9Sstevel@tonic-gate int numItems; 457*7c478bd9Sstevel@tonic-gate __nis_mapping_item_t *item; 458*7c478bd9Sstevel@tonic-gate } match; 459*7c478bd9Sstevel@tonic-gate struct { 460*7c478bd9Sstevel@tonic-gate __nis_mapping_format_t *fmt; 461*7c478bd9Sstevel@tonic-gate __nis_mapping_item_t item; 462*7c478bd9Sstevel@tonic-gate } extract; 463*7c478bd9Sstevel@tonic-gate } element; 464*7c478bd9Sstevel@tonic-gate } __nis_mapping_element_t; 465*7c478bd9Sstevel@tonic-gate 466*7c478bd9Sstevel@tonic-gate /* 467*7c478bd9Sstevel@tonic-gate * One side (left or right) of a mapping rule 468*7c478bd9Sstevel@tonic-gate * 469*7c478bd9Sstevel@tonic-gate * Example 470*7c478bd9Sstevel@tonic-gate * The rule 471*7c478bd9Sstevel@tonic-gate * userPassword=("{crypt}%s", passwd) 472*7c478bd9Sstevel@tonic-gate * would be reprsented by a __nis_mapping_rule_t as follows 473*7c478bd9Sstevel@tonic-gate * { lhs 474*7c478bd9Sstevel@tonic-gate * 1, numElements 475*7c478bd9Sstevel@tonic-gate * { element 476*7c478bd9Sstevel@tonic-gate * me_item, 477*7c478bd9Sstevel@tonic-gate * {"userPassword"} 478*7c478bd9Sstevel@tonic-gate * } 479*7c478bd9Sstevel@tonic-gate * }, 480*7c478bd9Sstevel@tonic-gate * { rhs 481*7c478bd9Sstevel@tonic-gate * 1, numElements 482*7c478bd9Sstevel@tonic-gate * { element 483*7c478bd9Sstevel@tonic-gate * me_print, 484*7c478bd9Sstevel@tonic-gate * { 485*7c478bd9Sstevel@tonic-gate * See example (2) under 486*7c478bd9Sstevel@tonic-gate * __nis_mapping_element_t 487*7c478bd9Sstevel@tonic-gate * above 488*7c478bd9Sstevel@tonic-gate * } 489*7c478bd9Sstevel@tonic-gate * } 490*7c478bd9Sstevel@tonic-gate * } 491*7c478bd9Sstevel@tonic-gate */ 492*7c478bd9Sstevel@tonic-gate typedef struct { 493*7c478bd9Sstevel@tonic-gate int numElements; 494*7c478bd9Sstevel@tonic-gate __nis_mapping_element_t *element; 495*7c478bd9Sstevel@tonic-gate } __nis_mapping_rlhs_t; 496*7c478bd9Sstevel@tonic-gate 497*7c478bd9Sstevel@tonic-gate /* A single mapping rule: attribute -> column or column -> attribute */ 498*7c478bd9Sstevel@tonic-gate typedef struct { 499*7c478bd9Sstevel@tonic-gate __nis_mapping_rlhs_t lhs; 500*7c478bd9Sstevel@tonic-gate __nis_mapping_rlhs_t rhs; 501*7c478bd9Sstevel@tonic-gate } __nis_mapping_rule_t; 502*7c478bd9Sstevel@tonic-gate 503*7c478bd9Sstevel@tonic-gate /* 504*7c478bd9Sstevel@tonic-gate * Map (sub-set of) NIS+ object to location(s) in the LDAP DB 505*7c478bd9Sstevel@tonic-gate * 506*7c478bd9Sstevel@tonic-gate * read base/scope/filter triple used to read data from LDAP; 507*7c478bd9Sstevel@tonic-gate * LDAP_SCOPE_UNKNOWN indicates that 'read' is unused 508*7c478bd9Sstevel@tonic-gate * write base/scope/attrlist triple used to write data to LDAP; 509*7c478bd9Sstevel@tonic-gate * LDAP_SCOPE_UNKNOWN indicates that 'write' is unused 510*7c478bd9Sstevel@tonic-gate * delDisp What should happen to the LDAP entry when the corresponding 511*7c478bd9Sstevel@tonic-gate * NIS+ data is deleted. 512*7c478bd9Sstevel@tonic-gate * dbIdName The dbId for the delete rule set (if any) 513*7c478bd9Sstevel@tonic-gate * numDbIds The number of rules in the 'dbId' rule set 514*7c478bd9Sstevel@tonic-gate * dbId The delete rule set; this field must point to a valid 515*7c478bd9Sstevel@tonic-gate * rule set if 'delDisp' is 'dd_perDbId'; ignored otherwise 516*7c478bd9Sstevel@tonic-gate * next Pointer to the next __nis_object_dn_t structure for this 517*7c478bd9Sstevel@tonic-gate * NIS+ object. 518*7c478bd9Sstevel@tonic-gate * 519*7c478bd9Sstevel@tonic-gate * Example 520*7c478bd9Sstevel@tonic-gate * The "group.org_dir.x.y.z." NIS+ table should be read from and 521*7c478bd9Sstevel@tonic-gate * written to the "ou=Group" container at "dc=x,dc=y,dc=z". Upon 522*7c478bd9Sstevel@tonic-gate * NIS+ entry deletion, we should always attempt to delete the 523*7c478bd9Sstevel@tonic-gate * corresponding LDAP attributes. 524*7c478bd9Sstevel@tonic-gate * 525*7c478bd9Sstevel@tonic-gate * { read 526*7c478bd9Sstevel@tonic-gate * "ou=Group,dc=x,dc=y,dc=z", 527*7c478bd9Sstevel@tonic-gate * LDAP_SCOPE_ONELEVEL, 528*7c478bd9Sstevel@tonic-gate * "objectClass=posixGroup" 529*7c478bd9Sstevel@tonic-gate * }, 530*7c478bd9Sstevel@tonic-gate * { write 531*7c478bd9Sstevel@tonic-gate * "ou=Group,dc=x,dc=y,dc=z", 532*7c478bd9Sstevel@tonic-gate * LDAP_SCOPE_ONELEVEL, 533*7c478bd9Sstevel@tonic-gate * "objectClass=posixGroup" 534*7c478bd9Sstevel@tonic-gate * }, 535*7c478bd9Sstevel@tonic-gate * dd_always, delDisp 536*7c478bd9Sstevel@tonic-gate * NULL, dbIdName 537*7c478bd9Sstevel@tonic-gate * 0, 538*7c478bd9Sstevel@tonic-gate * NULL, dbId 539*7c478bd9Sstevel@tonic-gate * NULL next 540*7c478bd9Sstevel@tonic-gate */ 541*7c478bd9Sstevel@tonic-gate typedef struct { 542*7c478bd9Sstevel@tonic-gate __nis_search_triple_t read; 543*7c478bd9Sstevel@tonic-gate __nis_search_triple_t write; 544*7c478bd9Sstevel@tonic-gate __nis_delete_disp_t delDisp; 545*7c478bd9Sstevel@tonic-gate char *dbIdName; 546*7c478bd9Sstevel@tonic-gate int numDbIds; 547*7c478bd9Sstevel@tonic-gate __nis_mapping_rule_t **dbId; /* Delete rule set */ 548*7c478bd9Sstevel@tonic-gate void *next; 549*7c478bd9Sstevel@tonic-gate } __nis_object_dn_t; 550*7c478bd9Sstevel@tonic-gate 551*7c478bd9Sstevel@tonic-gate /* 552*7c478bd9Sstevel@tonic-gate * Per-dbId or -object mapping 553*7c478bd9Sstevel@tonic-gate * 554*7c478bd9Sstevel@tonic-gate * Initially collected per-dbId (so that item.name=dbId), the 555*7c478bd9Sstevel@tonic-gate * __nis_table_mapping_t's are later stored per-object (whereupon 556*7c478bd9Sstevel@tonic-gate * item.name=objName). 557*7c478bd9Sstevel@tonic-gate * 558*7c478bd9Sstevel@tonic-gate * item Structure used by the hash_item functions 559*7c478bd9Sstevel@tonic-gate * dbId The dbId associated with the __nis_table_mapping_t 560*7c478bd9Sstevel@tonic-gate * structure 561*7c478bd9Sstevel@tonic-gate * index Object sub-set specification; only defined for 562*7c478bd9Sstevel@tonic-gate * tables; index.numIndexes equal to zero means that 563*7c478bd9Sstevel@tonic-gate * the 'index' is unused. 564*7c478bd9Sstevel@tonic-gate * next Pointer to next table sub-set, if any 565*7c478bd9Sstevel@tonic-gate * numColumns Number of columns if the object is a table 566*7c478bd9Sstevel@tonic-gate * column Column names 567*7c478bd9Sstevel@tonic-gate * initTtlLo Lower limit on the initial TTL 568*7c478bd9Sstevel@tonic-gate * initTtlHi Upper limit on the initial TTL 569*7c478bd9Sstevel@tonic-gate * ttl TTL set after refresh 570*7c478bd9Sstevel@tonic-gate * commentChar NIS map comment character 571*7c478bd9Sstevel@tonic-gate * objectDN Location in the LDAP DB 572*7c478bd9Sstevel@tonic-gate * numSplits number of split fields 573*7c478bd9Sstevel@tonic-gate * separatorStr separator string to break up NIS split field attributes 574*7c478bd9Sstevel@tonic-gate * usedns_flag indicates if the -b option to makedbm is used for a map. 575*7c478bd9Sstevel@tonic-gate * securemap_flag indicates if the -s option to makedbm is used for a map. 576*7c478bd9Sstevel@tonic-gate * __nis_mapping_element_t Parsed format strings and name fields storage 577*7c478bd9Sstevel@tonic-gate * numRulesFromLDAP Number of rules (and hence elements in the 578*7c478bd9Sstevel@tonic-gate * 'ruleFromLDAP' array) for mapping LDAP entries 579*7c478bd9Sstevel@tonic-gate * to NIS+ objects 580*7c478bd9Sstevel@tonic-gate * ruleFromLDAP 581*7c478bd9Sstevel@tonic-gate * numRulesToLDAP Number of rules (and hence elements in the 582*7c478bd9Sstevel@tonic-gate * 'ruleToLDAP' array) for mapping NIS+ objects to 583*7c478bd9Sstevel@tonic-gate * LDAP entries 584*7c478bd9Sstevel@tonic-gate * ruleToLDAP 585*7c478bd9Sstevel@tonic-gate * objType The NIS+ object type; NIS_BOGUS_OBJ used to indicate 586*7c478bd9Sstevel@tonic-gate * not set (in which case the other object data fields 587*7c478bd9Sstevel@tonic-gate * should be assumed to be invalid) 588*7c478bd9Sstevel@tonic-gate * objName The fully qualified name of the NIS+ object 589*7c478bd9Sstevel@tonic-gate * objPath The name used internally by libnisdb (which 590*7c478bd9Sstevel@tonic-gate * is path to the data file for the table/directory 591*7c478bd9Sstevel@tonic-gate * containing the object) 592*7c478bd9Sstevel@tonic-gate * obj A copy of the object itself 593*7c478bd9Sstevel@tonic-gate * isMaster Set if this machine is the master for the object 594*7c478bd9Sstevel@tonic-gate * (actually for the directory containing it) 595*7c478bd9Sstevel@tonic-gate * seq_num A sequence number representing the order of the maps 596*7c478bd9Sstevel@tonic-gate * as listed in the NISLDAPmapping.template file. 597*7c478bd9Sstevel@tonic-gate * 598*7c478bd9Sstevel@tonic-gate * Example 599*7c478bd9Sstevel@tonic-gate * Map the subset of the NIS+ 'group.org_dir.x.y.z.' table for which 600*7c478bd9Sstevel@tonic-gate * is true that the 'name' starts with 'a' or 'o' to location per 601*7c478bd9Sstevel@tonic-gate * the __nis_object_dn_t example above. No translation rules. 602*7c478bd9Sstevel@tonic-gate * 603*7c478bd9Sstevel@tonic-gate * { item 604*7c478bd9Sstevel@tonic-gate * "group.org_dir.x.y.z." name 605*7c478bd9Sstevel@tonic-gate * <omitted> 606*7c478bd9Sstevel@tonic-gate * }, 607*7c478bd9Sstevel@tonic-gate * "group_subset", dbId 608*7c478bd9Sstevel@tonic-gate * 1, numIndexes 609*7c478bd9Sstevel@tonic-gate * { index 610*7c478bd9Sstevel@tonic-gate * 1, 611*7c478bd9Sstevel@tonic-gate * {"name"}, 612*7c478bd9Sstevel@tonic-gate * { 613*7c478bd9Sstevel@tonic-gate * {mmt_begin}, 614*7c478bd9Sstevel@tonic-gate * { 615*7c478bd9Sstevel@tonic-gate * mmt_single, 616*7c478bd9Sstevel@tonic-gate * 2, 617*7c478bd9Sstevel@tonic-gate * {'a', 'o'}, 618*7c478bd9Sstevel@tonic-gate * {'a', 'o'}, 619*7c478bd9Sstevel@tonic-gate * } 620*7c478bd9Sstevel@tonic-gate * {mmt_any}, 621*7c478bd9Sstevel@tonic-gate * {mmt_end} 622*7c478bd9Sstevel@tonic-gate * } 623*7c478bd9Sstevel@tonic-gate * } 624*7c478bd9Sstevel@tonic-gate * NULL, next 625*7c478bd9Sstevel@tonic-gate * 4, numColumns 626*7c478bd9Sstevel@tonic-gate * { column 627*7c478bd9Sstevel@tonic-gate * "name", 628*7c478bd9Sstevel@tonic-gate * "passwd", 629*7c478bd9Sstevel@tonic-gate * "gid", 630*7c478bd9Sstevel@tonic-gate * "members" 631*7c478bd9Sstevel@tonic-gate * }, 632*7c478bd9Sstevel@tonic-gate * 1800, initTtlLo 633*7c478bd9Sstevel@tonic-gate * 5400, initTtlHi 634*7c478bd9Sstevel@tonic-gate * 3600, ttl 635*7c478bd9Sstevel@tonic-gate * '#', commentChar 636*7c478bd9Sstevel@tonic-gate * <see __nis_object_dn_t example>, objectDN 637*7c478bd9Sstevel@tonic-gate * 0, numSplits 638*7c478bd9Sstevel@tonic-gate * NULL, separatorStr 639*7c478bd9Sstevel@tonic-gate * 0, usedns_flag 640*7c478bd9Sstevel@tonic-gate * 0, securemap_flag 641*7c478bd9Sstevel@tonic-gate * <see __nis_mapping_element_t example>, e 642*7c478bd9Sstevel@tonic-gate * 0, numRulesFromLDAP 643*7c478bd9Sstevel@tonic-gate * NULL, ruleFromLDAP 644*7c478bd9Sstevel@tonic-gate * 0, numRulesToLDAP 645*7c478bd9Sstevel@tonic-gate * NULL ruleToLDAP 646*7c478bd9Sstevel@tonic-gate * NIS_TABLE_OBJ, objType 647*7c478bd9Sstevel@tonic-gate * "group.org_dir.x.y.z.", objName 648*7c478bd9Sstevel@tonic-gate * "/var/nis/data/group.org_dir" objPath 649*7c478bd9Sstevel@tonic-gate * <pointer to NIS+ object> obj 650*7c478bd9Sstevel@tonic-gate * 1 isMaster 651*7c478bd9Sstevel@tonic-gate */ 652*7c478bd9Sstevel@tonic-gate typedef struct { 653*7c478bd9Sstevel@tonic-gate __nis_hash_item_mt item; /* item.name=dbId||objName */ 654*7c478bd9Sstevel@tonic-gate char *dbId; /* Used during initializaton */ 655*7c478bd9Sstevel@tonic-gate __nis_index_t index; 656*7c478bd9Sstevel@tonic-gate void *next; /* Next sub-set spec */ 657*7c478bd9Sstevel@tonic-gate void *seqNext; /* Next in config sequence */ 658*7c478bd9Sstevel@tonic-gate int numColumns; 659*7c478bd9Sstevel@tonic-gate char **column; 660*7c478bd9Sstevel@tonic-gate time_t initTtlLo; 661*7c478bd9Sstevel@tonic-gate time_t initTtlHi; 662*7c478bd9Sstevel@tonic-gate time_t ttl; 663*7c478bd9Sstevel@tonic-gate char commentChar; 664*7c478bd9Sstevel@tonic-gate __nis_object_dn_t *objectDN; 665*7c478bd9Sstevel@tonic-gate int numSplits; 666*7c478bd9Sstevel@tonic-gate char *separatorStr; 667*7c478bd9Sstevel@tonic-gate int usedns_flag; 668*7c478bd9Sstevel@tonic-gate int securemap_flag; 669*7c478bd9Sstevel@tonic-gate __nis_mapping_element_t *e; 670*7c478bd9Sstevel@tonic-gate int numRulesFromLDAP; 671*7c478bd9Sstevel@tonic-gate __nis_mapping_rule_t **ruleFromLDAP; 672*7c478bd9Sstevel@tonic-gate int numRulesToLDAP; 673*7c478bd9Sstevel@tonic-gate __nis_mapping_rule_t **ruleToLDAP; 674*7c478bd9Sstevel@tonic-gate /* 675*7c478bd9Sstevel@tonic-gate * The following fields contain information about the mapped object. 676*7c478bd9Sstevel@tonic-gate */ 677*7c478bd9Sstevel@tonic-gate zotypes objType; 678*7c478bd9Sstevel@tonic-gate char *objName; /* FQ object name */ 679*7c478bd9Sstevel@tonic-gate char *objPath; /* nisdb's internal name */ 680*7c478bd9Sstevel@tonic-gate nis_object *obj; /* NIS+ object */ 681*7c478bd9Sstevel@tonic-gate int isMaster; /* Master for this object ? */ 682*7c478bd9Sstevel@tonic-gate int seq_num; 683*7c478bd9Sstevel@tonic-gate } __nis_table_mapping_t; 684*7c478bd9Sstevel@tonic-gate 685*7c478bd9Sstevel@tonic-gate /* End object mappings */ 686*7c478bd9Sstevel@tonic-gate 687*7c478bd9Sstevel@tonic-gate /* Default config file paths */ 688*7c478bd9Sstevel@tonic-gate #define DEFAULTCONFFILE "/var/nis/NIS+LDAPmapping" 689*7c478bd9Sstevel@tonic-gate #define ETCCONFFILE "/etc/default/rpc.nisd" 690*7c478bd9Sstevel@tonic-gate #define YP_DEFAULTCONFFILE NTOL_MAP_FILE 691*7c478bd9Sstevel@tonic-gate #define YP_ETCCONFFILE NTOL_CONFIG_FILE 692*7c478bd9Sstevel@tonic-gate 693*7c478bd9Sstevel@tonic-gate /* Path to the root object dir file */ 694*7c478bd9Sstevel@tonic-gate #define ROOTDIRFILE "/var/nis/data/root_dir" 695*7c478bd9Sstevel@tonic-gate /* Path to the root object file */ 696*7c478bd9Sstevel@tonic-gate #define ROOTOBJFILE "/var/nis/data/root.object" 697*7c478bd9Sstevel@tonic-gate 698*7c478bd9Sstevel@tonic-gate extern __nis_table_mapping_t *ldapMappingSeq; 699*7c478bd9Sstevel@tonic-gate extern int yp2ldap; 700*7c478bd9Sstevel@tonic-gate 701*7c478bd9Sstevel@tonic-gate /* Exported functions */ 702*7c478bd9Sstevel@tonic-gate int parseConfig(char **ldapCLA, char *ldapConfFile); 703*7c478bd9Sstevel@tonic-gate int linked2hash(__nis_table_mapping_t *tlist); 704*7c478bd9Sstevel@tonic-gate int dbids2objs(__nis_hash_table_mt *objs, 705*7c478bd9Sstevel@tonic-gate __nis_hash_table_mt *dbids); 706*7c478bd9Sstevel@tonic-gate void __make_legal(char *s); 707*7c478bd9Sstevel@tonic-gate char *internal_table_name(nis_name name, char *res); 708*7c478bd9Sstevel@tonic-gate nis_name relative_name(char *s); 709*7c478bd9Sstevel@tonic-gate char *internalTableName(char *name); 710*7c478bd9Sstevel@tonic-gate __nis_table_mapping_t *getObjMapping(char *name, char *intNameArg, 711*7c478bd9Sstevel@tonic-gate int asObj, 712*7c478bd9Sstevel@tonic-gate int *doRead, int *doWrite); 713*7c478bd9Sstevel@tonic-gate 714*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 715*7c478bd9Sstevel@tonic-gate } 716*7c478bd9Sstevel@tonic-gate #endif /* __cplusplus */ 717*7c478bd9Sstevel@tonic-gate 718*7c478bd9Sstevel@tonic-gate #endif /* _LDAP_PARSE_H */ 719