Path: blob/main/crypto/heimdal/lib/krb5/convert_creds.c
34878 views
/*1* Copyright (c) 1997 - 2004 Kungliga Tekniska Högskolan2* (Royal Institute of Technology, Stockholm, Sweden).3* All rights reserved.4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8*9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11*12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* 3. Neither the name of the Institute nor the names of its contributors17* may be used to endorse or promote products derived from this software18* without specific prior written permission.19*20* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND21* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE22* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE23* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE24* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL25* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS26* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)27* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT28* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY29* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF30* SUCH DAMAGE.31*/3233#include "krb5_locl.h"34#include "krb5-v4compat.h"3536#ifndef HEIMDAL_SMALLER3738/**39* Convert the v5 credentials in in_cred to v4-dito in v4creds. This40* is done by sending them to the 524 function in the KDC. If41* `in_cred' doesn't contain a DES session key, then a new one is42* gotten from the KDC and stored in the cred cache `ccache'.43*44* @param context Kerberos 5 context.45* @param in_cred the credential to convert46* @param v4creds the converted credential47*48* @return Returns 0 to indicate success. Otherwise an kerberos et49* error code is returned, see krb5_get_error_message().50*51* @ingroup krb5_v4compat52*/5354KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL55krb524_convert_creds_kdc(krb5_context context,56krb5_creds *in_cred,57struct credentials *v4creds)58KRB5_DEPRECATED_FUNCTION("Use X instead")59{60memset(v4creds, 0, sizeof(*v4creds));61krb5_set_error_message(context, EINVAL,62N_("krb524_convert_creds_kdc not supported", ""));63return EINVAL;64}6566/**67* Convert the v5 credentials in in_cred to v4-dito in v4creds,68* check the credential cache ccache before checking with the KDC.69*70* @param context Kerberos 5 context.71* @param ccache credential cache used to check for des-ticket.72* @param in_cred the credential to convert73* @param v4creds the converted credential74*75* @return Returns 0 to indicate success. Otherwise an kerberos et76* error code is returned, see krb5_get_error_message().77*78* @ingroup krb5_v4compat79*/8081KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL82krb524_convert_creds_kdc_ccache(krb5_context context,83krb5_ccache ccache,84krb5_creds *in_cred,85struct credentials *v4creds)86KRB5_DEPRECATED_FUNCTION("Use X instead")87{88memset(v4creds, 0, sizeof(*v4creds));89krb5_set_error_message(context, EINVAL,90N_("krb524_convert_creds_kdc_ccache not supported", ""));91return EINVAL;92}9394#endif959697