No empty .Rs/.Re
[netbsd-mini2440.git] / sys / secmodel / bsd44 / secmodel_bsd44.c
blobbb2d521f436d802e461ac0edaf247c34b59fda18
1 /* $NetBSD: secmodel_bsd44.c,v 1.12 2009/05/03 21:25:44 elad Exp $ */
2 /*-
3 * Copyright (c) 2006 Elad Efrat <elad@NetBSD.org>
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include <sys/cdefs.h>
30 __KERNEL_RCSID(0, "$NetBSD: secmodel_bsd44.c,v 1.12 2009/05/03 21:25:44 elad Exp $");
32 #include <sys/types.h>
33 #include <sys/param.h>
34 #include <sys/kauth.h>
36 #include <sys/sysctl.h>
37 #include <sys/mount.h>
39 #include <sys/module.h>
41 #include <secmodel/bsd44/bsd44.h>
42 #include <secmodel/suser/suser.h>
43 #include <secmodel/securelevel/securelevel.h>
45 MODULE(MODULE_CLASS_SECMODEL, secmodel_bsd44, "suser,securelevel");
47 static struct sysctllog *sysctl_bsd44_log;
49 void
50 sysctl_security_bsd44_setup(struct sysctllog **clog)
52 const struct sysctlnode *rnode;
54 sysctl_createv(clog, 0, NULL, &rnode,
55 CTLFLAG_PERMANENT,
56 CTLTYPE_NODE, "security", NULL,
57 NULL, 0, NULL, 0,
58 CTL_SECURITY, CTL_EOL);
60 sysctl_createv(clog, 0, &rnode, &rnode,
61 CTLFLAG_PERMANENT,
62 CTLTYPE_NODE, "models", NULL,
63 NULL, 0, NULL, 0,
64 CTL_CREATE, CTL_EOL);
66 sysctl_createv(clog, 0, &rnode, &rnode,
67 CTLFLAG_PERMANENT,
68 CTLTYPE_NODE, "bsd44", NULL,
69 NULL, 0, NULL, 0,
70 CTL_CREATE, CTL_EOL);
72 sysctl_createv(clog, 0, &rnode, NULL,
73 CTLFLAG_PERMANENT,
74 CTLTYPE_STRING, "name", NULL,
75 NULL, 0, __UNCONST("Traditional NetBSD (derived from 4.4BSD)"), 0,
76 CTL_CREATE, CTL_EOL);
79 void
80 secmodel_bsd44_init(void)
82 secmodel_suser_init();
83 secmodel_securelevel_init();
86 void
87 secmodel_bsd44_start(void)
89 secmodel_suser_start();
90 secmodel_securelevel_start();
92 /* secmodel_register(); */
95 void
96 secmodel_bsd44_stop(void)
98 secmodel_suser_stop();
99 secmodel_securelevel_stop();
101 /* secmodel_deregister(); */
104 static int
105 secmodel_bsd44_modcmd(modcmd_t cmd, void *arg)
107 int error = 0;
109 switch (cmd) {
110 case MODULE_CMD_INIT:
111 secmodel_bsd44_init();
112 secmodel_bsd44_start();
113 sysctl_security_bsd44_setup(&sysctl_bsd44_log);
114 break;
116 case MODULE_CMD_FINI:
117 sysctl_teardown(&sysctl_bsd44_log);
118 secmodel_bsd44_stop();
119 break;
121 default:
122 error = ENOTTY;
123 break;
126 return error;