X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fgssd%2Fcontext_spkm3.c;h=b927475c63692a7a5a6a1565151013595d83b643;hp=356606965822dc104df50cc56062c48a34068087;hb=9ccfe0fa5a43dfc4453b09e328565a6c8f999fe4;hpb=fe3b14834fc863200b6cba08cff348688e37243b diff --git a/utils/gssd/context_spkm3.c b/utils/gssd/context_spkm3.c index 3566069..b927475 100644 --- a/utils/gssd/context_spkm3.c +++ b/utils/gssd/context_spkm3.c @@ -28,7 +28,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" +#ifdef HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + #include #include #include @@ -51,6 +54,7 @@ * * buf->length should be: * + * version 4 * ctx_id 4 + 12 * qop 4 * mech_used 4 + 7 @@ -70,60 +74,58 @@ prepare_spkm3_ctx_buffer(gss_spkm3_lucid_ctx_t *lctx, gss_buffer_desc *buf) char *p, *end; unsigned int buf_size = 0; - buf_size = lctx->ctx_id.length + - sizeof(lctx->ctx_id.length) + sizeof(lctx->qop) + + buf_size = sizeof(lctx->version) + + lctx->ctx_id.length + sizeof(lctx->ctx_id.length) + + sizeof(lctx->endtime) + sizeof(lctx->mech_used.length) + lctx->mech_used.length + - sizeof(lctx->ret_flags) + sizeof(lctx->req_flags) + - sizeof(lctx->share_key.length) + lctx->share_key.length + + sizeof(lctx->ret_flags) + sizeof(lctx->conf_alg.length) + lctx->conf_alg.length + sizeof(lctx->derived_conf_key.length) + lctx->derived_conf_key.length + sizeof(lctx->intg_alg.length) + lctx->intg_alg.length + sizeof(lctx->derived_integ_key.length) + - lctx->derived_integ_key.length + - sizeof(lctx->keyestb_alg.length) + lctx->keyestb_alg.length + - sizeof(lctx->owf_alg.length) + lctx->owf_alg.length; + lctx->derived_integ_key.length; if (!(buf->value = calloc(1, buf_size))) goto out_err; p = buf->value; end = buf->value + buf_size; + if (WRITE_BYTES(&p, end, lctx->version)) + goto out_err; + printerr(2, "DEBUG: exporting version = %d\n", lctx->version); + if (write_buffer(&p, end, &lctx->ctx_id)) goto out_err; + printerr(2, "DEBUG: exporting ctx_id(%d)\n", lctx->ctx_id.length); - if (WRITE_BYTES(&p, end, lctx->qop)) + if (WRITE_BYTES(&p, end, lctx->endtime)) goto out_err; + printerr(2, "DEBUG: exporting endtime = %d\n", lctx->endtime); if (write_buffer(&p, end, &lctx->mech_used)) goto out_err; + printerr(2, "DEBUG: exporting mech oid (%d)\n", lctx->mech_used.length); if (WRITE_BYTES(&p, end, lctx->ret_flags)) goto out_err; - - if (WRITE_BYTES(&p, end, lctx->req_flags)) - goto out_err; - - if (write_buffer(&p, end, &lctx->share_key)) - goto out_err; + printerr(2, "DEBUG: exporting ret_flags = %d\n", lctx->ret_flags); if (write_buffer(&p, end, &lctx->conf_alg)) goto out_err; + printerr(2, "DEBUG: exporting conf_alg oid (%d)\n", lctx->conf_alg.length); if (write_buffer(&p, end, &lctx->derived_conf_key)) goto out_err; + printerr(2, "DEBUG: exporting conf key (%d)\n", lctx->derived_conf_key.length); if (write_buffer(&p, end, &lctx->intg_alg)) goto out_err; + printerr(2, "DEBUG: exporting intg_alg oid (%d)\n", lctx->intg_alg.length); if (write_buffer(&p, end, &lctx->derived_integ_key)) goto out_err; - - if (write_buffer(&p, end, &lctx->keyestb_alg)) - goto out_err; - - if (write_buffer(&p, end, &lctx->owf_alg)) - goto out_err; + printerr(2, "DEBUG: exporting intg key (%d)\n", lctx->derived_integ_key.length); buf->length = p - (char *)buf->value; return 0; @@ -140,7 +142,7 @@ out_err: * and only export those fields to the kernel. */ int -serialize_spkm3_ctx(gss_ctx_id_t ctx, gss_buffer_desc *buf) +serialize_spkm3_ctx(gss_ctx_id_t ctx, gss_buffer_desc *buf, int32_t *endtime) { OM_uint32 vers, ret, maj_stat, min_stat; void *ret_ctx = 0; @@ -163,6 +165,9 @@ serialize_spkm3_ctx(gss_ctx_id_t ctx, gss_buffer_desc *buf) } ret = prepare_spkm3_ctx_buffer(lctx, buf); + if (endtime) + *endtime = lctx->endtime; + maj_stat = gss_free_lucid_sec_context(&min_stat, ctx, ret_ctx); if (maj_stat != GSS_S_COMPLETE)