Reset out variables.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19954 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2007-01-17 11:50:23 +00:00
parent b23d37808e
commit 01dec4c58f
6 changed files with 15 additions and 8 deletions

View File

@@ -56,6 +56,7 @@ OM_uint32 gss_duplicate_oid (
(*dest_oid)->elements = malloc(src_oid->length);
if ((*dest_oid)->elements == NULL) {
free(*dest_oid);
*dest_oid = GSS_C_NO_OID;
*minor_status = ENOMEM;
return GSS_S_FAILURE;
}

View File

@@ -45,8 +45,7 @@ gss_encapsulate_token(gss_buffer_t input_token,
ret = der_get_oid (oid->elements, oid->length, &ct.thisMech, &size);
if (ret) {
output_token->value = NULL;
output_token->length = 0;
_mg_buffer_zero(output_token);
return GSS_S_FAILURE;
}
@@ -58,8 +57,7 @@ gss_encapsulate_token(gss_buffer_t input_token,
&ct, &size, ret);
der_free_oid(&ct.thisMech);
if (ret) {
output_token->length = 0;
output_token->value = NULL;
_mg_buffer_zero(output_token);
return GSS_S_FAILURE;
}
if (output_token->length != size)

View File

@@ -37,8 +37,7 @@ gss_export_name(OM_uint32 *minor_status,
struct _gss_name *name = (struct _gss_name *) input_name;
struct _gss_mechanism_name *mn;
exported_name->value = NULL;
exported_name->length = 0;
_mg_buffer_zero(exported_name);
/*
* If this name already has any attached MNs, export the first

View File

@@ -39,6 +39,8 @@ gss_export_sec_context(OM_uint32 *minor_status,
gssapi_mech_interface m = ctx->gc_mech;
gss_buffer_desc buf;
_mg_buffer_zero(interprocess_token);
major_status = m->gm_export_sec_context(minor_status,
&ctx->gc_ctx, &buf);
@@ -58,6 +60,7 @@ gss_export_sec_context(OM_uint32 *minor_status,
* GSS_C_NO_CONTEXT, which we did above.
* Return GSS_S_FAILURE.
*/
_mg_buffer_zero(interprocess_token);
*minor_status = ENOMEM;
return (GSS_S_FAILURE);
}

View File

@@ -39,6 +39,12 @@ gss_get_mic(OM_uint32 *minor_status,
struct _gss_context *ctx = (struct _gss_context *) context_handle;
gssapi_mech_interface m = ctx->gc_mech;
_mg_buffer_zero(message_token);
if (ctx == NULL) {
*minor_status = 0;
return GSS_S_NO_CONTEXT;
}
return (m->gm_get_mic(minor_status, ctx->gc_ctx, qop_req,
message_buffer, message_token));
}

View File

@@ -149,9 +149,10 @@ gss_import_name(OM_uint32 *minor_status,
OM_uint32 major_status;
struct _gss_name *name;
*output_name = GSS_C_NO_NAME;
if (input_name_buffer->length == 0) {
*minor_status = 0;
*output_name = 0;
return (GSS_S_BAD_NAME);
}
@@ -184,7 +185,6 @@ gss_import_name(OM_uint32 *minor_status,
&& !gss_oid_equal(name_type, GSS_C_NT_ANONYMOUS)
&& !gss_oid_equal(name_type, GSS_KRB5_NT_PRINCIPAL_NAME)) {
*minor_status = 0;
*output_name = 0;
return (GSS_S_BAD_NAMETYPE);
}