/*
*/
/*
* Copyright 2000 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 1993 by OpenVision Technologies, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appears in all copies and
* that both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of OpenVision not be used
* in advertising or publicity pertaining to distribution of the software
* without specific, written prior permission. OpenVision makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
* OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* 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>
#include <k5-int.h>
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
/*
* $Id: acquire_cred.c,v 1.25.6.2 2000/05/22 20:41:32 meeroh Exp $
*/
/* ARGSUSED */
static OM_uint32
const gss_buffer_t password;
{
/*
* We could add support for this, but we'd need a "memory" based
* keytab, which we lack support for.
*/
return (GSS_S_UNAVAILABLE);
}
static OM_uint32
const gss_buffer_t password;
{
char *pw;
else {
goto out;
}
*pw = '\0';
}
goto out;
}
&creds,
pw,
NULL, /* no prompter callback */
NULL, /* no prompter callback data */
0, /* start time (now) */
NULL, /* target princ; NULL -> TGS */
if (code)
goto out;
/* Got a TGT, now make a MEMORY ccache, stuff in the TGT */
goto out;
/*
* Weirdness: there's no way to gen a new ccache without first
* opening another of well-known name. A bug in the krb5 API,
* really which will have to be fixed in coordination with MIT.
*
* So we first krb5_cc_resolve() "MEMORY:GSSAPI", then we
* krb5_cc_gen_new(), which is a macro that finds the memory
* ccache ops from the first ccache but generates a new one. If
* we don't close that first ccache it will leak.
*/
goto out;
goto out;
goto out;
out:
if (pw)
*minor_status = code;
if (code == 0)
return (GSS_S_COMPLETE);
return (GSS_S_FAILURE);
}
/*ARGSUSED*/
const gss_buffer_t password;
{
size_t i;
if (desired_name == GSS_C_NO_NAME)
return (GSS_S_BAD_NAME);
/* code = gssint_initialize_library(); */
if (code) {
*minor_status = code;
return (GSS_S_FAILURE);
}
if (code) {
*minor_status = code;
return (GSS_S_FAILURE);
}
/* make sure all outputs are valid */
if (actual_mechs)
*actual_mechs = NULL;
if (time_rec)
*time_rec = 0;
/* validate the name */
if (!kg_validate_name(desired_name)) {
return (GSS_S_CALL_BAD_STRUCTURE|GSS_S_BAD_NAME);
}
/*
* verify that the requested mechanism set is the default, or
* contains krb5
*/
if (desired_mechs == GSS_C_NULL_OID_SET) {
req_old = 1;
req_new = 1;
} else {
req_old = 0;
req_new = 0;
for (i = 0; i < desired_mechs->count; i++) {
&(desired_mechs->elements[i])))
req_old++;
if (g_OID_equal(gss_mech_krb5,
&(desired_mechs->elements[i])))
req_new++;
}
*minor_status = 0;
return (GSS_S_BAD_MECH);
}
}
/* create the gss cred structure */
if ((cred = (krb5_gss_cred_id_t)
*minor_status = ENOMEM;
return (GSS_S_FAILURE);
}
if ((cred_usage != GSS_C_INITIATE) &&
(cred_usage != GSS_C_ACCEPT) &&
(cred_usage != GSS_C_BOTH)) {
return (GSS_S_FAILURE);
}
/*
* If requested, acquire credentials for accepting. This will
* fill in cred->princ if the desired_name is not specified.
*/
if ((cred_usage == GSS_C_ACCEPT) ||
(cred_usage == GSS_C_BOTH))
!= GSS_S_COMPLETE) {
/* minor_status set by acquire_accept_cred() */
return (ret);
}
/*
* If requested, acquire credentials for initiation. This will
* fill in cred->princ if it wasn't set above, and the
* desired_name is not specified.
*/
if ((cred_usage == GSS_C_INITIATE) ||
(cred_usage == GSS_C_BOTH))
!= GSS_S_COMPLETE) {
/* minor_status set by acquire_init_cred() */
return (ret);
}
/* if the princ wasn't filled in already, fill it in now */
*minor_status = code;
return (GSS_S_FAILURE);
}
/* at this point, the cred structure has been completely created */
/* compute time_rec */
if (cred_usage == GSS_C_ACCEPT) {
if (time_rec)
} else {
*minor_status = code;
return (GSS_S_FAILURE);
}
if (time_rec)
}
/* create mechs */
if (actual_mechs) {
&ret_mechs)) ||
&ret_mechs))) ||
&ret_mechs)))) {
/* (*minor_status) set above */
return (ret);
}
}
/* intern the credential handle */
return (GSS_S_FAILURE);
}
/* return success */
*minor_status = 0;
if (actual_mechs)
return (GSS_S_COMPLETE);
}
const gss_buffer_t password;
{
return (ret);
}