2 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
8 * lib/gssapi/krb5/set_ccache.c
10 * Copyright 1999, 2003 by the Massachusetts Institute of Technology.
11 * All Rights Reserved.
13 * Export of this software from the United States of America may
14 * require a specific license from the United States Government.
15 * It is the responsibility of any person or organization contemplating
16 * export to obtain such a license before exporting.
18 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
19 * distribute this software and its documentation for any purpose and
20 * without fee is hereby granted, provided that the above copyright
21 * notice appear in all copies and that both that copyright notice and
22 * this permission notice appear in supporting documentation, and that
23 * the name of M.I.T. not be used in advertising or publicity pertaining
24 * to distribution of the software without specific, written prior
25 * permission. Furthermore if you modify this software you must label
26 * your software as modified software and not distribute it in such a
27 * fashion that it might be confused with the original M.I.T. software.
28 * M.I.T. makes no representations about the suitability of
29 * this software for any purpose. It is provided "as is" without express
30 * or implied warranty.
32 * Set ccache name used by gssapi, and optionally obtain old ccache
33 * name. Caller should not free returned name.
37 #include "gssapiP_krb5.h"
38 #include "gss_libinit.h"
40 OM_uint32 KRB5_CALLCONV
41 gss_krb5_ccache_name(minor_status
, name
, out_name
)
42 OM_uint32
*minor_status
;
44 const char **out_name
;
46 char *old_name
= NULL
;
51 err
= gssint_initialize_library();
57 gss_out_name
= k5_getspecific(K5_KEY_GSS_KRB5_SET_CCACHE_OLD_NAME
);
60 const char *tmp_name
= NULL
;
63 kg_get_ccache_name (&err
, &tmp_name
);
66 old_name
= gss_out_name
;
67 /* Solaris Kerberos */
68 gss_out_name
= (char *)tmp_name
;
71 /* If out_name was NULL, we keep the same gss_out_name value, and
72 don't free up any storage (leave old_name NULL). */
75 kg_set_ccache_name (&err
, name
);
77 minor
= k5_setspecific(K5_KEY_GSS_KRB5_SET_CCACHE_OLD_NAME
, gss_out_name
);
89 *out_name
= gss_out_name
;
93 if (old_name
!= NULL
) {
98 return (*minor_status
== 0) ? GSS_S_COMPLETE
: GSS_S_FAILURE
;