Print this page
7127 remove -Wno-missing-braces from Makefile.uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/gssapi/mechs/krb5/krb5mech.c
+++ new/usr/src/uts/common/gssapi/mechs/krb5/krb5mech.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 * Copyright (c) 2011 Bayard G. Bell. All rights reserved.
25 25 *
26 26 * A module for Kerberos V5 security mechanism.
27 27 *
28 28 */
29 29
30 30 #include <sys/types.h>
31 31 #include <sys/modctl.h>
32 32 #include <sys/errno.h>
33 33 #include <mechglueP.h>
34 34 #include <gssapiP_krb5.h>
35 35 #include <gssapi_err_generic.h>
36 36 #include <gssapi/kgssapi_defs.h>
37 37 #include <sys/debug.h>
38 38 #include <k5-int.h>
39 39
40 40 /* mechglue wrappers */
41 41
42 42 static OM_uint32 k5glue_delete_sec_context
43 43 (void *, OM_uint32 *, /* minor_status */
44 44 gss_ctx_id_t *, /* context_handle */
45 45 gss_buffer_t, /* output_token */
46 46 OM_uint32);
47 47
48 48 static OM_uint32 k5glue_sign
49 49 (void *, OM_uint32 *, /* minor_status */
50 50 gss_ctx_id_t, /* context_handle */
51 51 int, /* qop_req */
52 52 gss_buffer_t, /* message_buffer */
53 53 gss_buffer_t, /* message_token */
54 54 OM_uint32);
55 55
56 56 static OM_uint32 k5glue_verify
57 57 (void *, OM_uint32 *, /* minor_status */
58 58 gss_ctx_id_t, /* context_handle */
59 59 gss_buffer_t, /* message_buffer */
60 60 gss_buffer_t, /* token_buffer */
61 61 int *, /* qop_state */
62 62 OM_uint32);
63 63
64 64 static OM_uint32 k5glue_seal
65 65 (void *, OM_uint32 *, /* minor_status */
66 66 gss_ctx_id_t, /* context_handle */
67 67 int, /* conf_req_flag */
68 68 int, /* qop_req */
69 69 gss_buffer_t, /* input_message_buffer */
70 70 int *, /* conf_state */
71 71 gss_buffer_t, /* output_message_buffer */
72 72 OM_uint32);
73 73
74 74 static OM_uint32 k5glue_unseal
75 75 (void *, OM_uint32 *, /* minor_status */
76 76 gss_ctx_id_t, /* context_handle */
77 77 gss_buffer_t, /* input_message_buffer */
78 78 gss_buffer_t, /* output_message_buffer */
79 79 int *, /* conf_state */
80 80 int *, /* qop_state */
81 81 OM_uint32);
82 82
83 83 static OM_uint32 k5glue_import_sec_context
84 84 (void *, OM_uint32 *, /* minor_status */
85 85 gss_buffer_t, /* interprocess_token */
86 86 gss_ctx_id_t *); /* context_handle */
87 87
88 88
89 89
90 90 static struct gss_config krb5_mechanism =
91 91 {{9, "\052\206\110\206\367\022\001\002\002"},
92 92 NULL, /* context */
93 93 NULL, /* next */
94 94 TRUE, /* uses_kmod */
95 95 k5glue_unseal,
96 96 k5glue_delete_sec_context,
97 97 k5glue_seal,
98 98 k5glue_import_sec_context,
99 99 k5glue_sign,
100 100 k5glue_verify,
101 101 };
102 102
103 103 static gss_mechanism
104 104 gss_mech_initialize()
105 105 {
106 106 return (&krb5_mechanism);
107 107 }
108 108
109 109
110 110 /*
↓ open down ↓ |
110 lines elided |
↑ open up ↑ |
111 111 * Module linkage information for the kernel.
112 112 */
113 113 extern struct mod_ops mod_miscops;
114 114
115 115 static struct modlmisc modlmisc = {
116 116 &mod_miscops, "Krb5 GSS mechanism"
117 117 };
118 118
119 119 static struct modlinkage modlinkage = {
120 120 MODREV_1,
121 - (void *)&modlmisc,
122 - NULL
121 + { (void *)&modlmisc, NULL }
123 122 };
124 123
125 124
126 125 static int krb5_fini_code = EBUSY;
127 126
128 127 int
129 128 _init()
130 129 {
131 130 int retval;
132 131 gss_mechanism mech, tmp;
133 132
134 133 if ((retval = mod_install(&modlinkage)) != 0)
135 134 return (retval);
136 135
137 136 mech = gss_mech_initialize();
138 137
139 138 mutex_enter(&__kgss_mech_lock);
140 139 tmp = __kgss_get_mechanism(&mech->mech_type);
141 140 if (tmp != NULL) {
142 141
143 142 KRB5_LOG0(KRB5_INFO,
144 143 "KRB5 GSS mechanism: mechanism already in table.\n");
145 144
146 145 if (tmp->uses_kmod == TRUE) {
147 146 KRB5_LOG0(KRB5_INFO, "KRB5 GSS mechanism: mechanism "
148 147 "table supports kernel operations!\n");
149 148 }
150 149 /*
151 150 * keep us loaded, but let us be unloadable. This
152 151 * will give the developer time to trouble shoot
153 152 */
154 153 krb5_fini_code = 0;
155 154 } else {
156 155 __kgss_add_mechanism(mech);
157 156 ASSERT(__kgss_get_mechanism(&mech->mech_type) == mech);
158 157 }
159 158 mutex_exit(&__kgss_mech_lock);
160 159
161 160 return (0);
162 161 }
163 162
164 163 int
165 164 _fini()
166 165 {
167 166 int ret = krb5_fini_code;
168 167
169 168 if (ret == 0) {
170 169 ret = (mod_remove(&modlinkage));
171 170 }
172 171 return (ret);
173 172 }
174 173
175 174 int
176 175 _info(struct modinfo *modinfop)
177 176 {
178 177 return (mod_info(&modlinkage, modinfop));
179 178 }
180 179
181 180 /* ARGSUSED */
182 181 static OM_uint32
183 182 k5glue_delete_sec_context(ctx, minor_status, context_handle, output_token,
184 183 gssd_ctx_verifier)
185 184 void *ctx;
186 185 OM_uint32 *minor_status;
187 186 gss_ctx_id_t *context_handle;
188 187 gss_buffer_t output_token;
189 188 OM_uint32 gssd_ctx_verifier;
190 189 {
191 190 return (krb5_gss_delete_sec_context(minor_status,
192 191 context_handle, output_token,
193 192 gssd_ctx_verifier));
194 193 }
195 194
196 195 /* V2 */
197 196 /* ARGSUSED */
198 197 static OM_uint32
199 198 k5glue_import_sec_context(ctx, minor_status, interprocess_token, context_handle)
200 199 void *ctx;
201 200 OM_uint32 *minor_status;
202 201 gss_buffer_t interprocess_token;
203 202 gss_ctx_id_t *context_handle;
204 203 {
205 204 return (krb5_gss_import_sec_context(minor_status,
206 205 interprocess_token,
207 206 context_handle));
208 207 }
209 208
210 209 /* V1 only */
211 210 /* ARGSUSED */
212 211 static OM_uint32
213 212 k5glue_seal(ctx, minor_status, context_handle, conf_req_flag, qop_req,
214 213 input_message_buffer, conf_state, output_message_buffer,
215 214 gssd_ctx_verifier)
216 215 void *ctx;
217 216 OM_uint32 *minor_status;
218 217 gss_ctx_id_t context_handle;
219 218 int conf_req_flag;
220 219 int qop_req;
221 220 gss_buffer_t input_message_buffer;
222 221 int *conf_state;
223 222 gss_buffer_t output_message_buffer;
224 223 OM_uint32 gssd_ctx_verifier;
225 224 {
226 225 return (krb5_gss_seal(minor_status, context_handle,
227 226 conf_req_flag, qop_req, input_message_buffer,
228 227 conf_state, output_message_buffer, gssd_ctx_verifier));
229 228 }
230 229
231 230 /* ARGSUSED */
232 231 static OM_uint32
233 232 k5glue_sign(ctx, minor_status, context_handle,
234 233 qop_req, message_buffer,
235 234 message_token, gssd_ctx_verifier)
236 235 void *ctx;
237 236 OM_uint32 *minor_status;
238 237 gss_ctx_id_t context_handle;
239 238 int qop_req;
240 239 gss_buffer_t message_buffer;
241 240 gss_buffer_t message_token;
242 241 OM_uint32 gssd_ctx_verifier;
243 242 {
244 243 return (krb5_gss_sign(minor_status, context_handle,
245 244 qop_req, message_buffer, message_token, gssd_ctx_verifier));
246 245 }
247 246
248 247 /* ARGSUSED */
249 248 static OM_uint32
250 249 k5glue_unseal(ctx, minor_status, context_handle, input_message_buffer,
251 250 output_message_buffer, conf_state, qop_state, gssd_ctx_verifier)
252 251 void *ctx;
253 252 OM_uint32 *minor_status;
254 253 gss_ctx_id_t context_handle;
255 254 gss_buffer_t input_message_buffer;
256 255 gss_buffer_t output_message_buffer;
257 256 int *conf_state;
258 257 int *qop_state;
259 258 OM_uint32 gssd_ctx_verifier;
260 259 {
261 260 return (krb5_gss_unseal(minor_status, context_handle,
262 261 input_message_buffer, output_message_buffer,
263 262 conf_state, qop_state, gssd_ctx_verifier));
264 263 }
265 264
266 265 /* V1 only */
267 266 /* ARGSUSED */
268 267 static OM_uint32
269 268 k5glue_verify(ctx, minor_status, context_handle, message_buffer,
270 269 token_buffer, qop_state, gssd_ctx_verifier)
271 270 void *ctx;
272 271 OM_uint32 *minor_status;
273 272 gss_ctx_id_t context_handle;
274 273 gss_buffer_t message_buffer;
275 274 gss_buffer_t token_buffer;
276 275 int *qop_state;
277 276 OM_uint32 gssd_ctx_verifier;
278 277 {
279 278 return (krb5_gss_verify(minor_status,
280 279 context_handle,
281 280 message_buffer,
282 281 token_buffer,
283 282 qop_state, gssd_ctx_verifier));
284 283 }
↓ open down ↓ |
152 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX