2 * lib/krb5/ccache/file/mcc_reslv.c
4 * Copyright 1990 by the Massachusetts Institute of Technology.
7 * Export of this software from the United States of America may
8 * require a specific license from the United States Government.
9 * It is the responsibility of any person or organization contemplating
10 * export to obtain such a license before exporting.
12 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13 * distribute this software and its documentation for any purpose and
14 * without fee is hereby granted, provided that the above copyright
15 * notice appear in all copies and that both that copyright notice and
16 * this permission notice appear in supporting documentation, and that
17 * the name of M.I.T. not be used in advertising or publicity pertaining
18 * to distribution of the software without specific, written prior
19 * permission. M.I.T. makes no representations about the suitability of
20 * this software for any purpose. It is provided "as is" without express
21 * or implied warranty.
24 * This file contains the source code for krb5_mcc_resolve.
31 extern krb5_cc_ops krb5_mcc_ops;
35 * residual is a legal path name, and a null-terminated string
41 * creates a file-based cred cache that will reside in the file
42 * residual. The cache is not opened, but the filename is reserved.
45 * A filled in krb5_ccache structure "id".
48 * KRB5_CC_NOMEM - there was insufficient memory to allocate the
49 * krb5_ccache. id is undefined.
52 krb5_error_code KRB5_CALLCONV
53 krb5_mcc_resolve (context, id, residual)
62 lid = (krb5_ccache) malloc(sizeof(struct _krb5_ccache));
66 lid->ops = &krb5_mcc_ops;
68 for (ptr = mcc_head; ptr; ptr=ptr->next)
69 if (!strcmp(ptr->name, residual))
74 lid->data = (krb5_pointer) malloc(sizeof(krb5_mcc_data));
75 if (lid->data == NULL) {
80 ((krb5_mcc_data *) lid->data)->name = (char *)
81 malloc(strlen(residual) + 1);
82 if (((krb5_mcc_data *)lid->data)->name == NULL) {
83 krb5_xfree(((krb5_mcc_data *)lid->data));
87 strcpy(((krb5_mcc_data *)lid->data)->name, residual);
88 ((krb5_mcc_data *)lid->data)->link = 0L;
89 ((krb5_mcc_data *)lid->data)->prin = 0L;
92 ((krb5_mcc_data *)lid->data)->next = mcc_head;
93 mcc_head = (krb5_mcc_data *)lid->data;
95 ++krb5_cache_sessions;