xref: /illumos-gate/usr/src/cmd/modload/plcysubr.h (revision 8119dad84d6416f13557b0ba8e2aaf9064cbcfd3)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #include <sys/devpolicy.h>
28 
29 #define	DEV_POLICY	"/etc/security/device_policy"
30 #define	EXTRA_PRIVS	"/etc/security/extra_privs"
31 
32 typedef struct fileentry {
33 	char	*rawbuf;		/* raw text from file */
34 	char	*orgentry;		/* pointer to first non comment line */
35 	char	*entry;			/* entry w/ escaped newlines removed */
36 	int	startline;		/* line # of non comments */
37 } fileentry_t;
38 
39 fileentry_t *fgetline(FILE *fp);
40 
41 int delete_plcy_entry(const char *, const char *);
42 int update_device_policy(const char *, const char *, boolean_t);
43 char *check_plcy_entry(char *, const char *, boolean_t);
44 int check_priv_entry(const char *, boolean_t);
45 int parse_plcy_token(char *, devplcysys_t *);
46 int parse_minor_range(const char *, minor_t *, minor_t *, char *);
47 
48 void devplcy_init(void);
49 
50 extern size_t devplcysys_sz;
51 extern const priv_impl_info_t *privimplinfo;
52