17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _LDAP_PARSE_H 287c478bd9Sstevel@tonic-gate #define _LDAP_PARSE_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #include <lber.h> 317c478bd9Sstevel@tonic-gate #include <ldap.h> 327c478bd9Sstevel@tonic-gate #include <rpcsvc/nis.h> 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #include "nis_hashitem.h" 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* Pick up N2L file names */ 377c478bd9Sstevel@tonic-gate #include <ndbm.h> 387c478bd9Sstevel@tonic-gate #include "yptol/shim.h" 397c478bd9Sstevel@tonic-gate #include "yptol/yptol.h" 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #ifdef __cplusplus 427c478bd9Sstevel@tonic-gate extern "C" { 437c478bd9Sstevel@tonic-gate #endif 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate /* 467c478bd9Sstevel@tonic-gate * New <ldap.h> doesn't define LDAP_SCOPE_UNKNOWN, but we still need it. 477c478bd9Sstevel@tonic-gate */ 487c478bd9Sstevel@tonic-gate #ifndef LDAP_SCOPE_UNKNOWN 497c478bd9Sstevel@tonic-gate #define LDAP_SCOPE_UNKNOWN 0xFF 507c478bd9Sstevel@tonic-gate #endif 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate /* Attribute/value hash list element */ 537c478bd9Sstevel@tonic-gate typedef struct { 547c478bd9Sstevel@tonic-gate __nis_hash_item_mt item; /* item.name is the attr name */ 557c478bd9Sstevel@tonic-gate int numValues; 567c478bd9Sstevel@tonic-gate char **value; /* Array of values */ 577c478bd9Sstevel@tonic-gate bool_t isDefault; /* True if value is a default */ 587c478bd9Sstevel@tonic-gate } __nis_ldap_attribute_t; 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate /* YP Domains structure */ 617c478bd9Sstevel@tonic-gate typedef struct { 627c478bd9Sstevel@tonic-gate int numDomains; /* number of domains listed in mapping file */ 637c478bd9Sstevel@tonic-gate char **domainLabels; /* the labels for particular domain names */ 647c478bd9Sstevel@tonic-gate char **domains; /* Array of LDAP domains */ 657c478bd9Sstevel@tonic-gate int numYppasswdd; /* Number of yppasswddDomainLabels */ 667c478bd9Sstevel@tonic-gate char **yppasswddDomainLabels; /* yppasswdd domain labels */ 677c478bd9Sstevel@tonic-gate } __yp_domain_context_t; 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate /* 707c478bd9Sstevel@tonic-gate * Begin object mappings 717c478bd9Sstevel@tonic-gate * 727c478bd9Sstevel@tonic-gate * Note that the definitions, where necessary, proceed from the bottom 737c478bd9Sstevel@tonic-gate * (i.e., the "atomic" components) up. 747c478bd9Sstevel@tonic-gate */ 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate /* 777c478bd9Sstevel@tonic-gate * String match/print descriptor 787c478bd9Sstevel@tonic-gate * 797c478bd9Sstevel@tonic-gate * Intended for use together with a __nis_mapping_match_type_t, which will 807c478bd9Sstevel@tonic-gate * determine which field of the union is valid. 817c478bd9Sstevel@tonic-gate * 827c478bd9Sstevel@tonic-gate * string Pointer to a NUL-terminated string 837c478bd9Sstevel@tonic-gate * single Represents a single-character match such as '[a-bTe-w]', 847c478bd9Sstevel@tonic-gate * which would become 857c478bd9Sstevel@tonic-gate * { 867c478bd9Sstevel@tonic-gate * 3, numRange 877c478bd9Sstevel@tonic-gate * {'a', 'T', 'e'}, lo 887c478bd9Sstevel@tonic-gate * {'b', 'T', 'w'} hi 897c478bd9Sstevel@tonic-gate * } 907c478bd9Sstevel@tonic-gate * Each pair lo[i]/hi[i] (0 <= i < numRange) defines the 917c478bd9Sstevel@tonic-gate * range of the wild-card match. 927c478bd9Sstevel@tonic-gate * limit No use currrently defined; will probably be removed 937c478bd9Sstevel@tonic-gate * berString Pointer to a string containing a single formatting 947c478bd9Sstevel@tonic-gate * character as defined by ber_printf(3LDAP). Example: "i" 957c478bd9Sstevel@tonic-gate * for a binary integer. 967c478bd9Sstevel@tonic-gate */ 977c478bd9Sstevel@tonic-gate typedef union { 987c478bd9Sstevel@tonic-gate char *string; 997c478bd9Sstevel@tonic-gate struct { 1007c478bd9Sstevel@tonic-gate int numRange; 1017c478bd9Sstevel@tonic-gate unsigned char *lo; /* Array of numRange elements */ 1027c478bd9Sstevel@tonic-gate unsigned char *hi; /* Array of numRange elements */ 1037c478bd9Sstevel@tonic-gate } single; 1047c478bd9Sstevel@tonic-gate enum { 1057c478bd9Sstevel@tonic-gate bos, 1067c478bd9Sstevel@tonic-gate eos 1077c478bd9Sstevel@tonic-gate } limit; 1087c478bd9Sstevel@tonic-gate char *berString; 1097c478bd9Sstevel@tonic-gate } __nis_mapping_match_t; 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate /* 1127c478bd9Sstevel@tonic-gate * String match/print types and descriptor 1137c478bd9Sstevel@tonic-gate * 1147c478bd9Sstevel@tonic-gate * Used to describe print or match conversions. The 'match' field has 1157c478bd9Sstevel@tonic-gate * the following interpretation: 1167c478bd9Sstevel@tonic-gate * 1177c478bd9Sstevel@tonic-gate * Type __nis_mapping_match_t Comment 1187c478bd9Sstevel@tonic-gate * 1197c478bd9Sstevel@tonic-gate * mmt_item <unused> Value as indicated by corresponding 1207c478bd9Sstevel@tonic-gate * element in __nis_mapping_item_t or 1217c478bd9Sstevel@tonic-gate * __nis_mapping_sub_element_t array 1227c478bd9Sstevel@tonic-gate * mmt_string string 1237c478bd9Sstevel@tonic-gate * mmt_single single 1247c478bd9Sstevel@tonic-gate * mmt_limit limit Probably not needed 1257c478bd9Sstevel@tonic-gate * mmt_any <unused> Match any number of any character 1267c478bd9Sstevel@tonic-gate * mmt_berstring berString 1277c478bd9Sstevel@tonic-gate * mmt_begin <unused> Indicates beginning of format; optional 1287c478bd9Sstevel@tonic-gate * mmt_end <unused> Indicates end of format; REQUIRED to 1297c478bd9Sstevel@tonic-gate * mark the end of an array of 1307c478bd9Sstevel@tonic-gate * __nis_mapping_format_t's 1317c478bd9Sstevel@tonic-gate */ 1327c478bd9Sstevel@tonic-gate typedef enum {mmt_item, mmt_string, mmt_single, mmt_limit, mmt_any, 1337c478bd9Sstevel@tonic-gate mmt_berstring, mmt_begin, mmt_end} 1347c478bd9Sstevel@tonic-gate __nis_mapping_match_type_t; 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate typedef struct { 1377c478bd9Sstevel@tonic-gate __nis_mapping_match_type_t type; 1387c478bd9Sstevel@tonic-gate __nis_mapping_match_t match; 1397c478bd9Sstevel@tonic-gate } __nis_mapping_format_t; 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate /* Forward */ 1427c478bd9Sstevel@tonic-gate struct __nis_mapping_element_struct; 1437c478bd9Sstevel@tonic-gate struct __nis_mapping_item_struct; 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate /* 1467c478bd9Sstevel@tonic-gate * LDAP search triple 1477c478bd9Sstevel@tonic-gate * 1487c478bd9Sstevel@tonic-gate * Used to represent a search triple like 1497c478bd9Sstevel@tonic-gate * ou=Group,?one?cn=staff 1507c478bd9Sstevel@tonic-gate * or 1517c478bd9Sstevel@tonic-gate * ou=Group,?one?(&(cn=staff)(gidNumber=10)) 1527c478bd9Sstevel@tonic-gate * or 1537c478bd9Sstevel@tonic-gate * ou=Hosts,?one?("cn=%s", (cname, "%s.*")) 1547c478bd9Sstevel@tonic-gate * 1557c478bd9Sstevel@tonic-gate * base The base DN; defaultSearchBase appended if 'base' ends with 1567c478bd9Sstevel@tonic-gate * a comma. 1577c478bd9Sstevel@tonic-gate * scope One of LDAP_SCOPE_BASE, LDAP_SCOPE_ONELEVEL, or 1587c478bd9Sstevel@tonic-gate * LDAP_SCOPE_SUBTREE; LDAP_SCOPE_UNKNOWN means that this 1597c478bd9Sstevel@tonic-gate * __nis_search_triple_t is inactive 1607c478bd9Sstevel@tonic-gate * attrs Either a filter, or a list of attribute/value pairs, depending 1617c478bd9Sstevel@tonic-gate * on context. 1627c478bd9Sstevel@tonic-gate * element Pointer to a value element. If 'element' is non-NULL, the 1637c478bd9Sstevel@tonic-gate * 'attrs' value is derived by evaluating 'element'. 1647c478bd9Sstevel@tonic-gate */ 1657c478bd9Sstevel@tonic-gate typedef struct { 1667c478bd9Sstevel@tonic-gate char *base; 1677c478bd9Sstevel@tonic-gate int scope; 1687c478bd9Sstevel@tonic-gate char *attrs; 1697c478bd9Sstevel@tonic-gate struct __nis_mapping_element_struct *element; 1707c478bd9Sstevel@tonic-gate } __nis_search_triple_t; 1717c478bd9Sstevel@tonic-gate 1727c478bd9Sstevel@tonic-gate /* 1737c478bd9Sstevel@tonic-gate * NIS+ index spec 1747c478bd9Sstevel@tonic-gate * 1757c478bd9Sstevel@tonic-gate * Represents a NIS+ index list, such as 1767c478bd9Sstevel@tonic-gate * name=staff,gid=10 1777c478bd9Sstevel@tonic-gate * 1787c478bd9Sstevel@tonic-gate * numIndexes The number of entries in the 'name'/'value' arrays 1797c478bd9Sstevel@tonic-gate * name Array of column names 1807c478bd9Sstevel@tonic-gate * value Array of column values; uses __nis_mapping_format_t so that 1817c478bd9Sstevel@tonic-gate * wild-cards can be represented 1827c478bd9Sstevel@tonic-gate * 1837c478bd9Sstevel@tonic-gate * Example 1847c478bd9Sstevel@tonic-gate * name=staff,gid=10 1857c478bd9Sstevel@tonic-gate * 2, numIndexes 1867c478bd9Sstevel@tonic-gate * { name 1877c478bd9Sstevel@tonic-gate * "name", 1887c478bd9Sstevel@tonic-gate * "gid" 1897c478bd9Sstevel@tonic-gate * }, 1907c478bd9Sstevel@tonic-gate * { value 1917c478bd9Sstevel@tonic-gate * { 1927c478bd9Sstevel@tonic-gate * {mmt_begin}, 1937c478bd9Sstevel@tonic-gate * {mmt_string, "staff"}, 1947c478bd9Sstevel@tonic-gate * {mmt_end} 1957c478bd9Sstevel@tonic-gate * }, 1967c478bd9Sstevel@tonic-gate * { 1977c478bd9Sstevel@tonic-gate * {mmt_begin}, 1987c478bd9Sstevel@tonic-gate * {mmt_string, "gid"}, 1997c478bd9Sstevel@tonic-gate * {mmt_end} 2007c478bd9Sstevel@tonic-gate * } 2017c478bd9Sstevel@tonic-gate * } 2027c478bd9Sstevel@tonic-gate */ 2037c478bd9Sstevel@tonic-gate typedef struct { 2047c478bd9Sstevel@tonic-gate int numIndexes; 2057c478bd9Sstevel@tonic-gate char **name; 2067c478bd9Sstevel@tonic-gate __nis_mapping_format_t **value; 2077c478bd9Sstevel@tonic-gate } __nis_index_t; 2087c478bd9Sstevel@tonic-gate 2097c478bd9Sstevel@tonic-gate /* What to do with the LDAP data when a NIS+ entry is deleted */ 2107c478bd9Sstevel@tonic-gate typedef enum {dd_always, dd_perDbId, dd_never} __nis_delete_disp_t; 2117c478bd9Sstevel@tonic-gate 2127c478bd9Sstevel@tonic-gate /* Type of an element in a mapping rule */ 2137c478bd9Sstevel@tonic-gate typedef enum {me_item, me_print, me_split, me_match, me_extract} 2147c478bd9Sstevel@tonic-gate __nis_mapping_element_type_t; 2157c478bd9Sstevel@tonic-gate 2167c478bd9Sstevel@tonic-gate /* Type of an item in a mapping rule */ 2177c478bd9Sstevel@tonic-gate typedef enum {mit_any, mit_nisplus, mit_ldap} __nis_mapping_item_type_t; 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate /* 2207c478bd9Sstevel@tonic-gate * NIS+ object name, with index 2217c478bd9Sstevel@tonic-gate * 2227c478bd9Sstevel@tonic-gate * Used to represent a name like 2237c478bd9Sstevel@tonic-gate * [name = staff, gid = 10]group.org_dir 2247c478bd9Sstevel@tonic-gate * (Note: spaces around "=" and after "," to make cstyle happy; such spaces 2257c478bd9Sstevel@tonic-gate * are not usually part of the syntax, but they are allowed.) 2267c478bd9Sstevel@tonic-gate * 2277c478bd9Sstevel@tonic-gate * index The index part of the name. numIndexes == 0 means there is 2287c478bd9Sstevel@tonic-gate * no index. 2297c478bd9Sstevel@tonic-gate * name The object name proper. If it doesn't end in a dot, the 2307c478bd9Sstevel@tonic-gate * nisplusLDAPbaseDomain is appended. 2317c478bd9Sstevel@tonic-gate */ 2327c478bd9Sstevel@tonic-gate typedef struct { 2337c478bd9Sstevel@tonic-gate __nis_index_t index; 2347c478bd9Sstevel@tonic-gate char *name; 2357c478bd9Sstevel@tonic-gate } __nis_obj_spec_t; 2367c478bd9Sstevel@tonic-gate 2377c478bd9Sstevel@tonic-gate /* 2387c478bd9Sstevel@tonic-gate * Complete representation of a subset of either the DIT or a NIS+ object. 2397c478bd9Sstevel@tonic-gate * Intended for use in a __nis_mapping_item_t, where the 'type' field 2407c478bd9Sstevel@tonic-gate * determines which field of the __nis_triple_or_obj_t is active. 2417c478bd9Sstevel@tonic-gate */ 2427c478bd9Sstevel@tonic-gate typedef union { 2437c478bd9Sstevel@tonic-gate __nis_search_triple_t triple; 2447c478bd9Sstevel@tonic-gate __nis_obj_spec_t obj; 2457c478bd9Sstevel@tonic-gate } __nis_triple_or_obj_t; 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate /* 2487c478bd9Sstevel@tonic-gate * Mapping item 2497c478bd9Sstevel@tonic-gate * 2507c478bd9Sstevel@tonic-gate * The mapping item is a single LDAP attribute, or a NIS+ table column, such as 2517c478bd9Sstevel@tonic-gate * ldap:gidNumber:ou=Group, ?one?cn=staff 2527c478bd9Sstevel@tonic-gate * or 2537c478bd9Sstevel@tonic-gate * nisplus:gid[name = staff]group.org_dir 2547c478bd9Sstevel@tonic-gate * (Note: spaces around "=" and after "," to make cstyle happy; such spaces 2557c478bd9Sstevel@tonic-gate * are not usually part of the syntax, but they are allowed.) 2567c478bd9Sstevel@tonic-gate * 2577c478bd9Sstevel@tonic-gate * type mit_ldap or mit_nisplus 2587c478bd9Sstevel@tonic-gate * name Attribute/column name 2597c478bd9Sstevel@tonic-gate * searchSpec LDAP search triple, or NIS+ indexed object name 2607c478bd9Sstevel@tonic-gate * repeat True if item should be repeated if necessary. This is used 2617c478bd9Sstevel@tonic-gate * to represent implied lists, such as '(memberUid)', which 2627c478bd9Sstevel@tonic-gate * denotes all values of the 'memberUid' attribute. 2637c478bd9Sstevel@tonic-gate * exItem forward mapping item for supporting removespec syntax. 2647c478bd9Sstevel@tonic-gate * 2657c478bd9Sstevel@tonic-gate */ 2667c478bd9Sstevel@tonic-gate typedef struct __nis_mapping_item_struct { 2677c478bd9Sstevel@tonic-gate __nis_mapping_item_type_t type; 2687c478bd9Sstevel@tonic-gate char *name; 2697c478bd9Sstevel@tonic-gate __nis_triple_or_obj_t searchSpec; 2707c478bd9Sstevel@tonic-gate bool_t repeat; 2717c478bd9Sstevel@tonic-gate struct __nis_mapping_item_struct *exItem; 2727c478bd9Sstevel@tonic-gate } __nis_mapping_item_t; 2737c478bd9Sstevel@tonic-gate 2747c478bd9Sstevel@tonic-gate /* 2757c478bd9Sstevel@tonic-gate * Sub-element of a mapping rule element 2767c478bd9Sstevel@tonic-gate * 2777c478bd9Sstevel@tonic-gate * Each element/sub-element represents the value(s) derived according to 2787c478bd9Sstevel@tonic-gate * the semantics of the element. Although not explicitly represented here, 2797c478bd9Sstevel@tonic-gate * values are either strings or BER byte sequences. 2807c478bd9Sstevel@tonic-gate * 2817c478bd9Sstevel@tonic-gate * type Type of the 'element' union 2827c478bd9Sstevel@tonic-gate * element.item A single item 2837c478bd9Sstevel@tonic-gate * element.print printf(3C)-style value 2847c478bd9Sstevel@tonic-gate * fmt Array of formatting elements, terminated by 'mmt_end' 2857c478bd9Sstevel@tonic-gate * numItems Number of items in the 'item' array 2867c478bd9Sstevel@tonic-gate * item Array of 'numItems' items 2877c478bd9Sstevel@tonic-gate * doElide Should the last character of the (string) value be 2887c478bd9Sstevel@tonic-gate * removed ? 2897c478bd9Sstevel@tonic-gate * elide Character to be removed 2907c478bd9Sstevel@tonic-gate * element.split Item value string split into multiple values 2917c478bd9Sstevel@tonic-gate * item A single item 2927c478bd9Sstevel@tonic-gate * delim The separator character for the split 2937c478bd9Sstevel@tonic-gate * element.extract Extraction of a sub-string from an item value 2947c478bd9Sstevel@tonic-gate * fmt Array of formatting elements, terminated by 'mmt_end' 2957c478bd9Sstevel@tonic-gate * item A single item 2967c478bd9Sstevel@tonic-gate * 2977c478bd9Sstevel@tonic-gate * Examples (see __nis_mapping_element_t below for examples using the 'item' 2987c478bd9Sstevel@tonic-gate * field of __nis_mapping_sub_element_t). For notational convenience, 2997c478bd9Sstevel@tonic-gate * __nis_mapping_item_t's are shortened to just the item name. 3007c478bd9Sstevel@tonic-gate * 3017c478bd9Sstevel@tonic-gate * (1) String value consisting of the string "{crypt}" followed by the 302*bbf21555SRichard Lowe * value of the 'passwd' column. The NIS+LDAPmapping(5) representation 3037c478bd9Sstevel@tonic-gate * is 3047c478bd9Sstevel@tonic-gate * ("{crypt}%s", passwd) 3057c478bd9Sstevel@tonic-gate * and the element.print contains 3067c478bd9Sstevel@tonic-gate * { fmt 3077c478bd9Sstevel@tonic-gate * {mmt_begin}, 3087c478bd9Sstevel@tonic-gate * {mmt_string, "{crypt}"}, 3097c478bd9Sstevel@tonic-gate * {mmt_item}, 3107c478bd9Sstevel@tonic-gate * {mmt_end} 3117c478bd9Sstevel@tonic-gate * }, 3127c478bd9Sstevel@tonic-gate * 1, numItems 3137c478bd9Sstevel@tonic-gate * { item 3147c478bd9Sstevel@tonic-gate * {"passwd"} 3157c478bd9Sstevel@tonic-gate * } 3167c478bd9Sstevel@tonic-gate * FALSE, doElide 3177c478bd9Sstevel@tonic-gate * '\0' elide (unused) 3187c478bd9Sstevel@tonic-gate * 3197c478bd9Sstevel@tonic-gate * (2) Split a value such as "member1,member2,member3" into multiple 3207c478bd9Sstevel@tonic-gate * (three, here) values using ',' as the separator. 3217c478bd9Sstevel@tonic-gate * (members, ",") 3227c478bd9Sstevel@tonic-gate * element.split 3237c478bd9Sstevel@tonic-gate * {"members"}, item 3247c478bd9Sstevel@tonic-gate * ',' delim 3257c478bd9Sstevel@tonic-gate * 3267c478bd9Sstevel@tonic-gate * (3) Given a 'cname' column with the value "some.dom.ain.", extract 3277c478bd9Sstevel@tonic-gate * "some", which becomes the value of the expression. 3287c478bd9Sstevel@tonic-gate * (cname, "%s.*") 3297c478bd9Sstevel@tonic-gate * element.extract 3307c478bd9Sstevel@tonic-gate * { fmt 3317c478bd9Sstevel@tonic-gate * {mmt_begin}, 3327c478bd9Sstevel@tonic-gate * {mmt_item}, 3337c478bd9Sstevel@tonic-gate * {mmt_string, "."}, 3347c478bd9Sstevel@tonic-gate * {mmt_any}, 3357c478bd9Sstevel@tonic-gate * {mmt_end} 3367c478bd9Sstevel@tonic-gate * }, 3377c478bd9Sstevel@tonic-gate * {"cname"} item 3387c478bd9Sstevel@tonic-gate */ 3397c478bd9Sstevel@tonic-gate typedef struct { 3407c478bd9Sstevel@tonic-gate __nis_mapping_element_type_t type; 3417c478bd9Sstevel@tonic-gate union { 3427c478bd9Sstevel@tonic-gate __nis_mapping_item_t item; 3437c478bd9Sstevel@tonic-gate struct { 3447c478bd9Sstevel@tonic-gate __nis_mapping_format_t *fmt; 3457c478bd9Sstevel@tonic-gate int numItems; 3467c478bd9Sstevel@tonic-gate __nis_mapping_item_t *item; 3477c478bd9Sstevel@tonic-gate bool_t doElide; 3487c478bd9Sstevel@tonic-gate unsigned char elide; 3497c478bd9Sstevel@tonic-gate } print; 3507c478bd9Sstevel@tonic-gate struct { 3517c478bd9Sstevel@tonic-gate __nis_mapping_item_t item; 3527c478bd9Sstevel@tonic-gate unsigned char delim; 3537c478bd9Sstevel@tonic-gate } split; 3547c478bd9Sstevel@tonic-gate struct { 3557c478bd9Sstevel@tonic-gate __nis_mapping_format_t *fmt; 3567c478bd9Sstevel@tonic-gate __nis_mapping_item_t item; 3577c478bd9Sstevel@tonic-gate } extract; 3587c478bd9Sstevel@tonic-gate } element; 3597c478bd9Sstevel@tonic-gate } __nis_mapping_sub_element_t; 3607c478bd9Sstevel@tonic-gate 3617c478bd9Sstevel@tonic-gate /* 3627c478bd9Sstevel@tonic-gate * Mapping rule element 3637c478bd9Sstevel@tonic-gate * 3647c478bd9Sstevel@tonic-gate * Each element/sub-element represents the value(s) derived according to 3657c478bd9Sstevel@tonic-gate * the semantics of the element. Although not explicitly represented here, 3667c478bd9Sstevel@tonic-gate * values are either strings or BER byte sequences. 3677c478bd9Sstevel@tonic-gate * 3687c478bd9Sstevel@tonic-gate * type Type of the 'element' union 3697c478bd9Sstevel@tonic-gate * element.item A single item 3707c478bd9Sstevel@tonic-gate * element.print printf(3C)-style value 3717c478bd9Sstevel@tonic-gate * fmt Array of formatting elements, terminated by 'mmt_end' 3727c478bd9Sstevel@tonic-gate * numSubElements Number of sub-elements in the 'subElement' array 3737c478bd9Sstevel@tonic-gate * subElement Array of 'numSubElements' sub-elements 3747c478bd9Sstevel@tonic-gate * doElide Should the last character of the (string) value(s) be 3757c478bd9Sstevel@tonic-gate * removed ? 3767c478bd9Sstevel@tonic-gate * elide Character to be removed 3777c478bd9Sstevel@tonic-gate * element.split Item value string split into multiple values 3787c478bd9Sstevel@tonic-gate * item A single item 3797c478bd9Sstevel@tonic-gate * delim The separator character for the split 3807c478bd9Sstevel@tonic-gate * element.match Assignment of item values by matching to a format 3817c478bd9Sstevel@tonic-gate * fmt Array of formatting elements, terminated by 'mmt_end' 3827c478bd9Sstevel@tonic-gate * numItems Number of items in the 'item' array 3837c478bd9Sstevel@tonic-gate * item Array of 'numItems' items 3847c478bd9Sstevel@tonic-gate * element.extract Extraction of a sub-string from an item value 3857c478bd9Sstevel@tonic-gate * fmt Array of formatting elements, terminated by 'mmt_end' 3867c478bd9Sstevel@tonic-gate * item A single item 3877c478bd9Sstevel@tonic-gate * 3887c478bd9Sstevel@tonic-gate * Examples; items represented by just the item name. 3897c478bd9Sstevel@tonic-gate * 3907c478bd9Sstevel@tonic-gate * (1) The value of the 'name' column. 3917c478bd9Sstevel@tonic-gate * name 3927c478bd9Sstevel@tonic-gate * element.item 3937c478bd9Sstevel@tonic-gate * {"name"} item 3947c478bd9Sstevel@tonic-gate * 3957c478bd9Sstevel@tonic-gate * (2) Example (1) for a sub-element showed how to construct a value from 3967c478bd9Sstevel@tonic-gate * a printf(3C)-style format string and one or more item values. 3977c478bd9Sstevel@tonic-gate * However that example is only valid when used as a sub-expression 3987c478bd9Sstevel@tonic-gate * (in place of an item in a 'print' list, for example). If 3997c478bd9Sstevel@tonic-gate * ("{crypt}%s", passwd) 4007c478bd9Sstevel@tonic-gate * was part of a rule like 4017c478bd9Sstevel@tonic-gate * userPassword=("{crypt}%s", passwd) 4027c478bd9Sstevel@tonic-gate * the representation would use a __nis_mapping_element_t as follows. 4037c478bd9Sstevel@tonic-gate * element.print 4047c478bd9Sstevel@tonic-gate * { fmt 4057c478bd9Sstevel@tonic-gate * {mmt_begin}, 4067c478bd9Sstevel@tonic-gate * {mmt_string, "{crypt}"}, 4077c478bd9Sstevel@tonic-gate * {mmt_item}, 4087c478bd9Sstevel@tonic-gate * {mmt_end} 4097c478bd9Sstevel@tonic-gate * }, 4107c478bd9Sstevel@tonic-gate * 1, numSubElements 4117c478bd9Sstevel@tonic-gate * { subElement 4127c478bd9Sstevel@tonic-gate * me_item, type 4137c478bd9Sstevel@tonic-gate * {"passwd"} item 4147c478bd9Sstevel@tonic-gate * }, 4157c478bd9Sstevel@tonic-gate * FALSE, doElide 4167c478bd9Sstevel@tonic-gate * '\0' elide (unused) 4177c478bd9Sstevel@tonic-gate * 4187c478bd9Sstevel@tonic-gate * (3) Match a value such as "{dh-1024}abcdef000234" to a template format 4197c478bd9Sstevel@tonic-gate * "{%s}%s", assign "dh-1024" to the 'auth_type' column, and 4207c478bd9Sstevel@tonic-gate * "abcdef000234" to the 'public_data' column. 4217c478bd9Sstevel@tonic-gate * ("{%s}%s", auth_type, public_data) 4227c478bd9Sstevel@tonic-gate * element.match 4237c478bd9Sstevel@tonic-gate * { fmt 4247c478bd9Sstevel@tonic-gate * {mmt_begin}, 4257c478bd9Sstevel@tonic-gate * {mmt_string, "{"}, 4267c478bd9Sstevel@tonic-gate * {mmt_item}, 4277c478bd9Sstevel@tonic-gate * {mmt_string, "}"}, 4287c478bd9Sstevel@tonic-gate * {mmt_item}, 4297c478bd9Sstevel@tonic-gate * {mmt_end} 4307c478bd9Sstevel@tonic-gate * } 4317c478bd9Sstevel@tonic-gate * 2, numItems 4327c478bd9Sstevel@tonic-gate * { item 4337c478bd9Sstevel@tonic-gate * {"auth_type"}, 4347c478bd9Sstevel@tonic-gate * {"public_data"} 4357c478bd9Sstevel@tonic-gate * } 4367c478bd9Sstevel@tonic-gate */ 4377c478bd9Sstevel@tonic-gate typedef struct __nis_mapping_element_struct { 4387c478bd9Sstevel@tonic-gate __nis_mapping_element_type_t type; 4397c478bd9Sstevel@tonic-gate union { 4407c478bd9Sstevel@tonic-gate __nis_mapping_item_t item; 4417c478bd9Sstevel@tonic-gate struct { 4427c478bd9Sstevel@tonic-gate __nis_mapping_format_t *fmt; 4437c478bd9Sstevel@tonic-gate int numSubElements; 4447c478bd9Sstevel@tonic-gate __nis_mapping_sub_element_t *subElement; 4457c478bd9Sstevel@tonic-gate bool_t doElide; 4467c478bd9Sstevel@tonic-gate unsigned char elide; 4477c478bd9Sstevel@tonic-gate } print; 4487c478bd9Sstevel@tonic-gate struct { 4497c478bd9Sstevel@tonic-gate __nis_mapping_item_t item; 4507c478bd9Sstevel@tonic-gate unsigned char delim; 4517c478bd9Sstevel@tonic-gate } split; 4527c478bd9Sstevel@tonic-gate struct { 4537c478bd9Sstevel@tonic-gate __nis_mapping_format_t *fmt; 4547c478bd9Sstevel@tonic-gate int numItems; 4557c478bd9Sstevel@tonic-gate __nis_mapping_item_t *item; 4567c478bd9Sstevel@tonic-gate } match; 4577c478bd9Sstevel@tonic-gate struct { 4587c478bd9Sstevel@tonic-gate __nis_mapping_format_t *fmt; 4597c478bd9Sstevel@tonic-gate __nis_mapping_item_t item; 4607c478bd9Sstevel@tonic-gate } extract; 4617c478bd9Sstevel@tonic-gate } element; 4627c478bd9Sstevel@tonic-gate } __nis_mapping_element_t; 4637c478bd9Sstevel@tonic-gate 4647c478bd9Sstevel@tonic-gate /* 4657c478bd9Sstevel@tonic-gate * One side (left or right) of a mapping rule 4667c478bd9Sstevel@tonic-gate * 4677c478bd9Sstevel@tonic-gate * Example 4687c478bd9Sstevel@tonic-gate * The rule 4697c478bd9Sstevel@tonic-gate * userPassword=("{crypt}%s", passwd) 4707c478bd9Sstevel@tonic-gate * would be reprsented by a __nis_mapping_rule_t as follows 4717c478bd9Sstevel@tonic-gate * { lhs 4727c478bd9Sstevel@tonic-gate * 1, numElements 4737c478bd9Sstevel@tonic-gate * { element 4747c478bd9Sstevel@tonic-gate * me_item, 4757c478bd9Sstevel@tonic-gate * {"userPassword"} 4767c478bd9Sstevel@tonic-gate * } 4777c478bd9Sstevel@tonic-gate * }, 4787c478bd9Sstevel@tonic-gate * { rhs 4797c478bd9Sstevel@tonic-gate * 1, numElements 4807c478bd9Sstevel@tonic-gate * { element 4817c478bd9Sstevel@tonic-gate * me_print, 4827c478bd9Sstevel@tonic-gate * { 4837c478bd9Sstevel@tonic-gate * See example (2) under 4847c478bd9Sstevel@tonic-gate * __nis_mapping_element_t 4857c478bd9Sstevel@tonic-gate * above 4867c478bd9Sstevel@tonic-gate * } 4877c478bd9Sstevel@tonic-gate * } 4887c478bd9Sstevel@tonic-gate * } 4897c478bd9Sstevel@tonic-gate */ 4907c478bd9Sstevel@tonic-gate typedef struct { 4917c478bd9Sstevel@tonic-gate int numElements; 4927c478bd9Sstevel@tonic-gate __nis_mapping_element_t *element; 4937c478bd9Sstevel@tonic-gate } __nis_mapping_rlhs_t; 4947c478bd9Sstevel@tonic-gate 4957c478bd9Sstevel@tonic-gate /* A single mapping rule: attribute -> column or column -> attribute */ 4967c478bd9Sstevel@tonic-gate typedef struct { 4977c478bd9Sstevel@tonic-gate __nis_mapping_rlhs_t lhs; 4987c478bd9Sstevel@tonic-gate __nis_mapping_rlhs_t rhs; 4997c478bd9Sstevel@tonic-gate } __nis_mapping_rule_t; 5007c478bd9Sstevel@tonic-gate 5017c478bd9Sstevel@tonic-gate /* 5027c478bd9Sstevel@tonic-gate * Map (sub-set of) NIS+ object to location(s) in the LDAP DB 5037c478bd9Sstevel@tonic-gate * 5047c478bd9Sstevel@tonic-gate * read base/scope/filter triple used to read data from LDAP; 5057c478bd9Sstevel@tonic-gate * LDAP_SCOPE_UNKNOWN indicates that 'read' is unused 5067c478bd9Sstevel@tonic-gate * write base/scope/attrlist triple used to write data to LDAP; 5077c478bd9Sstevel@tonic-gate * LDAP_SCOPE_UNKNOWN indicates that 'write' is unused 5087c478bd9Sstevel@tonic-gate * delDisp What should happen to the LDAP entry when the corresponding 5097c478bd9Sstevel@tonic-gate * NIS+ data is deleted. 5107c478bd9Sstevel@tonic-gate * dbIdName The dbId for the delete rule set (if any) 5117c478bd9Sstevel@tonic-gate * numDbIds The number of rules in the 'dbId' rule set 5127c478bd9Sstevel@tonic-gate * dbId The delete rule set; this field must point to a valid 5137c478bd9Sstevel@tonic-gate * rule set if 'delDisp' is 'dd_perDbId'; ignored otherwise 5147c478bd9Sstevel@tonic-gate * next Pointer to the next __nis_object_dn_t structure for this 5157c478bd9Sstevel@tonic-gate * NIS+ object. 5167c478bd9Sstevel@tonic-gate * 5177c478bd9Sstevel@tonic-gate * Example 5187c478bd9Sstevel@tonic-gate * The "group.org_dir.x.y.z." NIS+ table should be read from and 5197c478bd9Sstevel@tonic-gate * written to the "ou=Group" container at "dc=x,dc=y,dc=z". Upon 5207c478bd9Sstevel@tonic-gate * NIS+ entry deletion, we should always attempt to delete the 5217c478bd9Sstevel@tonic-gate * corresponding LDAP attributes. 5227c478bd9Sstevel@tonic-gate * 5237c478bd9Sstevel@tonic-gate * { read 5247c478bd9Sstevel@tonic-gate * "ou=Group,dc=x,dc=y,dc=z", 5257c478bd9Sstevel@tonic-gate * LDAP_SCOPE_ONELEVEL, 5267c478bd9Sstevel@tonic-gate * "objectClass=posixGroup" 5277c478bd9Sstevel@tonic-gate * }, 5287c478bd9Sstevel@tonic-gate * { write 5297c478bd9Sstevel@tonic-gate * "ou=Group,dc=x,dc=y,dc=z", 5307c478bd9Sstevel@tonic-gate * LDAP_SCOPE_ONELEVEL, 5317c478bd9Sstevel@tonic-gate * "objectClass=posixGroup" 5327c478bd9Sstevel@tonic-gate * }, 5337c478bd9Sstevel@tonic-gate * dd_always, delDisp 5347c478bd9Sstevel@tonic-gate * NULL, dbIdName 5357c478bd9Sstevel@tonic-gate * 0, 5367c478bd9Sstevel@tonic-gate * NULL, dbId 5377c478bd9Sstevel@tonic-gate * NULL next 5387c478bd9Sstevel@tonic-gate */ 5397c478bd9Sstevel@tonic-gate typedef struct { 5407c478bd9Sstevel@tonic-gate __nis_search_triple_t read; 5417c478bd9Sstevel@tonic-gate __nis_search_triple_t write; 5427c478bd9Sstevel@tonic-gate __nis_delete_disp_t delDisp; 5437c478bd9Sstevel@tonic-gate char *dbIdName; 5447c478bd9Sstevel@tonic-gate int numDbIds; 5457c478bd9Sstevel@tonic-gate __nis_mapping_rule_t **dbId; /* Delete rule set */ 5467c478bd9Sstevel@tonic-gate void *next; 5477c478bd9Sstevel@tonic-gate } __nis_object_dn_t; 5487c478bd9Sstevel@tonic-gate 5497c478bd9Sstevel@tonic-gate /* 5507c478bd9Sstevel@tonic-gate * Per-dbId or -object mapping 5517c478bd9Sstevel@tonic-gate * 5527c478bd9Sstevel@tonic-gate * Initially collected per-dbId (so that item.name=dbId), the 5537c478bd9Sstevel@tonic-gate * __nis_table_mapping_t's are later stored per-object (whereupon 5547c478bd9Sstevel@tonic-gate * item.name=objName). 5557c478bd9Sstevel@tonic-gate * 5567c478bd9Sstevel@tonic-gate * item Structure used by the hash_item functions 5577c478bd9Sstevel@tonic-gate * dbId The dbId associated with the __nis_table_mapping_t 5587c478bd9Sstevel@tonic-gate * structure 5597c478bd9Sstevel@tonic-gate * index Object sub-set specification; only defined for 5607c478bd9Sstevel@tonic-gate * tables; index.numIndexes equal to zero means that 5617c478bd9Sstevel@tonic-gate * the 'index' is unused. 5627c478bd9Sstevel@tonic-gate * next Pointer to next table sub-set, if any 5637c478bd9Sstevel@tonic-gate * numColumns Number of columns if the object is a table 5647c478bd9Sstevel@tonic-gate * column Column names 5657c478bd9Sstevel@tonic-gate * initTtlLo Lower limit on the initial TTL 5667c478bd9Sstevel@tonic-gate * initTtlHi Upper limit on the initial TTL 5677c478bd9Sstevel@tonic-gate * ttl TTL set after refresh 5687c478bd9Sstevel@tonic-gate * commentChar NIS map comment character 5697c478bd9Sstevel@tonic-gate * objectDN Location in the LDAP DB 5707c478bd9Sstevel@tonic-gate * numSplits number of split fields 5717c478bd9Sstevel@tonic-gate * separatorStr separator string to break up NIS split field attributes 5727c478bd9Sstevel@tonic-gate * usedns_flag indicates if the -b option to makedbm is used for a map. 5737c478bd9Sstevel@tonic-gate * securemap_flag indicates if the -s option to makedbm is used for a map. 5747c478bd9Sstevel@tonic-gate * __nis_mapping_element_t Parsed format strings and name fields storage 5757c478bd9Sstevel@tonic-gate * numRulesFromLDAP Number of rules (and hence elements in the 5767c478bd9Sstevel@tonic-gate * 'ruleFromLDAP' array) for mapping LDAP entries 5777c478bd9Sstevel@tonic-gate * to NIS+ objects 5787c478bd9Sstevel@tonic-gate * ruleFromLDAP 5797c478bd9Sstevel@tonic-gate * numRulesToLDAP Number of rules (and hence elements in the 5807c478bd9Sstevel@tonic-gate * 'ruleToLDAP' array) for mapping NIS+ objects to 5817c478bd9Sstevel@tonic-gate * LDAP entries 5827c478bd9Sstevel@tonic-gate * ruleToLDAP 5837c478bd9Sstevel@tonic-gate * objType The NIS+ object type; NIS_BOGUS_OBJ used to indicate 5847c478bd9Sstevel@tonic-gate * not set (in which case the other object data fields 5857c478bd9Sstevel@tonic-gate * should be assumed to be invalid) 5867c478bd9Sstevel@tonic-gate * objName The fully qualified name of the NIS+ object 5877c478bd9Sstevel@tonic-gate * objPath The name used internally by libnisdb (which 5887c478bd9Sstevel@tonic-gate * is path to the data file for the table/directory 5897c478bd9Sstevel@tonic-gate * containing the object) 5907c478bd9Sstevel@tonic-gate * obj A copy of the object itself 5917c478bd9Sstevel@tonic-gate * isMaster Set if this machine is the master for the object 5927c478bd9Sstevel@tonic-gate * (actually for the directory containing it) 5937c478bd9Sstevel@tonic-gate * seq_num A sequence number representing the order of the maps 5947c478bd9Sstevel@tonic-gate * as listed in the NISLDAPmapping.template file. 5957c478bd9Sstevel@tonic-gate * 5967c478bd9Sstevel@tonic-gate * Example 5977c478bd9Sstevel@tonic-gate * Map the subset of the NIS+ 'group.org_dir.x.y.z.' table for which 5987c478bd9Sstevel@tonic-gate * is true that the 'name' starts with 'a' or 'o' to location per 5997c478bd9Sstevel@tonic-gate * the __nis_object_dn_t example above. No translation rules. 6007c478bd9Sstevel@tonic-gate * 6017c478bd9Sstevel@tonic-gate * { item 6027c478bd9Sstevel@tonic-gate * "group.org_dir.x.y.z." name 6037c478bd9Sstevel@tonic-gate * <omitted> 6047c478bd9Sstevel@tonic-gate * }, 6057c478bd9Sstevel@tonic-gate * "group_subset", dbId 6067c478bd9Sstevel@tonic-gate * 1, numIndexes 6077c478bd9Sstevel@tonic-gate * { index 6087c478bd9Sstevel@tonic-gate * 1, 6097c478bd9Sstevel@tonic-gate * {"name"}, 6107c478bd9Sstevel@tonic-gate * { 6117c478bd9Sstevel@tonic-gate * {mmt_begin}, 6127c478bd9Sstevel@tonic-gate * { 6137c478bd9Sstevel@tonic-gate * mmt_single, 6147c478bd9Sstevel@tonic-gate * 2, 6157c478bd9Sstevel@tonic-gate * {'a', 'o'}, 6167c478bd9Sstevel@tonic-gate * {'a', 'o'}, 6177c478bd9Sstevel@tonic-gate * } 6187c478bd9Sstevel@tonic-gate * {mmt_any}, 6197c478bd9Sstevel@tonic-gate * {mmt_end} 6207c478bd9Sstevel@tonic-gate * } 6217c478bd9Sstevel@tonic-gate * } 6227c478bd9Sstevel@tonic-gate * NULL, next 6237c478bd9Sstevel@tonic-gate * 4, numColumns 6247c478bd9Sstevel@tonic-gate * { column 6257c478bd9Sstevel@tonic-gate * "name", 6267c478bd9Sstevel@tonic-gate * "passwd", 6277c478bd9Sstevel@tonic-gate * "gid", 6287c478bd9Sstevel@tonic-gate * "members" 6297c478bd9Sstevel@tonic-gate * }, 6307c478bd9Sstevel@tonic-gate * 1800, initTtlLo 6317c478bd9Sstevel@tonic-gate * 5400, initTtlHi 6327c478bd9Sstevel@tonic-gate * 3600, ttl 6337c478bd9Sstevel@tonic-gate * '#', commentChar 6347c478bd9Sstevel@tonic-gate * <see __nis_object_dn_t example>, objectDN 6357c478bd9Sstevel@tonic-gate * 0, numSplits 6367c478bd9Sstevel@tonic-gate * NULL, separatorStr 6377c478bd9Sstevel@tonic-gate * 0, usedns_flag 6387c478bd9Sstevel@tonic-gate * 0, securemap_flag 6397c478bd9Sstevel@tonic-gate * <see __nis_mapping_element_t example>, e 6407c478bd9Sstevel@tonic-gate * 0, numRulesFromLDAP 6417c478bd9Sstevel@tonic-gate * NULL, ruleFromLDAP 6427c478bd9Sstevel@tonic-gate * 0, numRulesToLDAP 6437c478bd9Sstevel@tonic-gate * NULL ruleToLDAP 6447c478bd9Sstevel@tonic-gate * NIS_TABLE_OBJ, objType 6457c478bd9Sstevel@tonic-gate * "group.org_dir.x.y.z.", objName 6467c478bd9Sstevel@tonic-gate * "/var/nis/data/group.org_dir" objPath 6477c478bd9Sstevel@tonic-gate * <pointer to NIS+ object> obj 6487c478bd9Sstevel@tonic-gate * 1 isMaster 6497c478bd9Sstevel@tonic-gate */ 6507c478bd9Sstevel@tonic-gate typedef struct { 6517c478bd9Sstevel@tonic-gate __nis_hash_item_mt item; /* item.name=dbId||objName */ 6527c478bd9Sstevel@tonic-gate char *dbId; /* Used during initializaton */ 6537c478bd9Sstevel@tonic-gate __nis_index_t index; 6547c478bd9Sstevel@tonic-gate void *next; /* Next sub-set spec */ 6557c478bd9Sstevel@tonic-gate void *seqNext; /* Next in config sequence */ 6567c478bd9Sstevel@tonic-gate int numColumns; 6577c478bd9Sstevel@tonic-gate char **column; 6587c478bd9Sstevel@tonic-gate time_t initTtlLo; 6597c478bd9Sstevel@tonic-gate time_t initTtlHi; 6607c478bd9Sstevel@tonic-gate time_t ttl; 6617c478bd9Sstevel@tonic-gate char commentChar; 6627c478bd9Sstevel@tonic-gate __nis_object_dn_t *objectDN; 6637c478bd9Sstevel@tonic-gate int numSplits; 6647c478bd9Sstevel@tonic-gate char *separatorStr; 6657c478bd9Sstevel@tonic-gate int usedns_flag; 6667c478bd9Sstevel@tonic-gate int securemap_flag; 6677c478bd9Sstevel@tonic-gate __nis_mapping_element_t *e; 6687c478bd9Sstevel@tonic-gate int numRulesFromLDAP; 6697c478bd9Sstevel@tonic-gate __nis_mapping_rule_t **ruleFromLDAP; 6707c478bd9Sstevel@tonic-gate int numRulesToLDAP; 6717c478bd9Sstevel@tonic-gate __nis_mapping_rule_t **ruleToLDAP; 6727c478bd9Sstevel@tonic-gate /* 6737c478bd9Sstevel@tonic-gate * The following fields contain information about the mapped object. 6747c478bd9Sstevel@tonic-gate */ 6757c478bd9Sstevel@tonic-gate zotypes objType; 6767c478bd9Sstevel@tonic-gate char *objName; /* FQ object name */ 6777c478bd9Sstevel@tonic-gate char *objPath; /* nisdb's internal name */ 6787c478bd9Sstevel@tonic-gate nis_object *obj; /* NIS+ object */ 6797c478bd9Sstevel@tonic-gate int isMaster; /* Master for this object ? */ 6807c478bd9Sstevel@tonic-gate int seq_num; 6817c478bd9Sstevel@tonic-gate } __nis_table_mapping_t; 6827c478bd9Sstevel@tonic-gate 6837c478bd9Sstevel@tonic-gate /* End object mappings */ 6847c478bd9Sstevel@tonic-gate 6857c478bd9Sstevel@tonic-gate /* Default config file paths */ 6867c478bd9Sstevel@tonic-gate #define DEFAULTCONFFILE "/var/nis/NIS+LDAPmapping" 6877c478bd9Sstevel@tonic-gate #define ETCCONFFILE "/etc/default/rpc.nisd" 6887c478bd9Sstevel@tonic-gate #define YP_DEFAULTCONFFILE NTOL_MAP_FILE 6897c478bd9Sstevel@tonic-gate #define YP_ETCCONFFILE NTOL_CONFIG_FILE 6907c478bd9Sstevel@tonic-gate 6917c478bd9Sstevel@tonic-gate /* Path to the root object dir file */ 6927c478bd9Sstevel@tonic-gate #define ROOTDIRFILE "/var/nis/data/root_dir" 6937c478bd9Sstevel@tonic-gate /* Path to the root object file */ 6947c478bd9Sstevel@tonic-gate #define ROOTOBJFILE "/var/nis/data/root.object" 6957c478bd9Sstevel@tonic-gate 6967c478bd9Sstevel@tonic-gate extern __nis_table_mapping_t *ldapMappingSeq; 6977c478bd9Sstevel@tonic-gate extern int yp2ldap; 6987c478bd9Sstevel@tonic-gate 6997c478bd9Sstevel@tonic-gate /* Exported functions */ 7007c478bd9Sstevel@tonic-gate int parseConfig(char **ldapCLA, char *ldapConfFile); 7017c478bd9Sstevel@tonic-gate int linked2hash(__nis_table_mapping_t *tlist); 7027c478bd9Sstevel@tonic-gate int dbids2objs(__nis_hash_table_mt *objs, 7037c478bd9Sstevel@tonic-gate __nis_hash_table_mt *dbids); 7047c478bd9Sstevel@tonic-gate void __make_legal(char *s); 7057c478bd9Sstevel@tonic-gate char *internal_table_name(nis_name name, char *res); 7067c478bd9Sstevel@tonic-gate nis_name relative_name(char *s); 7077c478bd9Sstevel@tonic-gate char *internalTableName(char *name); 7087c478bd9Sstevel@tonic-gate __nis_table_mapping_t *getObjMapping(char *name, char *intNameArg, 7097c478bd9Sstevel@tonic-gate int asObj, 7107c478bd9Sstevel@tonic-gate int *doRead, int *doWrite); 7117c478bd9Sstevel@tonic-gate 7127c478bd9Sstevel@tonic-gate #ifdef __cplusplus 7137c478bd9Sstevel@tonic-gate } 7147c478bd9Sstevel@tonic-gate #endif /* __cplusplus */ 7157c478bd9Sstevel@tonic-gate 7167c478bd9Sstevel@tonic-gate #endif /* _LDAP_PARSE_H */ 717