]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Update krb5 code to use glue routine lucid context functions
authorneilbrown <neilbrown>
Tue, 28 Mar 2006 00:48:27 +0000 (00:48 +0000)
committerneilbrown <neilbrown>
Tue, 28 Mar 2006 00:48:27 +0000 (00:48 +0000)
The gssd code should not know about the glue layer's context structure.
A previous patch added gss_export_lucid_sec_context() and
gss_free_lucid_sec_context() functions to the gssapi glue layer.
Use these functions rather than calling directly to the Kerberos
gssapi code (which requires the Kerberos context handle rather
than the glue's context handle).

(really this time)

ChangeLog
utils/gssd/context.c
utils/gssd/context.h
utils/gssd/context_mit.c
utils/gssd/gssd_proc.c
utils/gssd/svcgssd_proc.c

index 2b5ae8a6ec3002e4dd89156310dccb8775d1f1e3..146c9c2b65a7d4d161dd33b7d23b058830de4294 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-03-28 kwc@citi.umich.edu
+       Update krb5 code to use glue routine lucid context functions
+       
+       
+       
+       The gssd code should not know about the glue layer's context structure.
+       A previous patch added gss_export_lucid_sec_context() and
+       gss_free_lucid_sec_context() functions to the gssapi glue layer.
+       Use these functions rather than calling directly to the Kerberos
+       gssapi code (which requires the Kerberos context handle rather
+       than the glue's context handle).
+       
+       (really this time)
+       
 2006-03-28 kwc@citi.umich.edu
        
        Separate out context handling code for MIT Kerberos and SPKM3
index 02d162f2aa620a3c5fde2f9cf9fde7f9ce4c1544..4bab3e7955101bd616b014b0a3f2229902b172bb 100644 (file)
 #include "context.h"
 
 int
-serialize_context_for_kernel(gss_ctx_id_t ctx, gss_buffer_desc *buf)
+serialize_context_for_kernel(gss_ctx_id_t ctx,
+                            gss_buffer_desc *buf,
+                            gss_OID mech)
 {
-       gss_union_ctx_id_t      uctx = (gss_union_ctx_id_t)ctx;
-
-       if (g_OID_equal(&krb5oid, uctx->mech_type))
-               return serialize_krb5_ctx(uctx->internal_ctx_id, buf);
+       if (g_OID_equal(&krb5oid, mech))
+               return serialize_krb5_ctx(ctx, buf);
 #ifdef HAVE_SPKM3_H
-       else if (g_OID_equal(&spkm3oid, uctx->mech_type))
-               return serialize_spkm3_ctx(uctx, buf);
+       else if (g_OID_equal(&spkm3oid, mech))
+               return serialize_spkm3_ctx(ctx, buf);
 #endif
        else {
                printerr(0, "ERROR: attempting to serialize context with "
-                               "unknown mechanism oid\n");
+                               "unknown/unsupported mechanism oid\n");
                return -1;
        }
 }
index b2965390d47ecbf049779bbc1ee05060caf819a7..2c9396ac2b42354997c084d7d596770f132e8b54 100644 (file)
@@ -33,7 +33,8 @@
 
 #include <rpc/rpc.h>
 
-int serialize_context_for_kernel(gss_ctx_id_t ctx, gss_buffer_desc *buf);
+int serialize_context_for_kernel(gss_ctx_id_t ctx, gss_buffer_desc *buf,
+                                gss_OID mech);
 int serialize_spkm3_ctx(gss_ctx_id_t ctx, gss_buffer_desc *buf);
 int serialize_krb5_ctx(gss_ctx_id_t ctx, gss_buffer_desc *buf);
 
index 0af92a3804a7c6312546171affb3d8414e43b863..ba94fd86a628caf69fd1d9403e90338fb17c5c46 100644 (file)
@@ -232,10 +232,13 @@ serialize_krb5_ctx(gss_ctx_id_t ctx, gss_buffer_desc *buf)
        int retcode = 0;
 
        printerr(2, "DEBUG: serialize_krb5_ctx: lucid version!\n");
-       maj_stat = gss_krb5_export_lucid_sec_context(&min_stat, &ctx,
-                                                       1, &return_ctx);
-       if (maj_stat != GSS_S_COMPLETE)
+       maj_stat = gss_export_lucid_sec_context(&min_stat, ctx,
+                                               1, &return_ctx);
+       if (maj_stat != GSS_S_COMPLETE) {
+               pgsserr("gss_export_lucid_sec_context",
+                       maj_stat, min_stat, &krb5oid);
                goto out_err;
+       }
 
        /* Check the version returned, we only support v1 right now */
        vers = ((gss_krb5_lucid_context_version_t *)return_ctx)->version;
@@ -256,12 +259,18 @@ serialize_krb5_ctx(gss_ctx_id_t ctx, gss_buffer_desc *buf)
        else
                retcode = prepare_krb5_rfc_cfx_buffer(lctx, buf);
 
-       maj_stat = gss_krb5_free_lucid_sec_context(&min_stat,
-                                                  (void *)lctx);
-       if (maj_stat != GSS_S_COMPLETE)
+       maj_stat = gss_free_lucid_sec_context(&min_stat, ctx, return_ctx);
+       if (maj_stat != GSS_S_COMPLETE) {
+               pgsserr("gss_export_lucid_sec_context",
+                       maj_stat, min_stat, &krb5oid);
                printerr(0, "WARN: failed to free lucid sec context\n");
-       if (retcode)
+       }
+
+       if (retcode) {
+               printerr(1, "serialize_krb5_ctx: prepare_krb5_*_buffer "
+                        "failed (retcode = %d)\n", retcode);
                goto out_err;
+       }
 
        return 0;
 
index f2907c90c870943b89170adab9d49f772b2ea496..4c3d85da766ebdef5f1352ada8c0c6f8f2fbd9b9 100644 (file)
@@ -688,7 +688,7 @@ handle_krb5_upcall(struct clnt_info *clp)
                goto out_return_error;
        }
 
-       if (serialize_context_for_kernel(pd.pd_ctx, &token)) {
+       if (serialize_context_for_kernel(pd.pd_ctx, &token, &krb5oid)) {
                printerr(0, "WARNING: Failed to serialize krb5 context for "
                            "user with uid %d for server %s\n",
                         uid, clp->servername);
@@ -743,7 +743,7 @@ handle_spkm3_upcall(struct clnt_info *clp)
                goto out_return_error;
        }
 
-       if (serialize_context_for_kernel(pd.pd_ctx, &token)) {
+       if (serialize_context_for_kernel(pd.pd_ctx, &token, &spkm3oid)) {
                printerr(0, "WARNING: Failed to serialize spkm3 context for "
                            "user with uid %d for server\n",
                         uid, clp->servername);
index b43a023882675d6788fe758010fe4e7dddb18f95..fd1076efc6fc0b894f95d01b1aa01441d4269e24 100644 (file)
@@ -365,7 +365,7 @@ handle_nullreq(FILE *f) {
 
        /* kernel needs ctx to calculate verifier on null response, so
         * must give it context before doing null call: */
-       if (serialize_context_for_kernel(ctx, &ctx_token)) {
+       if (serialize_context_for_kernel(ctx, &ctx_token, mech)) {
                printerr(0, "WARNING: handle_nullreq: "
                            "serialize_context_for_kernel failed\n");
                maj_stat = GSS_S_FAILURE;