/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
*
* Copyright 1995, 2004 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.
*
*/
/*
* ser_sctx.c - Handle [de]serialization of GSSAPI security context.
*/
/* Solaris Kerberos: order is important here. include gssapiP_krb5.h
* before all others, otherwise we get a LINT error from MALLOC macro
* being redefined in mechglueP.h */
#include "gssapiP_krb5.h"
#include "k5-int.h"
/*
* This module contains routines to [de]serialize
* krb5_gss_enc_desc and krb5_gss_ctx_id_t.
* XXX This whole serialization abstraction is unnecessary in a
* non-messaging environment, which krb5 is. Someday, this should
* all get redone without the extra level of indirection. I've done
* some of this work here, since adding new serializers is an internal
* krb5 interface, and I won't use those. There is some more
* deobfuscation (no longer anonymizing pointers, mostly) which could
* still be done. --marc
*/
/*ARGSUSED*/
static krb5_error_code
krb5_octet **buffer;
{
if (err)
return err;
if (err)
return err;
if (err)
return err;
return err;
}
/*ARGSUSED*/
static krb5_error_code
krb5_octet **buffer;
{
/* Read in and check our magic number */
return (EINVAL);
if (ibuf != KV5M_GSS_OID)
return (EINVAL);
return ENOMEM;
return EINVAL;
}
return ENOMEM;
}
return EINVAL;
}
/* Read in and check our trailing magic number */
return (EINVAL);
}
if (ibuf != KV5M_GSS_OID) {
return (EINVAL);
}
return 0;
}
/*ARGSUSED*/
static krb5_error_code
{
/*LINTED*/
required += sizeof(krb5_int32);
kret = 0;
}
return(kret);
}
/*ARGSUSED*/
static krb5_error_code
krb5_octet **buffer;
{
if (err == 0)
if (err == 0)
return err;
}
/*ARGSUSED*/
static krb5_error_code
krb5_octet **buffer;
{
/* Read in and check our magic number */
return (EINVAL);
if (ibuf != KV5M_GSS_QUEUE)
return (EINVAL);
if (err)
return err;
/* Read in and check our trailing magic number */
return (EINVAL);
}
if (ibuf != KV5M_GSS_QUEUE) {
return (EINVAL);
}
return 0;
}
/*ARGSUSED*/
static krb5_error_code
{
if (arg) {
kret = 0;
}
return(kret);
}
/*
* Determine the size required for this krb5_gss_ctx_id_rec.
*/
{
/*
* krb5_gss_ctx_id_rec requires:
* krb5_int32 for KG_CONTEXT
* krb5_int32 for initiate.
* krb5_int32 for established.
* krb5_int32 for big_endian.
* krb5_int32 for have_acceptor_subkey.
* krb5_int32 for seed_init.
* krb5_int32 for gss_flags.
* sizeof(seed) for seed
* ... for here
* ... for there
* ... for subkey
* krb5_int32 for signalg.
* krb5_int32 for cksum_size.
* krb5_int32 for sealalg.
* ... for enc
* ... for seq
* krb5_int32 for endtime.
* krb5_int32 for flags.
* krb5_int64 for seq_send.
* krb5_int64 for seq_recv.
* ... for seqstate
* ... for auth_context
* ... for mech_used
* krb5_int32 for proto
* krb5_int32 for cksumtype
* ... for acceptor_subkey
* krb5_int32 for acceptor_key_cksumtype
* krb5_int32 for cred_rcache
* krb5_int32 for trailer.
*/
/*LINTED*/
kret = 0;
&required);
&required);
&required);
&required);
&required);
if (!kret)
&required);
#ifndef PROVIDE_KERNEL_IMPORT
if (!kret)
&required);
if (!kret)
&required);
#endif
&required);
if (!kret)
}
return(kret);
}
/*
* Externalize this krb5_gss_ctx_id_ret.
*/
krb5_octet **buffer;
{
#ifndef _KERNEL
if (kret)
return(kret);
#endif
required = 0;
/*LINTED*/
/* Our identifier */
/* Now static data */
#ifndef _KERNEL
#else
#endif
/* Now dynamic data */
kret = 0;
#ifndef PROVIDE_KERNEL_IMPORT
if (!kret)
if (!kret)
#endif
if (!kret)
if (!kret)
if (!kret)
if (!kret)
/* trailer */
if (!kret)
if (!kret) {
}
}
}
return(kret);
}
/*
* Internalize this krb5_gss_ctx_id_t.
*/
krb5_octet **buffer;
{
#ifndef _KERNEL
if (kret)
return(kret);
#endif
/* Read our magic number */
ibuf = 0;
if (ibuf == KG_CONTEXT) {
/* Get a context */
+ 2*sizeof(krb5_int64)
(ctx = (krb5_gss_ctx_id_rec *)
xmalloc(sizeof(krb5_gss_ctx_id_rec)))) {
/* Get static data */
#ifndef _KERNEL
#else
#endif
if (kret) {
return kret;
}
&remain))) {
kret = 0;
}
/* Now get substructure data */
kret = 0;
}
if (!kret &&
kret = 0;
}
if (!kret &&
kret = 0;
}
if (!kret &&
kret = 0;
}
if (!kret &&
kret = 0;
}
if (!kret) {
kret = 0;
}
#ifndef PROVIDE_KERNEL_IMPORT
if (!kret)
if (!kret)
#endif
if (!kret)
if (!kret)
if (!kret &&
kret = 0;
}
if (!kret)
if (!kret)
/* Get trailer */
if (!kret)
if (!kret) {
} else {
}
}
}
return(kret);
}