afce951b |
1 | /* -*-c-*- |
2 | * |
f60a3434 |
3 | * $Id: netg.h,v 1.4 2003/10/12 00:14:55 mdw Exp $ |
afce951b |
4 | * |
5 | * A local database of netgroups |
6 | * |
c758e654 |
7 | * (c) 1998 EBI |
afce951b |
8 | */ |
9 | |
10 | /*----- Licensing notice --------------------------------------------------* |
11 | * |
12 | * This file is part of `become' |
13 | * |
14 | * `Become' is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU General Public License as published by |
16 | * the Free Software Foundation; either version 2 of the License, or |
17 | * (at your option) any later version. |
18 | * |
19 | * `Become' is distributed in the hope that it will be useful, |
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22 | * GNU General Public License for more details. |
23 | * |
24 | * You should have received a copy of the GNU General Public License |
25 | * along with `become'; if not, write to the Free Software Foundation, |
26 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
27 | */ |
28 | |
29 | /*----- Revision history --------------------------------------------------* |
30 | * |
31 | * $Log: netg.h,v $ |
f60a3434 |
32 | * Revision 1.4 2003/10/12 00:14:55 mdw |
33 | * Major overhaul. Now uses DSA signatures rather than the bogus symmetric |
34 | * encrypt-and-hope thing. Integrated with mLib and Catacomb. |
35 | * |
c758e654 |
36 | * Revision 1.3 1998/01/12 16:46:18 mdw |
37 | * Fix copyright date. |
38 | * |
39 | * Revision 1.2 1997/08/20 16:19:24 mdw |
e6677daf |
40 | * Replace `name_reinit' by `name_end' for more sensible restart. |
41 | * |
afce951b |
42 | * Revision 1.1 1997/08/07 09:45:00 mdw |
43 | * New source file added to maintain a netgroups database. |
44 | * |
45 | */ |
46 | |
47 | #ifndef NETG_H |
48 | #define NETG_H |
49 | |
50 | #ifdef __cplusplus |
51 | extern "C" { |
52 | #endif |
53 | |
54 | /*----- Required headers --------------------------------------------------*/ |
55 | |
f60a3434 |
56 | #include <mLib/sym.h> |
afce951b |
57 | |
58 | /*----- Type definitions --------------------------------------------------*/ |
59 | |
60 | typedef sym_iter netg_iter; |
61 | typedef struct netg__sym netg; |
62 | |
63 | /*----- Functions provided ------------------------------------------------*/ |
64 | |
65 | /* --- @netg_iterate@, @netg_iterate_r@ --- * |
66 | * |
67 | * Arguments: @netg_iter *i@ = pointer to a netgroup iterator object |
68 | * |
69 | * Returns: --- |
70 | * |
71 | * Use: Starts iterating over the netgroups. |
72 | */ |
73 | |
74 | extern void netg_iterate(void); |
75 | extern void netg_iterate_r(netg_iter */*i*/); |
76 | |
77 | /* --- @netg_next@, @netg_next_r@ --- * |
78 | * |
79 | * Arguments: @netg_iter *i@ = pointer to a netgroup iterator object |
80 | * |
81 | * Returns: An opaque pointer to the next item, or null. |
82 | * |
83 | * Use: Returns the next netgroup. |
84 | */ |
85 | |
86 | extern netg *netg_next(void); |
87 | extern netg *netg_next_r(netg_iter */*i*/); |
88 | |
89 | /* --- @netg_name@ --- * |
90 | * |
91 | * Arguments: @netg *n@ = netgroup handle returned by @netg_next@. |
92 | * |
93 | * Returns: A pointer to the name; you may not modify this string. |
94 | * |
95 | * Use: Returns the name of a netgroup. |
96 | */ |
97 | |
98 | extern const char *netg_name(netg */*n*/); |
99 | |
100 | /* --- @netg_scan@ --- * |
101 | * |
102 | * Arguments: @netg *n@ = a netgroup handle returned by @netg_next@ |
103 | * @int (*proc)(netg *n, const char *host, const char *user,@ |
104 | * @const char *domain, void *ctx)@ = function to call |
105 | * for each member. |
106 | * @void *ctx@ = context pointer to pass to @proc@. |
107 | * |
108 | * Returns: Zero if all went well, or the nonzero return value from |
109 | * @proc@. |
110 | * |
111 | * Use: Passes all the members of the netgroup to a given function. |
112 | * The function is given the names, directly from the NIS |
113 | * netgroup map, except that any empty entries are passed as |
114 | * null pointers rather than empty strings. You may not modify |
115 | * any of the strings. The enumeration function, @proc@, may |
116 | * return nonzero to stop itself from being called any more; |
117 | * if this happens, the value it returns becomes the result of |
118 | * this function. If all the items are enumerated OK, this |
119 | * function returns zero. |
120 | */ |
121 | |
122 | extern int netg_scan(netg */*n*/, |
123 | int (*/*proc*/)(netg */*n*/, const char */*host*/, |
124 | const char */*user*/, |
125 | const char */*domain*/, void */*ctx*/), |
126 | void */*ctx*/); |
127 | |
128 | /* --- @netg_init@ --- * |
129 | * |
130 | * Arguments: --- |
131 | * |
132 | * Returns: --- |
133 | * |
134 | * Use: Reads the netgroup database and turns it into something nice. |
135 | */ |
136 | |
137 | extern void netg_init(void); |
138 | |
e6677daf |
139 | /* --- @netg_end@ --- * |
afce951b |
140 | * |
141 | * Arguments: --- |
142 | * |
143 | * Returns: --- |
144 | * |
e6677daf |
145 | * Use: Empties the netgroups database. |
afce951b |
146 | */ |
147 | |
e6677daf |
148 | extern void netg_end(void); |
afce951b |
149 | |
150 | /*----- That's all, folks -------------------------------------------------*/ |
151 | |
152 | #ifdef __cplusplus |
153 | } |
154 | #endif |
155 | |
156 | #endif |