xref: /illumos-gate/usr/src/lib/libnisdb/yptol/yptol.h (revision 1da57d55)
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 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  * DESCRIPTION: NIS to LDAP  header information
36  */
37 
38 /*
39  * N2L File names
40  */
41 #define	NTOL_MAP_FILE "/var/yp/NISLDAPmapping"
42 #define	NTOL_CONFIG_FILE "/etc/default/ypserv"
43 
44 /*
45  * Names of passwd files prefixes.
46  */
47 #define	PASSWD_PREFIX	"passwd."
48 #define	PASSWD_ADJUNCT_PREFIX	"passwd.adjunct."
49 
50 /*
51  * Name of netgroup maps.
52  */
53 #define	NETGROUP_MAP	"netgroup"
54 #define	NETGROUP_BYHOST	NETGROUP_MAP ".byhost"
55 #define	NETGROUP_BYUSER	NETGROUP_MAP ".byuser"
56 
57 /*
58  * Types of TTL update
59  */
60 typedef enum {
61 	TTL_MIN, TTL_MAX, TTL_RAND, TTL_RUNNING
62 }TTL_TYPE;
63 
64 /*
65  * dit_access interface externs
66  */
67 extern bool_t is_yptol_mode();
68 extern int read_from_dit(char *, char *, datum *, datum *);
69 extern suc_code write_to_dit(char *, char *, datum, datum, bool_t, bool_t);
70 extern int get_ttl_value(map_ctrl *, TTL_TYPE);
71 extern int get_mapping_domain_list(char ***);
72 extern int get_mapping_yppasswdd_domain_list(char ***);
73 extern void free_map_list(char **);
74 extern char **get_passwd_list(bool_t, char *);
75 extern void free_passwd_list(char **);
76 extern suc_code update_map_from_dit(map_ctrl *, bool_t);
77 extern char **get_mapping_map_list(char *);
78 extern suc_code make_nis_container(char *, char *, bool_t);
79 extern suc_code make_nis_domain(char *, bool_t);
80 extern suc_code update_netgroup_byxxx(map_ctrl *);
81 
82 /*
83  * Other externs
84  */
85 extern suc_code update_entry_ttl(map_ctrl *, datum *, TTL_TYPE);
86 extern void dump_datum(datum *);
87 extern suc_code update_timestamp(DBM *);
88 extern suc_code addpair(DBM *, char *, char *);
89 extern bool_t has_map_expired(map_ctrl *);
90 extern suc_code update_map_if_required(map_ctrl *, bool_t);
91 extern suc_code update_entry_if_required(map_ctrl *, datum *);
92 extern void set_key_data(map_ctrl *, datum *);
93 extern bool_t is_map_updating(map_ctrl *);
94 extern bool_t has_entry_expired(map_ctrl *, datum *);
95 extern void add_separator(char *str);
96 extern suc_code update_map_ttl(map_ctrl *);
97 extern bool_t is_special_key(datum *);
98 extern suc_code open_yptol_files(map_ctrl *);
99 extern void set_key_data(map_ctrl *map, datum *data);
100 
101 /* Error codes for mapping unit */
102 #define	MAP_NO_MEMORY				-2
103 #define	MAP_PARAM_ERROR				-3
104 #define	MAP_INTERNAL_ERROR			-4
105 #define	MAP_NAMEFIELD_MATCH_ERROR		-5
106 #define	MAP_NO_MAPPING_EXISTS			-6
107 #define	MAP_CREATE_LDAP_REQUEST_ERROR		-7
108 #define	MAP_NO_MATCHING_KEY			-8
109 #define	MAP_INDEXLIST_ERROR			-9
110 #define	MAP_WRITE_DISABLED			-10
111 #define	MAP_NO_DN				-11
112 
113 /* Initial frequency of up/down load message printing */
114 #define	PRINT_FREQ				100
115 
116 #ifdef	__cplusplus
117 }
118 #endif
119 
120 #endif	/* __NTOL_H */
121