3 * $Id: rule.h,v 1.7 2004/04/08 01:36:20 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.
36 /*----- Required headers --------------------------------------------------*/
38 #include <sys/types.h>
39 #include <sys/socket.h>
40 #include <netinet/in.h>
41 #include <arpa/inet.h>
51 /*----- Type definitions --------------------------------------------------*/
53 /* --- Rule block --- */
56 struct rule *next; /* Next rule in the list */
57 class_node *host; /* Hosts this rule applies to */
58 class_node *from; /* From users in this class */
59 class_node *to; /* To users in this class */
60 class_node *cmd; /* To run commands in this class */
63 /*----- Functions provided ------------------------------------------------*/
65 /* --- @rule_init@ --- *
71 * Use: Intialises the rule database.
74 extern void rule_init(void);
76 /* --- @rule_end@ --- *
82 * Use: Empties the rule database.
85 extern void rule_end(void);
87 /* --- @rule_list@ --- *
91 * Returns: The list of rules.
93 * Use: Returns the address of the first node in the rule list.
96 extern rule *rule_list(void);
98 /* --- @rule_add@ --- *
100 * Arguments: @class_node *host@ = class of hosts this rule applies to
101 * @class_node *from@ = class of users allowed to change
102 * @class_node *to@ = class of users allowed to be changed to
103 * @class_node *cmd@ = class of commands allowed
107 * Use: Registers another rule.
110 extern void rule_add(class_node */*host*/, class_node */*from*/,
111 class_node */*to*/, class_node */*cmd*/);
113 /* --- @rule_check@ --- *
115 * Arguments: @request *r@ = pointer to a request block
117 * Returns: Zero if disallowed, nonzero if allowed.
119 * Use: Checks a request to see if it's allowed.
122 extern int rule_check(request */*r*/);
124 /* --- @rule_dump@ --- *
130 * Use: Dumps a map of the current ruleset to the trace output.
133 extern void rule_dump(void);
135 /*----- That's all, folks -------------------------------------------------*/