/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* -*- mode: c; indent-tabs-mode: nil -*- */
/*
*
* Copyright 2004, 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.
*
*/
/*
* lucid_context.c - Externalize a "lucid" security
* context from a krb5_gss_ctx_id_rec structure.
*/
#include "gssapiP_krb5.h"
#include "gssapi_krb5.h"
#include "mechglueP.h" /* SUNW17PACresync */
/*
* Local routine prototypes
*/
static void
static void
static krb5_error_code
static krb5_error_code
int version,
void **out_ptr);
/*
* Exported routines
*/
const gss_OID desired_object,
{
int version = 0;
/* Assume failure */
*minor_status = 0;
&version);
return retval;
/* Externalize a structure of the right version */
switch (version) {
case 1:
break;
default:
break;
}
if (kret)
goto error_out;
/* Success! Record the context and return the buffer */
if (! kg_save_lucidctx_id((void *)lctx)) {
goto error_out;
}
goto error_out;
if (*minor_status == 0)
return(retval);
}
/*
* Frees the storage associated with an
* exported lucid context structure.
*/
const gss_OID desired_mech,
const gss_OID desired_object,
{
int version;
void *kctx;
/* Assume failure */
*minor_status = 0;
if (!kctx) {
goto error_out;
}
/* Verify pointer is valid lucid context */
if (! kg_validate_lucidctx_id(kctx)) {
goto error_out;
}
/* Determine version and call correct free routine */
switch (version) {
case 1:
(void)kg_delete_lucidctx_id(kctx);
break;
default:
break;
}
if (kret)
goto error_out;
/* Success! */
*minor_status = 0;
return (retval);
if (*minor_status == 0)
return(retval);
}
/*
* Local routines
*/
static krb5_error_code
int version,
void **out_ptr)
{
/* Allocate the structure */
goto error_out;
}
/* gctx->proto == 0 ==> rfc1964-style key information
gctx->proto == 1 ==> cfx-style (draft-ietf-krb-wg-gssapi-cfx-07) keys */
/* Copy key */
goto error_out;
}
/* Copy keys */
/* (subkey is always present, either a copy of the kerberos
session key or a subkey) */
goto error_out;
if (gctx->have_acceptor_subkey) {
goto error_out;
}
}
else {
return EINVAL; /* XXX better error code? */
}
/* Success! */
return 0;
if (lctx) {
}
return retval;
}
/* Copy the contents of a krb5_keyblock to a gss_krb5_lucid_key_t structure */
static krb5_error_code
{
return EINVAL;
/* Allocate storage for the key data */
return ENOMEM;
}
return 0;
}
/* Free any storage associated with a gss_krb5_lucid_key_t structure */
static void
{
if (key) {
}
}
}
/* Free any storage associated with a gss_krb5_lucid_context_v1 structure */
static void
{
if (ctx) {
}
}
}
}