2N/A/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2N/A * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. 2N/A * Copyright 1990,1991,2000,2004,2008 by the Massachusetts Institute of Technology. 2N/A * All Rights Reserved. 2N/A * Export of this software from the United States of America may 2N/A * require a specific license from the United States Government. 2N/A * It is the responsibility of any person or organization contemplating 2N/A * export to obtain such a license before exporting. 2N/A * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 2N/A * distribute this software and its documentation for any purpose and 2N/A * without fee is hereby granted, provided that the above copyright 2N/A * notice appear in all copies and that both that copyright notice and 2N/A * this permission notice appear in supporting documentation, and that 2N/A * the name of M.I.T. not be used in advertising or publicity pertaining 2N/A * to distribution of the software without specific, written prior 2N/A * permission. Furthermore if you modify this software you must label 2N/A * your software as modified software and not distribute it in such a 2N/A * fashion that it might be confused with the original M.I.T. software. 2N/A * M.I.T. makes no representations about the suitability of 2N/A * this software for any purpose. It is provided "as is" without express 2N/A * or implied warranty. 2N/A * implementation of memory-based credentials cache 2N/A/* Individual credentials within a cache, in a linked list. */ 2N/A/* Per-cache data header. */ 2N/A/* List of memory caches. */ 2N/A/* Iterator over memory caches. */ 2N/A * contents are destroyed. 2N/A * Invalidates the id, and frees any resources associated with accessing 2N/A * Destroys the contents of id. id is invalid after call. 2N/A * system errors (locks related) 2N/A * residual is a legal path name, and a null-terminated string 2N/A * creates or accesses a memory-based cred cache that is referenced by 2N/A * A filled in krb5_ccache structure "id". 2N/A * KRB5_CC_NOMEM - there was insufficient memory to allocate the 2N/A * krb5_ccache. id is undefined. 2N/A * system errors (mutex locks related) 2N/A * Prepares for a sequential search of the credentials cache. 2N/A * Returns a krb5_cc_cursor to be used with krb5_mcc_next_cred and 2N/A * krb5_mcc_end_seq_get. 2N/A * If the cache is modified between the time of this call and the time 2N/A * of the final krb5_mcc_end_seq_get, the results are undefined. 2N/A * cursor is a krb5_cc_cursor originally obtained from 2N/A * krb5_mcc_start_seq_get. 2N/A * Fills in creds with the "next" credentals structure from the cache 2N/A * id. The actual order the creds are returned in is arbitrary. 2N/A * Space is allocated for the variable length fields in the 2N/A * credentials structure, so the object returned must be passed to 2N/A * krb5_destroy_credential. 2N/A * The cursor is updated for the next call to krb5_mcc_next_cred. 2N/A /* Once the node in the linked list is created, it's never 2N/A modified, so we don't need to worry about locking here. (Note 2N/A that we don't support _remove_cred.) */ 2N/A * cursor is a krb5_cc_cursor originally obtained from 2N/A * krb5_mcc_start_seq_get. 2N/A * Finishes sequential processing of the memory credentials ccache id, 2N/A * and invalidates the cursor (it must never be used after this call). 2N/A/* Utility routine: Creates the back-end data for a memory cache, and 2N/A threads it into the global linked list. 2N/A Call with the global list lock held. */ 2N/A * Creates a new memory cred cache whose name is guaranteed to be 2N/A * unique. The name begins with the string TKT_ROOT (from mcc.h). 2N/A * The filled in krb5_ccache id. 2N/A * KRB5_CC_NOMEM - there was insufficient memory to allocate the 2N/A * krb5_ccache. id is undefined. 2N/A * system errors (from open, mutex locking) 2N/A /* Allocate memory */ 2N/A /* Check for uniqueness with mutex locked to avoid race conditions */ 2N/A break;
/* got a match, loop again */ 2N/A if (!
ptr)
break;
/* got to the end without finding a match */ 2N/A/* Utility routine: Creates a random memory ccache name. 2N/A * This algorithm was selected because it creates readable 2N/A * random ccache names in a fixed size buffer. */ 2N/A "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2N/A * id is a file credential cache 2N/A * A pointer to the name of the file cred cache id. 2N/A * Retrieves the primary principal from id, as set with 2N/A * krb5_mcc_initialize. The principal is returned is allocated 2N/A * storage that must be freed by the caller via krb5_free_principal. 2N/A * Non-functional stub implementation for krb5_mcc_remove 2N/A * KRB5_CC_NOSUPP - not implemented 2N/A * id is a cred cache returned by krb5_mcc_resolve or 2N/A * krb5_mcc_generate_new. 2N/A * Sets the operational flags of id to flags. 2N/A * Save away creds in the ccache. 2N/A * system errors (mutex locking) 2N/A /* Solaris Kerberos - fix mem leaks */ 2N/A Utility routine: called by krb5_mcc_* functions to keep 2N/A result of krb5_mcc_last_change_time up to date