sanon: Fix flags and ctx export/import confusion
We were passing SANON flags to _gss_mg_import_rfc4121_context(), which wants GSS flags. Meanwhile, I broke gss_inquire_context() on imported SAnon contexts when I did my review of SAnon. This commit fixes both issues and removes SANON_FLAG_*, which were only ever needed because of a flag to track whether a context was locally initiated or accepted. Now we use a separate int field of the sanon_ctx to track whether a context was locally initiated. Once an SAnon context is fully established, we rely on gss_inquire_context() on the rfc4121 sub-context for all metadata that isn't the initiator and acceptor names nor the mechanism OID.
This commit is contained in:
@@ -43,6 +43,7 @@ _gss_sanon_inquire_context(OM_uint32 *minor,
|
||||
int *open_context)
|
||||
{
|
||||
const sanon_ctx sc = (const sanon_ctx)context_handle;
|
||||
OM_uint32 major = GSS_S_COMPLETE;
|
||||
|
||||
*minor = 0;
|
||||
|
||||
@@ -57,13 +58,17 @@ _gss_sanon_inquire_context(OM_uint32 *minor,
|
||||
*lifetime_rec = GSS_C_INDEFINITE;
|
||||
if (mech_type)
|
||||
*mech_type = GSS_SANON_X25519_MECHANISM;
|
||||
if (ctx_flags)
|
||||
gss_inquire_context(minor, sc->rfc4121,
|
||||
NULL, NULL, NULL, NULL,
|
||||
ctx_flags, NULL, NULL);
|
||||
if (locally_initiated)
|
||||
*locally_initiated = !!(sc->flags & SANON_FLAG_INITIATOR);
|
||||
if (open_context)
|
||||
*open_context = !!(sc->rfc4121 != GSS_C_NO_CONTEXT);
|
||||
return GSS_S_COMPLETE;
|
||||
if (sc->rfc4121 == GSS_C_NO_CONTEXT) {
|
||||
if (locally_initiated)
|
||||
*locally_initiated = sc->is_initiator;
|
||||
if (open_context)
|
||||
*open_context = 0;
|
||||
if (ctx_flags)
|
||||
*ctx_flags = sc->flags;
|
||||
} else {
|
||||
major = gss_inquire_context(minor, sc->rfc4121, NULL, NULL, NULL,
|
||||
NULL, ctx_flags, locally_initiated,
|
||||
open_context);
|
||||
}
|
||||
return major;
|
||||
}
|
||||
|
Reference in New Issue
Block a user