/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2000, 2008 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. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* 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.
*
*/
/*
* Copyright (C) 1998 by the FundsXpress, INC.
*
* 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 FundsXpress. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. FundsXpress makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/*
*/
#include "gssapiP_krb5.h"
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#include <locale.h> /* Solaris Kerberos */
/*
* $Id: add_cred.c 23457 2009-12-08 00:04:48Z tlyu $
*/
/* V2 interface */
{
/* this is pretty simple, since there's not really any difference
between the underlying mechanisms. The main hair is in copying
a mechanism if requested. */
/* check if the desired_mech is bogus */
*minor_status = 0;
return(GSS_S_BAD_MECH);
}
/* check if the desired_mech is bogus */
if ((cred_usage != GSS_C_INITIATE) &&
(cred_usage != GSS_C_ACCEPT) &&
(cred_usage != GSS_C_BOTH)) {
return(GSS_S_FAILURE);
}
/* since the default credential includes all the mechanisms,
return an error for that case. */
/*SUPPRESS 29*/
if (input_cred_handle == GSS_C_NO_CREDENTIAL) {
*minor_status = 0;
return(GSS_S_DUPLICATE_ELEMENT);
}
if (code) {
*minor_status = code;
return GSS_S_FAILURE;
}
context);
if (GSS_ERROR(major_status)) {
return major_status;
}
/* check if the cred_usage is equal or "less" than the passed-in cred
if copying */
(output_cred_handle != NULL)))) {
return(GSS_S_FAILURE);
}
/* check that desired_mech isn't already in the credential */
*minor_status = 0;
return(GSS_S_DUPLICATE_ELEMENT);
}
return GSS_S_FAILURE;
}
/* verify the desired_name */
/*SUPPRESS 29*/
(! kg_validate_name(desired_name))) {
return(GSS_S_CALL_BAD_STRUCTURE|GSS_S_BAD_NAME);
}
/* make sure the desired_name is the same as the existing one */
if (desired_name &&
/* Solaris Kerberos: spruce-up the err msg */
"Desired name principal '%s' does "
"not match '%s'"),
}
if (s_name)
if (s_princ)
return(GSS_S_BAD_NAME);
}
/* copy the cred if necessary */
if (output_cred_handle) {
/* make a copy */
if ((new_cred =
== NULL) {
*minor_status = ENOMEM;
return(GSS_S_FAILURE);
}
if (code) {
*minor_status = code;
return(GSS_S_FAILURE);
}
#ifndef LEAN_CLIENT
*minor_status = ENOMEM;
return(GSS_S_FAILURE);
}
if (code) {
*minor_status = code;
return(GSS_S_FAILURE);
}
if (code) {
*minor_status = code;
return(GSS_S_FAILURE);
}
} else {
#endif /* LEAN_CLIENT */
#ifndef LEAN_CLIENT
}
#endif /* LEAN_CLIENT */
/* Open the replay cache for this principal. */
#ifndef LEAN_CLIENT
#endif /* LEAN_CLIENT */
*minor_status = code;
return(GSS_S_FAILURE);
}
} else {
}
#ifndef LEAN_CLIENT
#endif /* LEAN_CLIENT */
*minor_status = ENOMEM;
return(GSS_S_FAILURE);
}
if (code) {
#ifndef LEAN_CLIENT
#endif /* LEAN_CLIENT */
*minor_status = code;
return(GSS_S_FAILURE);
}
} else {
}
/* intern the credential handle */
#ifndef LEAN_CLIENT
#endif /* LEAN_CLIENT */
return(GSS_S_FAILURE);
}
/* modify new_cred */
}
/* set the flag for the new mechanism */
/* set the outputs */
NULL, actual_mechs))) {
if (output_cred_handle)
return(major_status);
}
if (initiator_time_rec)
if (acceptor_time_rec)
if (output_cred_handle)
*minor_status = 0;
return(GSS_S_COMPLETE);
}