Bug fixes, cleanup, compiler warnings, restructure code.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17700 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-06-28 09:00:26 +00:00
parent 534d628c29
commit d3f8f8e122
47 changed files with 308 additions and 785 deletions

View File

@@ -26,21 +26,15 @@
* $FreeBSD: src/lib/libgssapi/gss_init_sec_context.c,v 1.1 2005/12/29 14:40:20 dfr Exp $
*/
#include <gssapi/gssapi.h>
#include <stdlib.h>
#include <errno.h>
#include "mech_switch.h"
#include "name.h"
#include "cred.h"
#include "context.h"
#include "mech_locl.h"
RCSID("$Id$");
OM_uint32
gss_init_sec_context(OM_uint32 * minor_status,
const gss_cred_id_t initiator_cred_handle,
gss_ctx_id_t * context_handle,
const gss_name_t target_name,
const gss_OID mech_type,
const gss_OID input_mech_type,
OM_uint32 req_flags,
OM_uint32 time_req,
const gss_channel_bindings_t input_chan_bindings,
@@ -51,7 +45,7 @@ gss_init_sec_context(OM_uint32 * minor_status,
OM_uint32 * time_rec)
{
OM_uint32 major_status;
struct _gss_mech_switch *m;
gssapi_mech_interface m;
struct _gss_name *name = (struct _gss_name *) target_name;
struct _gss_mechanism_name *mn;
struct _gss_context *ctx = (struct _gss_context *) *context_handle;
@@ -59,6 +53,7 @@ gss_init_sec_context(OM_uint32 * minor_status,
struct _gss_mechanism_cred *mc;
gss_cred_id_t cred_handle;
int allocated_ctx;
gss_OID mech_type = input_mech_type;
*minor_status = 0;
@@ -68,13 +63,16 @@ gss_init_sec_context(OM_uint32 * minor_status,
* sure we use the same mechanism switch as before.
*/
if (!ctx) {
if (mech_type == NULL)
mech_type = GSS_KRB5_MECHANISM;
ctx = malloc(sizeof(struct _gss_context));
if (!ctx) {
*minor_status = ENOMEM;
return (GSS_S_FAILURE);
}
memset(ctx, 0, sizeof(struct _gss_context));
m = ctx->gc_mech = _gss_find_mech_switch(mech_type);
m = ctx->gc_mech = __gss_get_mechanism(mech_type);
if (!m) {
free(ctx);
return (GSS_S_BAD_MECH);
@@ -82,6 +80,7 @@ gss_init_sec_context(OM_uint32 * minor_status,
allocated_ctx = 1;
} else {
m = ctx->gc_mech;
mech_type = &ctx->gc_mech->gm_mech_oid;
allocated_ctx = 0;
}
@@ -96,7 +95,7 @@ gss_init_sec_context(OM_uint32 * minor_status,
cred_handle = GSS_C_NO_CREDENTIAL;
if (cred) {
SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) {
if (_gss_oid_equal(mech_type, mc->gmc_mech_oid)) {
if (gss_oid_equal(mech_type, mc->gmc_mech_oid)) {
cred_handle = mc->gmc_cred;
break;
}