diff options
Diffstat (limited to 'src/lib/gssapi/ac_cred.c')
-rw-r--r-- | src/lib/gssapi/ac_cred.c | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/src/lib/gssapi/ac_cred.c b/src/lib/gssapi/ac_cred.c deleted file mode 100644 index 9019049ee0..0000000000 --- a/src/lib/gssapi/ac_cred.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * ac_cred.c --- gss_acquire_cred - * - * $Source$ - * $Author$ - * $Header$ - * - * Copyright 1991 by the Massachusetts Institute of Technology. - * All Rights Reserved. - * - * Export of this software from the United States of America may - * require a specific license from the United States Government. - * It is the responsibility of any person or organization contemplating - * export to obtain such a license before exporting. - * - * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and - * distribute this software and its documentation for any purpose and - * without fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, and that - * the name of M.I.T. not be used in advertising or publicity pertaining - * to distribution of the software without specific, written prior - * permission. M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" without express - * or implied warranty. - * - * - */ - -/* - * Note: There are really two kinds of credentials in Kerberos V5... - * the first kind is for users, and we use a krb5_ccache to get at - * that. The second kind is for servers, and we use a krb5_keytab to - * point at that. - * - * It is possible to convert from one to another, but we don't address - * that right now. - * - * XXX We need to do something with time_rec. - */ - -#include <gssapi.h> - -char *gss_krb5_fetchfrom = NULL; - -OM_uint32 gss_acquire_cred(minor_status, desired_name, time_req, - desired_mechs, cred_usage, output_cred_handle, - actual_mechs, time_rec) - OM_uint32 *minor_status; - gss_name_t desired_name; - OM_uint32 time_req; - gss_OID_set desired_mechs; - int cred_usage; - gss_cred_id_t *output_cred_handle; - gss_OID_set *actual_mechs; - OM_uint32 *time_rec; -{ - krb5_keytab_entry entry; - krb5_keytab keytabid; - int do_kerberos = 0; - int i; - krb5_error_code retval; - - *minor_status = 0; - - /* - * Figure out which mechanism we should be using. - */ - if (desired_mechs == GSS_C_NULL_OID_SET) - do_kerberos++; - else { - for (i = 0; i <= desired_mechs->count; i++) { - if (gss_compare_OID(&desired_mechs->elements[i], - &gss_OID_krb5)) - do_kerberos++; - } - } - - /* - * Should we return failure here? - */ - if (!do_kerberos) - return(GSS_S_FAILURE); - output_cred_handle->cred_flags = 0; - - /* - * This is Kerberos V5 specific stuff starting here. - * First, let's try to search the keytab file. - * Applications that know what they are doing can mess with - * the variable gss_krb_fetchfrom. Otherwise, we use the - * system default keytab file. - */ - if (*minor_status = krb5_copy_principal(desired_name, - &output_cred_handle->principal)) { - return(GSS_S_FAILURE); - } - if (gss_krb5_fetchfrom) { - /* use the named keytab */ - retval = krb5_kt_resolve(gss_krb5_fetchfrom, &keytabid); - } else { - /* use default keytab */ - retval = krb5_kt_default(&keytabid); - } - if (!retval) { - retval = krb5_kt_get_entry(keytabid, desired_name, 0, - &entry); - (void) krb5_kt_close(keytabid); - if (!retval) { - output_cred_handle->cred_flags |= GSS_KRB_HAS_SRVTAB; - output_cred_handle->kvno = entry.vno; - output_cred_handle->srvtab = entry.key; - krb5_free_principal(entry.principal); - } - } - /* - * Now let's try opening the default credentials file and see - * if it contains the desired name. We could try searching - * some directory (like /tmp) if we really cared, but not for - * now. - * - * We're not even looking in the default credentials file - * right now. XXX - */ - - /* - * We're done, clean up and get out. - */ - if (actual_mechs) { - gss_OID_set set; - - if (!(set = (gss_OID_set) - malloc (sizeof(struct gss_OID_set_desc)))) { - *minor_status = ENOMEM; - return(GSS_S_FAILURE); - } - set->count = 1; - set->elements = &gss_OID_krb5; - *actual_mechs = set; - } - return(GSS_S_COMPLETE); - -} - |