xref: /freebsd/lib/libugidfw/bsde_get_rule.3 (revision 862b46f607ea4641313eff08f6df8fd1d930394c)
147ab23aaSRobert Watson.\" Copyright (c) 2003-2004 Networks Associates Technology, Inc.
2d69f8207SChris Costello.\" All rights reserved.
3d69f8207SChris Costello.\"
4d69f8207SChris Costello.\" This software was developed for the FreeBSD Project by Chris
5d69f8207SChris Costello.\" Costello at Safeport Network Services and Network Associates
6d69f8207SChris Costello.\" Laboratories, the Security Research Division of Network Associates,
7d69f8207SChris Costello.\" Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part
8d69f8207SChris Costello.\" of the DARPA CHATS research program.
9d69f8207SChris Costello.\"
10d69f8207SChris Costello.\" Redistribution and use in source and binary forms, with or without
11d69f8207SChris Costello.\" modification, are permitted provided that the following conditions
12d69f8207SChris Costello.\" are met:
13d69f8207SChris Costello.\" 1. Redistributions of source code must retain the above copyright
14d69f8207SChris Costello.\"    notice, this list of conditions and the following disclaimer.
15d69f8207SChris Costello.\" 2. Redistributions in binary form must reproduce the above copyright
16d69f8207SChris Costello.\"    notice, this list of conditions and the following disclaimer in the
17d69f8207SChris Costello.\"    documentation and/or other materials provided with the distribution.
18d69f8207SChris Costello.\"
19d69f8207SChris Costello.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
20d69f8207SChris Costello.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21d69f8207SChris Costello.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22d69f8207SChris Costello.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
23d69f8207SChris Costello.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24d69f8207SChris Costello.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25d69f8207SChris Costello.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26d69f8207SChris Costello.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27d69f8207SChris Costello.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28d69f8207SChris Costello.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29d69f8207SChris Costello.\" SUCH DAMAGE.
30d69f8207SChris Costello.\"
31d69f8207SChris Costello.\" $FreeBSD$
329be02550SRuslan Ermilov.\"
3347ab23aaSRobert Watson.Dd February 24, 2004
34d69f8207SChris Costello.Os
35d69f8207SChris Costello.Dt BSDE_GET_RULE 3
36d69f8207SChris Costello.Sh NAME
3747ab23aaSRobert Watson.Nm bsde_add_rule ,
38d69f8207SChris Costello.Nm bsde_get_rule ,
39d69f8207SChris Costello.Nm bsde_set_rule ,
40d69f8207SChris Costello.Nm bsde_delete_rule
419be02550SRuslan Ermilov.Nd "file system firewall rules list management"
42d69f8207SChris Costello.Sh LIBRARY
43d69f8207SChris Costello.Lb libugidfw
44d69f8207SChris Costello.Sh SYNOPSIS
45d69f8207SChris Costello.In ugidfw.h
46d69f8207SChris Costello.Ft int
4747ab23aaSRobert Watson.Fo bsde_add_rule
4847ab23aaSRobert Watson.Fa "int *rulenum" "struct mac_bsdextended_rule *rule"
4947ab23aaSRobert Watson.Fa "size_t buflen" "char *errstr"
5047ab23aaSRobert Watson.Fc
5147ab23aaSRobert Watson.Ft int
529be02550SRuslan Ermilov.Fo bsde_get_rule
539be02550SRuslan Ermilov.Fa "int rulenum" "struct mac_bsdextended_rule *rule"
549be02550SRuslan Ermilov.Fa "size_t errlen" "char *errstr"
559be02550SRuslan Ermilov.Fc
56d69f8207SChris Costello.Ft int
579be02550SRuslan Ermilov.Fo bsde_set_rule
589be02550SRuslan Ermilov.Fa "int rulenum" "struct mac_bsdextended_rule *rule"
599be02550SRuslan Ermilov.Fa "size_t errlen" "char *errstr"
609be02550SRuslan Ermilov.Fc
61d69f8207SChris Costello.Ft int
62d69f8207SChris Costello.Fn bsde_delete_rule "int rulenum" "size_t errlen" "char *errstr"
63d69f8207SChris Costello.Sh DESCRIPTION
64d69f8207SChris CostelloThe
6547ab23aaSRobert Watson.Fn bsde_add_rule
6647ab23aaSRobert Watsonfunction fills the next available
6747ab23aaSRobert Watsonrule (in
6847ab23aaSRobert Watson.Vt "struct mac_bsdextended_rule"
6947ab23aaSRobert Watsonform, either from
7047ab23aaSRobert Watson.Fn bsde_get_rule
7147ab23aaSRobert Watsonor
7247ab23aaSRobert Watson.Xr bsde_parse_rule 3 ) .
7347ab23aaSRobert WatsonIf an error occurs,
7447ab23aaSRobert Watson.Fa *errstr
7547ab23aaSRobert Watsonis filled with the error string
7647ab23aaSRobert Watson(up to
7747ab23aaSRobert Watson.Fa errlen
7847ab23aaSRobert Watsoncharacters, including the terminating
7947ab23aaSRobert Watson.Dv NUL ) .
8047ab23aaSRobert WatsonIf successful and
8147ab23aaSRobert Watson.Fa rulenum
82862b46f6SRuslan Ermilovis
83862b46f6SRuslan Ermilov.No non- Ns Dv NULL ,
84862b46f6SRuslan Ermilovthe rule number used will be returned in
8547ab23aaSRobert Watson.Fa *rulenum .
8647ab23aaSRobert Watson.Pp
8747ab23aaSRobert WatsonThe
88d69f8207SChris Costello.Fn bsde_get_rule
89d69f8207SChris Costellofunction fills in
90d69f8207SChris Costello.Fa *rule
91d69f8207SChris Costellowith the rule numbered
92d69f8207SChris Costello.Fa rulenum .
93d69f8207SChris CostelloIf an error occurs,
94d69f8207SChris Costello.Fa *errstr
95d69f8207SChris Costellois filled in with the error string
96d69f8207SChris Costello(up to
97d69f8207SChris Costello.Fa errlen
989be02550SRuslan Ermilovcharacters, including the terminating
999be02550SRuslan Ermilov.Dv NUL ) .
100d69f8207SChris Costello.Pp
101d69f8207SChris CostelloThe
102d69f8207SChris Costello.Fn bsde_set_rule
103d69f8207SChris Costellofunction fills the slot numbered
104d69f8207SChris Costello.Fa rulenum
105d69f8207SChris Costellowith the specified rule
106d69f8207SChris Costello(in
107d69f8207SChris Costello.Vt "struct mac_bsdextended_rule"
108d69f8207SChris Costelloform, either from
1099be02550SRuslan Ermilov.Fn bsde_get_rule
110d69f8207SChris Costelloor
111d69f8207SChris Costello.Xr bsde_parse_rule 3 ) .
112d69f8207SChris CostelloIf an error occurs,
113d69f8207SChris Costello.Fa *errstr
114d69f8207SChris Costellois filled with the error string
115d69f8207SChris Costello(up to
116d69f8207SChris Costello.Fa errlen
1179be02550SRuslan Ermilovcharacters, including the terminating
1189be02550SRuslan Ermilov.Dv NUL ) .
119d69f8207SChris Costello.Pp
120d69f8207SChris CostelloThe
121d69f8207SChris Costello.Fn bsde_delete_rule
122d69f8207SChris Costellofunction deletes the rule numbered
123d69f8207SChris Costello.Fa rulenum .
124d69f8207SChris CostelloIf an error occurs,
125d69f8207SChris Costello.Fa *errstr
126d69f8207SChris Costellois filled with the error string
127d69f8207SChris Costello(up to
128d69f8207SChris Costello.Fa errlen
1299be02550SRuslan Ermilovcharacters, including the terminating
1309be02550SRuslan Ermilov.Dv NUL ) .
131d69f8207SChris Costello.Sh RETURN VALUES
132d69f8207SChris CostelloThe
133d69f8207SChris Costello.Fn bsde_get_rule ,
134d69f8207SChris Costello.Fn bsde_set_rule ,
135d69f8207SChris Costelloand
136d69f8207SChris Costello.Fn bsde_delete_rule
1379be02550SRuslan Ermilovfunctions return 0 if successful;
1389be02550SRuslan Ermilovotherwise the value \-1 is returned and the value of
139d69f8207SChris Costello.Fa *errstr
140d69f8207SChris Costellois filled in as documented in
141d69f8207SChris Costello.Sx DESCRIPTION .
142d69f8207SChris Costello.Sh SEE ALSO
143d69f8207SChris Costello.Xr bsde_get_rule_count 3 ,
144d69f8207SChris Costello.Xr bsde_get_rule_slots 3 ,
145d69f8207SChris Costello.Xr bsde_parse_rule 3 ,
146d69f8207SChris Costello.Xr bsde_parse_rule_string 3 ,
147d69f8207SChris Costello.Xr bsde_rule_to_string 3 ,
148d69f8207SChris Costello.Xr libugidfw 3 ,
149d69f8207SChris Costello.Xr mac_bsdextended 4 ,
150d69f8207SChris Costello.Xr ugidfw 8
151d69f8207SChris Costello.Sh AUTHORS
152d69f8207SChris CostelloThis software was contributed to the
153d69f8207SChris Costello.Fx
154d69f8207SChris CostelloProject by Network Associates Labs,
155d69f8207SChris Costellothe Security Research Division of Network Associates
1569be02550SRuslan ErmilovInc. under DARPA/SPAWAR contract N66001-01-C-8035
1579be02550SRuslan Ermilov.Pq Dq CBOSS ,
158d69f8207SChris Costelloas part of the DARPA CHATS research program.
159