95
96 /*
97 * When booting with priv_debug set or in a DEBUG kernel, then we'll
98 * add an additional basic privilege and we verify that it is always
99 * present in E.
100 */
101 if (alloc_test_priv != 0 &&
102 (priv_basic_test = priv_getbyname("basic_test", PRIV_ALLOC)) >= 0) {
103 priv_addset(priv_basic, priv_basic_test);
104 }
105
106 devpolicy_init();
107 }
108
109 /* Utility functions: privilege sets as opaque data types */
110
111 /*
112 * Guts of prgetprivsize.
113 */
114 int
115 priv_prgetprivsize(prpriv_t *tmpl)
116 {
117 return (sizeof (prpriv_t) +
118 PRIV_SETBYTES - sizeof (priv_chunk_t) +
119 (tmpl ? tmpl->pr_infosize : priv_info->priv_infosize));
120 }
121
122 /*
123 * Guts of prgetpriv.
124 */
125 void
126 cred2prpriv(const cred_t *cp, prpriv_t *pr)
127 {
128 priv_set_t *psa;
129 int i;
130
131 pr->pr_nsets = PRIV_NSET;
132 pr->pr_setsize = PRIV_SETSIZE;
133 pr->pr_infosize = priv_info->priv_infosize;
134
135 psa = (priv_set_t *)pr->pr_sets;
|
95
96 /*
97 * When booting with priv_debug set or in a DEBUG kernel, then we'll
98 * add an additional basic privilege and we verify that it is always
99 * present in E.
100 */
101 if (alloc_test_priv != 0 &&
102 (priv_basic_test = priv_getbyname("basic_test", PRIV_ALLOC)) >= 0) {
103 priv_addset(priv_basic, priv_basic_test);
104 }
105
106 devpolicy_init();
107 }
108
109 /* Utility functions: privilege sets as opaque data types */
110
111 /*
112 * Guts of prgetprivsize.
113 */
114 int
115 priv_prgetprivsize(const prpriv_t *tmpl)
116 {
117 return (sizeof (prpriv_t) +
118 PRIV_SETBYTES - sizeof (priv_chunk_t) +
119 (tmpl ? tmpl->pr_infosize : priv_info->priv_infosize));
120 }
121
122 /*
123 * Guts of prgetpriv.
124 */
125 void
126 cred2prpriv(const cred_t *cp, prpriv_t *pr)
127 {
128 priv_set_t *psa;
129 int i;
130
131 pr->pr_nsets = PRIV_NSET;
132 pr->pr_setsize = PRIV_SETSIZE;
133 pr->pr_infosize = priv_info->priv_infosize;
134
135 psa = (priv_set_t *)pr->pr_sets;
|