Line data Source code
1 : /*
2 : * Copyright (c) 1997 - 2002 Kungliga Tekniska Högskolan
3 : * (Royal Institute of Technology, Stockholm, Sweden).
4 : * All rights reserved.
5 : *
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 : *
10 : * 1. Redistributions of source code must retain the above copyright
11 : * notice, this list of conditions and the following disclaimer.
12 : *
13 : * 2. Redistributions in binary form must reproduce the above copyright
14 : * notice, this list of conditions and the following disclaimer in the
15 : * documentation and/or other materials provided with the distribution.
16 : *
17 : * 3. Neither the name of the Institute nor the names of its contributors
18 : * may be used to endorse or promote products derived from this software
19 : * without specific prior written permission.
20 : *
21 : * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 : * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 : * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 : * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 : * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 : * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 : * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 : * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 : * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 : * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 : * SUCH DAMAGE.
32 : */
33 :
34 : #include "krb5_locl.h"
35 :
36 : /**
37 : * Allocate and initialize an autentication context.
38 : *
39 : * @param context A kerberos context.
40 : * @param auth_context The authentication context to be initialized.
41 : *
42 : * Use krb5_auth_con_free() to release the memory when done using the context.
43 : *
44 : * @return An krb5 error code, see krb5_get_error_message().
45 : */
46 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
47 259416 : krb5_auth_con_init(krb5_context context,
48 : krb5_auth_context *auth_context)
49 : {
50 7178 : krb5_auth_context p;
51 :
52 259416 : ALLOC(p, 1);
53 259416 : if (!p)
54 0 : return krb5_enomem(context);
55 259416 : memset(p, 0, sizeof(*p));
56 259416 : ALLOC(p->authenticator, 1);
57 259416 : if (!p->authenticator) {
58 0 : free(p);
59 0 : return krb5_enomem(context);
60 : }
61 259416 : memset (p->authenticator, 0, sizeof(*p->authenticator));
62 259416 : p->flags = KRB5_AUTH_CONTEXT_DO_TIME;
63 :
64 259416 : p->local_address = NULL;
65 259416 : p->remote_address = NULL;
66 259416 : p->local_port = 0;
67 259416 : p->remote_port = 0;
68 259416 : p->keytype = KRB5_ENCTYPE_NULL;
69 259416 : p->cksumtype = CKSUMTYPE_NONE;
70 259416 : p->auth_data = NULL;
71 259416 : *auth_context = p;
72 259416 : return 0;
73 : }
74 :
75 : /**
76 : * Deallocate an authentication context previously initialized with
77 : * krb5_auth_con_init().
78 : *
79 : * @param context A kerberos context.
80 : * @param auth_context The authentication context to be deallocated.
81 : *
82 : * @return An krb5 error code, see krb5_get_error_message().
83 : */
84 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
85 254224 : krb5_auth_con_free(krb5_context context,
86 : krb5_auth_context auth_context)
87 : {
88 254224 : if (auth_context != NULL) {
89 254224 : if (auth_context->authenticator)
90 254224 : krb5_free_authenticator(context, &auth_context->authenticator);
91 254224 : if(auth_context->local_address){
92 97 : free_HostAddress(auth_context->local_address);
93 97 : free(auth_context->local_address);
94 : }
95 254224 : if(auth_context->remote_address){
96 0 : free_HostAddress(auth_context->remote_address);
97 0 : free(auth_context->remote_address);
98 : }
99 254224 : krb5_free_keyblock(context, auth_context->keyblock);
100 254224 : krb5_free_keyblock(context, auth_context->remote_subkey);
101 254224 : krb5_free_keyblock(context, auth_context->local_subkey);
102 254224 : if (auth_context->auth_data) {
103 48019 : free_AuthorizationData(auth_context->auth_data);
104 48019 : free(auth_context->auth_data);
105 : }
106 254224 : free (auth_context);
107 : }
108 254224 : return 0;
109 : }
110 :
111 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
112 82153 : krb5_auth_con_setflags(krb5_context context,
113 : krb5_auth_context auth_context,
114 : int32_t flags)
115 : {
116 82153 : auth_context->flags = flags;
117 82153 : return 0;
118 : }
119 :
120 :
121 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
122 0 : krb5_auth_con_getflags(krb5_context context,
123 : krb5_auth_context auth_context,
124 : int32_t *flags)
125 : {
126 0 : *flags = auth_context->flags;
127 0 : return 0;
128 : }
129 :
130 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
131 205128 : krb5_auth_con_addflags(krb5_context context,
132 : krb5_auth_context auth_context,
133 : int32_t addflags,
134 : int32_t *flags)
135 : {
136 205128 : if (flags)
137 0 : *flags = auth_context->flags;
138 205128 : auth_context->flags |= addflags;
139 205128 : return 0;
140 : }
141 :
142 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
143 80802 : krb5_auth_con_removeflags(krb5_context context,
144 : krb5_auth_context auth_context,
145 : int32_t removeflags,
146 : int32_t *flags)
147 : {
148 80802 : if (flags)
149 80802 : *flags = auth_context->flags;
150 80802 : auth_context->flags &= ~removeflags;
151 80802 : return 0;
152 : }
153 :
154 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
155 1351 : krb5_auth_con_setaddrs(krb5_context context,
156 : krb5_auth_context auth_context,
157 : krb5_address *local_addr,
158 : krb5_address *remote_addr)
159 : {
160 1351 : if (local_addr) {
161 97 : if (auth_context->local_address)
162 0 : krb5_free_address (context, auth_context->local_address);
163 : else
164 97 : if ((auth_context->local_address = malloc(sizeof(krb5_address))) == NULL)
165 0 : return krb5_enomem(context);
166 97 : krb5_copy_address(context, local_addr, auth_context->local_address);
167 : }
168 1351 : if (remote_addr) {
169 0 : if (auth_context->remote_address)
170 0 : krb5_free_address (context, auth_context->remote_address);
171 : else
172 0 : if ((auth_context->remote_address = malloc(sizeof(krb5_address))) == NULL)
173 0 : return krb5_enomem(context);
174 0 : krb5_copy_address(context, remote_addr, auth_context->remote_address);
175 : }
176 1351 : return 0;
177 : }
178 :
179 : /**
180 : * Update the authentication context \a auth_context with the local
181 : * and remote addresses from socket \a fd, according to \a flags.
182 : *
183 : * @return An krb5 error code, see krb5_get_error_message().
184 : */
185 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
186 29 : krb5_auth_con_genaddrs(krb5_context context,
187 : krb5_auth_context auth_context,
188 : krb5_socket_t fd, int flags)
189 : {
190 0 : krb5_error_code ret;
191 0 : krb5_address local_k_address, remote_k_address;
192 29 : krb5_address *lptr = NULL, *rptr = NULL;
193 0 : struct sockaddr_storage ss_local, ss_remote;
194 29 : struct sockaddr *local = (struct sockaddr *)&ss_local;
195 29 : struct sockaddr *remote = (struct sockaddr *)&ss_remote;
196 0 : socklen_t len;
197 :
198 29 : if(flags & KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR) {
199 29 : if (auth_context->local_address == NULL) {
200 29 : len = sizeof(ss_local);
201 29 : if(rk_IS_SOCKET_ERROR(getsockname(fd, local, &len))) {
202 0 : char buf[128];
203 0 : ret = rk_SOCK_ERRNO;
204 0 : rk_strerror_r(ret, buf, sizeof(buf));
205 0 : krb5_set_error_message(context, ret, "getsockname: %s", buf);
206 0 : goto out;
207 : }
208 29 : ret = krb5_sockaddr2address (context, local, &local_k_address);
209 29 : if(ret) goto out;
210 29 : if(flags & KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR) {
211 29 : krb5_sockaddr2port (context, local, &auth_context->local_port);
212 : } else
213 0 : auth_context->local_port = 0;
214 29 : lptr = &local_k_address;
215 : }
216 : }
217 29 : if(flags & KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR) {
218 0 : len = sizeof(ss_remote);
219 0 : if(rk_IS_SOCKET_ERROR(getpeername(fd, remote, &len))) {
220 0 : char buf[128];
221 0 : ret = rk_SOCK_ERRNO;
222 0 : rk_strerror_r(ret, buf, sizeof(buf));
223 0 : krb5_set_error_message(context, ret, "getpeername: %s", buf);
224 0 : goto out;
225 : }
226 0 : ret = krb5_sockaddr2address (context, remote, &remote_k_address);
227 0 : if(ret) goto out;
228 0 : if(flags & KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR) {
229 0 : krb5_sockaddr2port (context, remote, &auth_context->remote_port);
230 : } else
231 0 : auth_context->remote_port = 0;
232 0 : rptr = &remote_k_address;
233 : }
234 29 : ret = krb5_auth_con_setaddrs (context,
235 : auth_context,
236 : lptr,
237 : rptr);
238 29 : out:
239 29 : if (lptr)
240 29 : krb5_free_address (context, lptr);
241 29 : if (rptr)
242 0 : krb5_free_address (context, rptr);
243 29 : return ret;
244 :
245 : }
246 :
247 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
248 0 : krb5_auth_con_setaddrs_from_fd (krb5_context context,
249 : krb5_auth_context auth_context,
250 : void *p_fd)
251 : {
252 0 : krb5_socket_t fd = *(krb5_socket_t *)p_fd;
253 0 : int flags = 0;
254 0 : if(auth_context->local_address == NULL)
255 0 : flags |= KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR;
256 0 : if(auth_context->remote_address == NULL)
257 0 : flags |= KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR;
258 0 : return krb5_auth_con_genaddrs(context, auth_context, fd, flags);
259 : }
260 :
261 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
262 0 : krb5_auth_con_getaddrs(krb5_context context,
263 : krb5_auth_context auth_context,
264 : krb5_address **local_addr,
265 : krb5_address **remote_addr)
266 : {
267 0 : if(*local_addr)
268 0 : krb5_free_address (context, *local_addr);
269 0 : *local_addr = malloc (sizeof(**local_addr));
270 0 : if (*local_addr == NULL)
271 0 : return krb5_enomem(context);
272 0 : krb5_copy_address(context,
273 0 : auth_context->local_address,
274 : *local_addr);
275 :
276 0 : if(*remote_addr)
277 0 : krb5_free_address (context, *remote_addr);
278 0 : *remote_addr = malloc (sizeof(**remote_addr));
279 0 : if (*remote_addr == NULL) {
280 0 : krb5_free_address (context, *local_addr);
281 0 : *local_addr = NULL;
282 0 : return krb5_enomem(context);
283 : }
284 0 : krb5_copy_address(context,
285 0 : auth_context->remote_address,
286 : *remote_addr);
287 0 : return 0;
288 : }
289 :
290 : /* coverity[+alloc : arg-*2] */
291 : static krb5_error_code
292 705245 : copy_key(krb5_context context,
293 : krb5_keyblock *in,
294 : krb5_keyblock **out)
295 : {
296 705245 : *out = NULL;
297 705245 : if (in)
298 700053 : return krb5_copy_keyblock(context, in, out);
299 5192 : return 0;
300 : }
301 :
302 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
303 4 : krb5_auth_con_getkey(krb5_context context,
304 : krb5_auth_context auth_context,
305 : krb5_keyblock **keyblock)
306 : {
307 4 : return copy_key(context, auth_context->keyblock, keyblock);
308 : }
309 :
310 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
311 376456 : krb5_auth_con_getlocalsubkey(krb5_context context,
312 : krb5_auth_context auth_context,
313 : krb5_keyblock **keyblock)
314 : {
315 376456 : return copy_key(context, auth_context->local_subkey, keyblock);
316 : }
317 :
318 : /* coverity[+alloc : arg-*2] */
319 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
320 175566 : krb5_auth_con_getremotesubkey(krb5_context context,
321 : krb5_auth_context auth_context,
322 : krb5_keyblock **keyblock)
323 : {
324 175566 : return copy_key(context, auth_context->remote_subkey, keyblock);
325 : }
326 :
327 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
328 24212 : krb5_auth_con_setkey(krb5_context context,
329 : krb5_auth_context auth_context,
330 : krb5_keyblock *keyblock)
331 : {
332 24212 : if(auth_context->keyblock)
333 0 : krb5_free_keyblock(context, auth_context->keyblock);
334 24212 : return copy_key(context, keyblock, &auth_context->keyblock);
335 : }
336 :
337 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
338 0 : krb5_auth_con_setlocalsubkey(krb5_context context,
339 : krb5_auth_context auth_context,
340 : krb5_keyblock *keyblock)
341 : {
342 0 : if(auth_context->local_subkey)
343 0 : krb5_free_keyblock(context, auth_context->local_subkey);
344 0 : return copy_key(context, keyblock, &auth_context->local_subkey);
345 : }
346 :
347 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
348 125642 : krb5_auth_con_generatelocalsubkey(krb5_context context,
349 : krb5_auth_context auth_context,
350 : krb5_keyblock *key)
351 : {
352 3574 : krb5_error_code ret;
353 3574 : krb5_keyblock *subkey;
354 :
355 125642 : ret = krb5_generate_subkey_extended (context, key,
356 : auth_context->keytype,
357 : &subkey);
358 125642 : if(ret)
359 0 : return ret;
360 125642 : if(auth_context->local_subkey)
361 0 : krb5_free_keyblock(context, auth_context->local_subkey);
362 125642 : auth_context->local_subkey = subkey;
363 125642 : return 0;
364 : }
365 :
366 :
367 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
368 129007 : krb5_auth_con_setremotesubkey(krb5_context context,
369 : krb5_auth_context auth_context,
370 : krb5_keyblock *keyblock)
371 : {
372 129007 : if(auth_context->remote_subkey)
373 0 : krb5_free_keyblock(context, auth_context->remote_subkey);
374 129007 : return copy_key(context, keyblock, &auth_context->remote_subkey);
375 : }
376 :
377 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
378 0 : krb5_auth_con_setcksumtype(krb5_context context,
379 : krb5_auth_context auth_context,
380 : krb5_cksumtype cksumtype)
381 : {
382 0 : auth_context->cksumtype = cksumtype;
383 0 : return 0;
384 : }
385 :
386 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
387 0 : krb5_auth_con_getcksumtype(krb5_context context,
388 : krb5_auth_context auth_context,
389 : krb5_cksumtype *cksumtype)
390 : {
391 0 : *cksumtype = auth_context->cksumtype;
392 0 : return 0;
393 : }
394 :
395 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
396 0 : krb5_auth_con_setkeytype (krb5_context context,
397 : krb5_auth_context auth_context,
398 : krb5_keytype keytype)
399 : {
400 0 : auth_context->keytype = keytype;
401 0 : return 0;
402 : }
403 :
404 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
405 0 : krb5_auth_con_getkeytype (krb5_context context,
406 : krb5_auth_context auth_context,
407 : krb5_keytype *keytype)
408 : {
409 0 : *keytype = auth_context->keytype;
410 0 : return 0;
411 : }
412 :
413 : krb5_error_code
414 72231 : _krb5_add_1auth_data(krb5_context context,
415 : krb5int32 ad_type, krb5_data *ad_data, int critical,
416 : krb5_authdata **dst)
417 : {
418 2693 : AuthorizationDataElement e;
419 :
420 72231 : e.ad_type = ad_type;
421 72231 : e.ad_data = *ad_data;
422 :
423 72231 : if (!critical) {
424 0 : AuthorizationData ad;
425 0 : krb5_error_code ret;
426 0 : krb5_data ir;
427 0 : size_t len;
428 :
429 : /* Build an AD-IF-RELEVANT with the new element inside it */
430 0 : ad.len = 0;
431 0 : ad.val = NULL;
432 0 : ret = add_AuthorizationData(&ad, &e);
433 :
434 : /* Encode the AD-IF-RELEVANT */
435 0 : if (ret == 0)
436 0 : ASN1_MALLOC_ENCODE(AuthorizationData, ir.data, ir.length, &ad,
437 : &len, ret);
438 0 : if (ret == 0 && ir.length != len)
439 0 : krb5_abortx(context, "internal error in ASN.1 encoder");
440 :
441 : /* Re-enter to add the encoded AD-IF-RELEVANT */
442 0 : ret = _krb5_add_1auth_data(context, KRB5_AUTHDATA_IF_RELEVANT, &ir, 1,
443 : dst);
444 :
445 0 : free_AuthorizationData(&ad);
446 0 : krb5_data_free(&ir);
447 0 : return ret;
448 : }
449 :
450 72231 : if (*dst == NULL) {
451 24212 : ALLOC(*dst, 1);
452 24212 : if (*dst == NULL)
453 0 : return krb5_enomem(context);
454 : }
455 72231 : return add_AuthorizationData(*dst, &e);
456 : }
457 :
458 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
459 48019 : krb5_auth_con_add_AuthorizationData(krb5_context context,
460 : krb5_auth_context auth_context,
461 : int type,
462 : krb5_data *data)
463 : {
464 48019 : if (auth_context->auth_data == NULL) {
465 48019 : auth_context->auth_data = calloc(1, sizeof(*auth_context->auth_data));
466 48019 : if (auth_context->auth_data == NULL)
467 0 : return krb5_enomem(context);
468 : }
469 48019 : return _krb5_add_1auth_data(context, type, data, 1,
470 48019 : &auth_context->auth_data);
471 : }
472 :
473 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
474 0 : krb5_auth_con_add_AuthorizationDataIfRelevant(krb5_context context,
475 : krb5_auth_context auth_context,
476 : krb5int32 type,
477 : krb5_data *data)
478 : {
479 0 : if (auth_context->auth_data == NULL) {
480 0 : auth_context->auth_data = calloc(1, sizeof(*auth_context->auth_data));
481 0 : if (auth_context->auth_data == NULL)
482 0 : return krb5_enomem(context);
483 : }
484 0 : return _krb5_add_1auth_data(context, type, data, 0,
485 0 : &auth_context->auth_data);
486 : }
487 :
488 :
489 :
490 : #if 0
491 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
492 : krb5_auth_con_setenctype(krb5_context context,
493 : krb5_auth_context auth_context,
494 : krb5_enctype etype)
495 : {
496 : if(auth_context->keyblock)
497 : krb5_free_keyblock(context, auth_context->keyblock);
498 : ALLOC(auth_context->keyblock, 1);
499 : if(auth_context->keyblock == NULL)
500 : return krb5_enomem(context);
501 : auth_context->keyblock->keytype = etype;
502 : return 0;
503 : }
504 :
505 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
506 : krb5_auth_con_getenctype(krb5_context context,
507 : krb5_auth_context auth_context,
508 : krb5_enctype *etype)
509 : {
510 : krb5_abortx(context, "unimplemented krb5_auth_getenctype called");
511 : }
512 : #endif
513 :
514 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
515 2223356 : krb5_auth_con_getlocalseqnumber(krb5_context context,
516 : krb5_auth_context auth_context,
517 : int32_t *seqnumber)
518 : {
519 2223356 : *seqnumber = auth_context->local_seqnumber;
520 2223356 : return 0;
521 : }
522 :
523 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
524 2163174 : krb5_auth_con_setlocalseqnumber (krb5_context context,
525 : krb5_auth_context auth_context,
526 : int32_t seqnumber)
527 : {
528 2163174 : auth_context->local_seqnumber = seqnumber;
529 2163174 : return 0;
530 : }
531 :
532 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
533 143397 : krb5_auth_con_getremoteseqnumber(krb5_context context,
534 : krb5_auth_context auth_context,
535 : int32_t *seqnumber)
536 : {
537 143397 : *seqnumber = auth_context->remote_seqnumber;
538 143397 : return 0;
539 : }
540 :
541 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
542 176048 : krb5_auth_con_setremoteseqnumber (krb5_context context,
543 : krb5_auth_context auth_context,
544 : int32_t seqnumber)
545 : {
546 176048 : auth_context->remote_seqnumber = seqnumber;
547 176048 : return 0;
548 : }
549 :
550 :
551 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
552 154553 : krb5_auth_con_getauthenticator(krb5_context context,
553 : krb5_auth_context auth_context,
554 : krb5_authenticator *authenticator)
555 : {
556 154553 : *authenticator = malloc(sizeof(**authenticator));
557 154553 : if (*authenticator == NULL)
558 0 : return krb5_enomem(context);
559 :
560 154553 : return copy_Authenticator(auth_context->authenticator,
561 : *authenticator);
562 : }
563 :
564 :
565 : KRB5_LIB_FUNCTION void KRB5_LIB_CALL
566 357615 : krb5_free_authenticator(krb5_context context,
567 : krb5_authenticator *authenticator)
568 : {
569 357615 : free_Authenticator (*authenticator);
570 357615 : free (*authenticator);
571 357615 : *authenticator = NULL;
572 357615 : }
573 :
574 :
575 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
576 0 : krb5_auth_con_setuserkey(krb5_context context,
577 : krb5_auth_context auth_context,
578 : krb5_keyblock *keyblock)
579 : {
580 0 : if(auth_context->keyblock)
581 0 : krb5_free_keyblock(context, auth_context->keyblock);
582 0 : return krb5_copy_keyblock(context, keyblock, &auth_context->keyblock);
583 : }
584 :
585 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
586 0 : krb5_auth_con_getrcache(krb5_context context,
587 : krb5_auth_context auth_context,
588 : krb5_rcache *rcache)
589 : {
590 0 : *rcache = auth_context->rcache;
591 0 : return 0;
592 : }
593 :
594 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
595 0 : krb5_auth_con_setrcache(krb5_context context,
596 : krb5_auth_context auth_context,
597 : krb5_rcache rcache)
598 : {
599 0 : auth_context->rcache = rcache;
600 0 : return 0;
601 : }
602 :
603 : #if 0 /* not implemented */
604 :
605 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
606 : krb5_auth_con_initivector(krb5_context context,
607 : krb5_auth_context auth_context)
608 : {
609 : krb5_abortx(context, "unimplemented krb5_auth_con_initivector called");
610 : }
611 :
612 :
613 : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
614 : krb5_auth_con_setivector(krb5_context context,
615 : krb5_auth_context auth_context,
616 : krb5_pointer ivector)
617 : {
618 : krb5_abortx(context, "unimplemented krb5_auth_con_setivector called");
619 : }
620 :
621 : #endif /* not implemented */
|