xref: /titanic_44/usr/src/lib/libnisdb/yptol/yptol.h (revision 1cb6af97c6f66f456d4f726ef056e1ebc0f73305)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	__NTOL_H
28 #define	__NTOL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * DESCRIPTION: NIS to LDAP  header information
38  */
39 
40 /*
41  * N2L File names
42  */
43 #define	NTOL_MAP_FILE "/var/yp/NISLDAPmapping"
44 #define	NTOL_CONFIG_FILE "/etc/default/ypserv"
45 
46 /*
47  * Names of passwd files prefixes.
48  */
49 #define	PASSWD_PREFIX	"passwd."
50 #define	PASSWD_ADJUNCT_PREFIX	"passwd.adjunct."
51 
52 /*
53  * Name of netgroup maps.
54  */
55 #define	NETGROUP_MAP	"netgroup"
56 #define	NETGROUP_BYHOST	NETGROUP_MAP ".byhost"
57 #define	NETGROUP_BYUSER	NETGROUP_MAP ".byuser"
58 
59 /*
60  * Types of TTL update
61  */
62 typedef enum {
63 	TTL_MIN, TTL_MAX, TTL_RAND, TTL_RUNNING
64 }TTL_TYPE;
65 
66 /*
67  * dit_access interface externs
68  */
69 extern bool_t is_yptol_mode();
70 extern int read_from_dit(char *, char *, datum *, datum *);
71 extern suc_code write_to_dit(char *, char *, datum, datum, bool_t, bool_t);
72 extern int get_ttl_value(map_ctrl *, TTL_TYPE);
73 extern int get_mapping_domain_list(char ***);
74 extern int get_mapping_yppasswdd_domain_list(char ***);
75 extern void free_map_list(char **);
76 extern char **get_passwd_list(bool_t, char *);
77 extern void free_passwd_list(char **);
78 extern suc_code update_map_from_dit(map_ctrl *, bool_t);
79 extern char **get_mapping_map_list(char *);
80 extern suc_code make_nis_container(char *, char *, bool_t);
81 extern suc_code make_nis_domain(char *, bool_t);
82 extern suc_code update_netgroup_byxxx(map_ctrl *);
83 
84 /*
85  * Other externs
86  */
87 extern suc_code update_entry_ttl(map_ctrl *, datum *, TTL_TYPE);
88 extern void dump_datum(datum *);
89 extern suc_code update_timestamp(DBM *);
90 extern suc_code addpair(DBM *, char *, char *);
91 extern bool_t has_map_expired(map_ctrl *);
92 extern suc_code update_map_if_required(map_ctrl *, bool_t);
93 extern suc_code update_entry_if_required(map_ctrl *, datum *);
94 extern void set_key_data(map_ctrl *, datum *);
95 extern bool_t is_map_updating(map_ctrl *);
96 extern bool_t has_entry_expired(map_ctrl *, datum *);
97 extern void add_separator(char *str);
98 extern suc_code update_map_ttl(map_ctrl *);
99 extern bool_t is_special_key(datum *);
100 extern suc_code open_yptol_files(map_ctrl *);
101 extern void set_key_data(map_ctrl *map, datum *data);
102 
103 /* Error codes for mapping unit */
104 #define	MAP_NO_MEMORY				-2
105 #define	MAP_PARAM_ERROR				-3
106 #define	MAP_INTERNAL_ERROR			-4
107 #define	MAP_NAMEFIELD_MATCH_ERROR		-5
108 #define	MAP_NO_MAPPING_EXISTS			-6
109 #define	MAP_CREATE_LDAP_REQUEST_ERROR		-7
110 #define	MAP_NO_MATCHING_KEY			-8
111 #define	MAP_INDEXLIST_ERROR			-9
112 #define	MAP_WRITE_DISABLED			-10
113 #define	MAP_NO_DN				-11
114 
115 /* Initial frequency of up/down load message printing */
116 #define	PRINT_FREQ				100
117 
118 #ifdef	__cplusplus
119 }
120 #endif
121 
122 #endif	/* __NTOL_H */
123