gss: add oid/buffer storage helpers to mechglue
The functions for storing and retrieving GSS OIDs and buffers from
krb5_storage, added in 6554dc69
, are generally useful. Move those into private
_gss_mg_XXX() API and update gss_{export,import}_{cred,sec_context} to use them
where appropriate.
This commit is contained in:
@@ -86,12 +86,10 @@ gss_export_sec_context(OM_uint32 *minor_status,
|
||||
*minor_status = kret;
|
||||
goto failure;
|
||||
}
|
||||
kret = krb5_store_datalen(sp, ctx->gc_input.value,
|
||||
ctx->gc_input.length);
|
||||
if (kret) {
|
||||
*minor_status = kret;
|
||||
major_status = _gss_mg_store_buffer(minor_status, sp,
|
||||
&ctx->gc_input);
|
||||
if (major_status != GSS_S_COMPLETE)
|
||||
goto failure;
|
||||
}
|
||||
} else if (ctx->gc_ctx == GSS_C_NO_CONTEXT) {
|
||||
gss_delete_sec_context(&tmp_minor, context_handle,
|
||||
GSS_C_NO_BUFFER);
|
||||
@@ -109,18 +107,14 @@ gss_export_sec_context(OM_uint32 *minor_status,
|
||||
goto failure;
|
||||
}
|
||||
|
||||
kret = krb5_store_datalen(sp, m->gm_mech_oid.elements,
|
||||
m->gm_mech_oid.length);
|
||||
if (kret) {
|
||||
*minor_status = kret;
|
||||
major_status = _gss_mg_store_oid(minor_status, sp,
|
||||
&m->gm_mech_oid);
|
||||
if (major_status != GSS_S_COMPLETE)
|
||||
goto failure;
|
||||
}
|
||||
|
||||
kret = krb5_store_datalen(sp, buf.value, buf.length);
|
||||
if (kret) {
|
||||
*minor_status = kret;
|
||||
major_status = _gss_mg_store_buffer(minor_status, sp, &buf);
|
||||
if (major_status != GSS_S_COMPLETE)
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
|
||||
kret = krb5_storage_to_data(sp, &data);
|
||||
|
Reference in New Issue
Block a user