3 * $Id: rule.h,v 1.6 1998/04/23 13:27:31 mdw Exp $
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of `become'
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.
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.
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.
29 /*----- Revision history --------------------------------------------------*
32 * Revision 1.6 1998/04/23 13:27:31 mdw
33 * Export structure of the rule list, for `bcquery's benefit.
35 * Revision 1.5 1998/01/12 16:46:26 mdw
38 * Revision 1.4 1997/09/17 10:27:17 mdw
39 * Use rewritten class handler.
41 * Revision 1.3 1997/08/20 16:22:49 mdw
42 * Rename `rule_reinit' to `rule_end' for more sensible restart.
44 * Revision 1.2 1997/08/04 10:24:25 mdw
45 * Sources placed under CVS control.
47 * Revision 1.1 1997/07/21 13:47:45 mdw
59 /*----- Required headers --------------------------------------------------*/
61 #include <sys/types.h>
62 #include <sys/socket.h>
63 #include <netinet/in.h>
64 #include <arpa/inet.h>
74 /*----- Type definitions --------------------------------------------------*/
76 /* --- Rule block --- */
79 struct rule
*next
; /* Next rule in the list */
80 class_node
*host
; /* Hosts this rule applies to */
81 class_node
*from
; /* From users in this class */
82 class_node
*to
; /* To users in this class */
83 class_node
*cmd
; /* To run commands in this class */
86 /*----- Functions provided ------------------------------------------------*/
88 /* --- @rule_init@ --- *
94 * Use: Intialises the rule database.
97 extern void rule_init(void);
99 /* --- @rule_end@ --- *
105 * Use: Empties the rule database.
108 extern void rule_end(void);
110 /* --- @rule_list@ --- *
114 * Returns: The list of rules.
116 * Use: Returns the address of the first node in the rule list.
119 extern rule
*rule_list(void);
121 /* --- @rule_add@ --- *
123 * Arguments: @class_node *host@ = class of hosts this rule applies to
124 * @class_node *from@ = class of users allowed to change
125 * @class_node *to@ = class of users allowed to be changed to
126 * @class_node *cmd@ = class of commands allowed
130 * Use: Registers another rule.
133 extern void rule_add(class_node */
*host*/
, class_node */
*from*/
,
134 class_node */
*to*/
, class_node */
*cmd*/
);
136 /* --- @rule_check@ --- *
138 * Arguments: @request *r@ = pointer to a request block
140 * Returns: Zero if disallowed, nonzero if allowed.
142 * Use: Checks a request to see if it's allowed.
145 extern int rule_check(request */
*r*/
);
147 /* --- @rule_dump@ --- *
153 * Use: Dumps a map of the current ruleset to the trace output.
156 extern void rule_dump(void);
158 /*----- That's all, folks -------------------------------------------------*/