]>
Commit | Line | Data |
---|---|---|
2b778ceb | 1 | /* Copyright (C) 1997-2021 Free Software Foundation, Inc. |
55c14926 | 2 | This file is part of the GNU C Library. |
55c14926 UD |
3 | |
4 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
55c14926 UD |
8 | |
9 | The GNU C Library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 12 | Lesser General Public License for more details. |
55c14926 | 13 | |
41bdb6e2 | 14 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 | 15 | License along with the GNU C Library; if not, see |
5a82c748 | 16 | <https://www.gnu.org/licenses/>. */ |
55c14926 UD |
17 | |
18 | #ifndef __RPCSVC_NISLIB_H__ | |
19 | #define __RPCSVC_NISLIB_H__ | |
20 | ||
cb765808 | 21 | #include <rpcsvc/nis.h> |
55c14926 UD |
22 | |
23 | __BEGIN_DECLS | |
24 | ||
25 | typedef const char *const_nis_name; | |
26 | ||
27 | /* nis_names: These functions are used to locate and manipulate all NIS+ | |
28 | * objects except the NIS+ entry objects. | |
29 | * | |
30 | * nis_lookup (name, flags) resolves a NIS+ name and returns a copy of | |
31 | * that object from a NIS+ server. | |
32 | * const nis_name name: name of the object to be resolved | |
a1129917 UD |
33 | * unsigned int flags: logically ORing zero or more flags (FOLLOW_LINKS, |
34 | * HARD_LOOKUP, [NO_CACHE], MASTER_ONLY, EXPAND_NAME) | |
55c14926 UD |
35 | * |
36 | * nis_add (name, obj) adds objects to the NIS+ namespace. | |
37 | * const nis_name name: fully qualified NIS+ name. | |
38 | * const nis_object *obj: object members zo_name and zo_domain will be | |
39 | * constructed from name. | |
40 | * | |
41 | * nis_remove (name, obj) removes objects from the NIS+ namespace. | |
42 | * const nis_name name: fully qualified NIS+ name. | |
43 | * const nis_object *obj: if not NULL, it is assumed to point to a copy | |
44 | * of the object being removed. In this case, if | |
45 | * the object on the server does not have the same | |
46 | * object identifier as the object being passed, | |
47 | * the operation will fail with the NIS_NOTSAMEOBJ | |
48 | * error. | |
49 | * | |
50 | * nis_modify (name, obj) can change specific attributes of an object | |
51 | * that already exists in the namespace. | |
52 | */ | |
d8cf93f4 UD |
53 | extern nis_result *nis_lookup (const_nis_name name, unsigned int flags) |
54 | __THROW; | |
55 | extern nis_result *nis_add (const_nis_name name, const nis_object *obj) | |
56 | __THROW; | |
57 | extern nis_result *nis_remove (const_nis_name name, | |
58 | const nis_object *obj) __THROW; | |
59 | extern nis_result *nis_modify (const_nis_name name, | |
60 | const nis_object *obj) __THROW; | |
55c14926 UD |
61 | |
62 | /* nis_tables: These functions are used to search and modify NIS+ tables. | |
63 | * | |
64 | * nis_list (table_name, flags, callback(table_name, obj, userdata), userdata) | |
65 | * search a table in the NIS+ namespace. | |
66 | * const nis_name table_name: indexed name ([xx=yy],table.dir) | |
a1129917 UD |
67 | * unsigned int flags: logically ORing one or more flags (FOLLOW_LINKS, |
68 | * [FOLLOW_PATH], HARD_LOOKUP, [ALL_RESULTS], [NO_CACHE], | |
69 | * MASTER_ONLY, EXPAND_NAME, RETURN_RESULT) | |
55c14926 UD |
70 | * callback(): callback is an optional pointer to a function that will |
71 | * process the ENTRY type objects that are returned from the | |
72 | * search. If this pointer is NULL, then all entries that match | |
73 | * the search criteria are returned in the nis_result structure, | |
74 | * otherwise this function will be called once for each | |
75 | * entry returned. | |
76 | * void *userdata: passed to callback function along with the returned | |
77 | * entry object. | |
78 | * | |
79 | * nis_add_entry (table_name, obj, flags) will add the NIS+ object to the | |
80 | * NIS+ table_name. | |
81 | * const nis_name table_name | |
82 | * const nis_object *obj | |
a1129917 | 83 | * unsigned int flags: 0, ADD_OVERWRITE, RETURN_RESULT |
55c14926 UD |
84 | * |
85 | * nis_modify_entry (name, obj, flags) modifies an object identified by name. | |
86 | * const nis_name name: object identifier | |
87 | * const nis_object *obj: should point to an entry with the EN_MODIFIED | |
88 | * flag set in each column that contains new | |
89 | * information. | |
a1129917 | 90 | * unsigned int flags: 0, MOD_SAMEOBJ, RETURN_RESULT |
55c14926 UD |
91 | * |
92 | * nis_remove_entry (table_name, obj, flags) removes a set of entries | |
93 | * identified by table_name from the table. | |
94 | * const nis_name table_name: indexed NIS+ name | |
95 | * const nis_object *obj: if obj is non-null, it is presumed to point to | |
96 | * a cached copy of the entry. When the removal is | |
97 | * attempted, and the object that would be removed | |
98 | * is not the same as the cached object pointed to | |
99 | * by object then the operation will fail with an | |
100 | * NIS_NOTSAMEOBJ error | |
a1129917 | 101 | * unsigned int flags: 0, REM_MULTIPLE |
55c14926 UD |
102 | * |
103 | * nis_first_entry (table_name) fetches entries from a table one at a time. | |
104 | * const nis_name table_name | |
105 | * | |
106 | * nis_next_entry (table_name, cookie) retrieves the "next" entry from a | |
107 | * table specified by table_name. | |
108 | * const nis_name table_name: | |
109 | * const netobj *cookie: The value of cookie from the nis_result structure | |
110 | * form the previous call. | |
111 | */ | |
d82a27f8 JJ |
112 | extern nis_result *nis_list (const_nis_name __name, unsigned int __flags, |
113 | int (*__callback)(const_nis_name __table_name, | |
114 | const nis_object *__obj, | |
115 | const void *__userdata), | |
116 | const void *__userdata) __THROW; | |
117 | extern nis_result *nis_add_entry (const_nis_name __table_name, | |
118 | const nis_object *__obj, | |
119 | unsigned int __flags) __THROW; | |
120 | extern nis_result *nis_modify_entry (const_nis_name __name, | |
121 | const nis_object *__obj, | |
122 | unsigned int __flags) __THROW; | |
123 | extern nis_result *nis_remove_entry (const_nis_name __table_name, | |
124 | const nis_object *__obj, | |
125 | unsigned int __flags) __THROW; | |
126 | extern nis_result *nis_first_entry (const_nis_name __table_name) __THROW; | |
127 | extern nis_result *nis_next_entry (const_nis_name __table_name, | |
128 | const netobj *__cookie) __THROW; | |
55c14926 UD |
129 | /* |
130 | ** nis_server | |
131 | */ | |
d82a27f8 JJ |
132 | extern nis_error nis_mkdir (const_nis_name __dirname, |
133 | const nis_server *__machine) __THROW; | |
134 | extern nis_error nis_rmdir (const_nis_name __dirname, | |
135 | const nis_server *__machine) __THROW; | |
136 | extern nis_error nis_servstate (const nis_server *__machine, | |
137 | const nis_tag *__tags, int __numtags, | |
138 | nis_tag **__result) __THROW; | |
139 | extern nis_error nis_stats (const nis_server *__machine, | |
140 | const nis_tag *__tags, int __numtags, | |
141 | nis_tag **__result) __THROW; | |
142 | extern void nis_freetags (nis_tag *__tags, int __numtags) __THROW; | |
143 | extern nis_server **nis_getservlist (const_nis_name __dirname) __THROW; | |
144 | extern void nis_freeservlist (nis_server **__machines) __THROW; | |
55c14926 UD |
145 | |
146 | /* | |
147 | ** nis_subr | |
148 | */ | |
d82a27f8 JJ |
149 | extern nis_name nis_leaf_of (const_nis_name __name) __THROW; |
150 | extern nis_name nis_leaf_of_r (const_nis_name __name, char *__buffer, | |
151 | size_t __buflen) __THROW; | |
152 | extern nis_name nis_name_of (const_nis_name __name) __THROW; | |
153 | extern nis_name nis_name_of_r (const_nis_name __name, char *__buffer, | |
154 | size_t __buflen) __THROW; | |
155 | extern nis_name nis_domain_of (const_nis_name __name) __THROW; | |
156 | extern nis_name nis_domain_of_r (const_nis_name __name, char *__buffer, | |
157 | size_t __buflen) __THROW; | |
158 | extern nis_name *nis_getnames (const_nis_name __name) __THROW; | |
159 | extern void nis_freenames (nis_name *__namelist) __THROW; | |
160 | extern name_pos nis_dir_cmp (const_nis_name __n1, const_nis_name __n2) __THROW; | |
161 | extern nis_object *nis_clone_object (const nis_object *__src, | |
162 | nis_object *__dest) __THROW; | |
163 | extern void nis_destroy_object (nis_object *__obj) __THROW; | |
164 | extern void nis_print_object (const nis_object *__obj) __THROW; | |
55c14926 UD |
165 | |
166 | /* | |
167 | ** nis_local_names | |
168 | */ | |
d8cf93f4 UD |
169 | extern nis_name nis_local_group (void) __THROW; |
170 | extern nis_name nis_local_directory (void) __THROW; | |
171 | extern nis_name nis_local_principal (void) __THROW; | |
172 | extern nis_name nis_local_host (void) __THROW; | |
55c14926 UD |
173 | |
174 | /* | |
175 | ** nis_error | |
176 | */ | |
d82a27f8 JJ |
177 | extern const char *nis_sperrno (const nis_error __status) __THROW; |
178 | extern void nis_perror (const nis_error __status, const char *__label) __THROW; | |
179 | extern void nis_lerror (const nis_error __status, const char *__label) __THROW; | |
180 | extern char *nis_sperror (const nis_error status, const char *__label) __THROW; | |
181 | extern char *nis_sperror_r (const nis_error __status, const char *__label, | |
182 | char *__buffer, size_t __buflen) __THROW; | |
55c14926 UD |
183 | /* |
184 | ** nis_groups | |
185 | */ | |
d82a27f8 JJ |
186 | extern bool_t nis_ismember (const_nis_name __principal, |
187 | const_nis_name __group) __THROW; | |
188 | extern nis_error nis_addmember (const_nis_name __member, | |
189 | const_nis_name __group) __THROW; | |
190 | extern nis_error nis_removemember (const_nis_name __member, | |
191 | const_nis_name __group) __THROW; | |
192 | extern nis_error nis_creategroup (const_nis_name __group, | |
193 | unsigned int __flags) __THROW; | |
194 | extern nis_error nis_destroygroup (const_nis_name __group) __THROW; | |
195 | extern void nis_print_group_entry (const_nis_name __group) __THROW; | |
196 | extern nis_error nis_verifygroup (const_nis_name __group) __THROW; | |
55c14926 UD |
197 | |
198 | /* | |
199 | ** nis_ping | |
200 | */ | |
d82a27f8 JJ |
201 | extern void nis_ping (const_nis_name __dirname, uint32_t __utime, |
202 | const nis_object *__dirobj) __THROW; | |
203 | extern nis_result *nis_checkpoint (const_nis_name __dirname) __THROW; | |
55c14926 UD |
204 | |
205 | /* | |
206 | ** nis_print (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) | |
207 | */ | |
d82a27f8 JJ |
208 | extern void nis_print_result (const nis_result *__result) __THROW; |
209 | extern void nis_print_rights (unsigned int __rights) __THROW; | |
210 | extern void nis_print_directory (const directory_obj *__dirobj) __THROW; | |
211 | extern void nis_print_group (const group_obj *__grpobj) __THROW; | |
212 | extern void nis_print_table (const table_obj *__tblobj) __THROW; | |
213 | extern void nis_print_link (const link_obj *__lnkobj) __THROW; | |
214 | extern void nis_print_entry (const entry_obj *__enobj) __THROW; | |
55c14926 UD |
215 | |
216 | /* | |
217 | ** nis_file (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) | |
218 | */ | |
d8cf93f4 | 219 | extern directory_obj *readColdStartFile (void) __THROW; |
d82a27f8 JJ |
220 | extern bool_t writeColdStartFile (const directory_obj *__dirobj) __THROW; |
221 | extern nis_object *nis_read_obj (const char *__obj) __THROW; | |
222 | extern bool_t nis_write_obj (const char *__file, const nis_object *__obj) __THROW; | |
55c14926 UD |
223 | |
224 | /* | |
225 | ** nis_clone - (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) | |
226 | */ | |
d82a27f8 JJ |
227 | extern directory_obj *nis_clone_directory (const directory_obj *__src, |
228 | directory_obj *__dest) __THROW; | |
229 | extern nis_result *nis_clone_result (const nis_result *__src, | |
230 | nis_result *__dest) __THROW; | |
55c14926 UD |
231 | |
232 | /* nis_free - nis_freeresult */ | |
d82a27f8 | 233 | extern void nis_freeresult (nis_result *__result) __THROW; |
55c14926 | 234 | /* (XXX THE FOLLOWING ARE INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */ |
d82a27f8 JJ |
235 | extern void nis_free_request (ib_request *__req) __THROW; |
236 | extern void nis_free_directory (directory_obj *__dirobj) __THROW; | |
237 | extern void nis_free_object (nis_object *__obj) __THROW; | |
55c14926 UD |
238 | |
239 | /* (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */ | |
d8cf93f4 UD |
240 | extern nis_name __nis_default_owner (char *) __THROW; |
241 | extern nis_name __nis_default_group (char *) __THROW; | |
242 | extern uint32_t __nis_default_ttl (char *) __THROW; | |
243 | extern unsigned int __nis_default_access (char *, unsigned int) __THROW; | |
244 | extern fd_result *__nis_finddirectory (directory_obj *, const_nis_name) __THROW; | |
245 | extern void __free_fdresult (fd_result *) __THROW; | |
dfd2257a | 246 | |
55c14926 | 247 | /* NIS+ cache locking */ |
d8cf93f4 UD |
248 | extern int __nis_lock_cache (void) __THROW; |
249 | extern int __nis_unlock_cache (void) __THROW; | |
55c14926 | 250 | |
e852e889 UD |
251 | /* (XXX INTERNAL FUNCTIONS, ONLY FOR rpc.nisd AND glibc !!) */ |
252 | #if defined (NIS_INTERNAL) || defined (_LIBC) | |
253 | ||
254 | struct dir_binding | |
255 | { | |
256 | CLIENT *clnt; /* RPC CLIENT handle */ | |
257 | nis_server *server_val; /* List of servers */ | |
a1129917 UD |
258 | unsigned int server_len; /* # of servers */ |
259 | unsigned int server_used; /* Which server we are bind in the moment ? */ | |
260 | unsigned int current_ep; /* Which endpoint of the server are in use? */ | |
261 | unsigned int trys; /* How many server have we tried ? */ | |
262 | unsigned int class; /* From which class is server_val ? */ | |
e852e889 UD |
263 | bool_t master_only; /* Is only binded to the master */ |
264 | bool_t use_auth; /* Do we use AUTH ? */ | |
265 | bool_t use_udp; /* Do we use UDP ? */ | |
266 | struct sockaddr_in addr; /* Server's IP address */ | |
267 | int socket; /* Server's local socket */ | |
268 | }; | |
269 | typedef struct dir_binding dir_binding; | |
270 | ||
d8cf93f4 | 271 | extern nis_error __nisbind_create (dir_binding *, const nis_server *, |
697d37b1 JJ |
272 | unsigned int, unsigned int, unsigned int, |
273 | unsigned int) __THROW; | |
d8cf93f4 UD |
274 | extern nis_error __nisbind_connect (dir_binding *) __THROW; |
275 | extern nis_error __nisbind_next (dir_binding *) __THROW; | |
276 | extern void __nisbind_destroy (dir_binding *) __THROW; | |
697d37b1 JJ |
277 | extern nis_error __nisfind_server (const_nis_name, int, directory_obj **, |
278 | dir_binding *, unsigned int) __THROW; | |
e852e889 UD |
279 | |
280 | #endif | |
281 | ||
55c14926 UD |
282 | __END_DECLS |
283 | ||
284 | #endif /* __RPCSVC_NISLIB_H__ */ |