]> granicus.if.org Git - libtirpc/commitdiff
Use correct AUTH when calling RPCSEC_GSS_DESTROY.
authorMatthew N. Dodd <matthew.nygard.dodd@gmail.com>
Mon, 20 Jun 2011 17:45:11 +0000 (13:45 -0400)
committerSteve Dickson <steved@redhat.com>
Tue, 21 Jun 2011 18:31:45 +0000 (14:31 -0400)
When using multiple AUTHs per client connection, calling
AUTH_DESTROY(auth) may result in 'cl_auth' being set to something other
than 'auth'.

Avoid this by saving and restoring 'cl_auth' across the
RPCSEC_GSS_DESTROY clnt_call().

Signed-off-by: Steve Dickson <steved@redhat.com>
src/auth_gss.c

index 98f03413e27d247da20cbc45baf6f10c727230c9..a992049952a18dabec718de51bd83731468c8563 100644 (file)
@@ -557,9 +557,20 @@ authgss_destroy_context(AUTH *auth)
 
        if (gd->gc.gc_ctx.length != 0) {
                if (gd->established) {
+                       AUTH *save_auth = NULL;
+
+                       /* Make sure we use the right auth_ops */
+                       if (gd->clnt->cl_auth != auth) {
+                               save_auth = gd->clnt->cl_auth;
+                               gd->clnt->cl_auth = auth;
+                       }
+
                        gd->gc.gc_proc = RPCSEC_GSS_DESTROY;
                        clnt_call(gd->clnt, NULLPROC, (xdrproc_t)xdr_void, NULL,
                                  (xdrproc_t)xdr_void, NULL, AUTH_TIMEOUT);
+                       
+                       if (save_auth != NULL)
+                               gd->clnt->cl_auth = save_auth;
                }
                gss_release_buffer(&min_stat, &gd->gc.gc_ctx);
                /* XXX ANDROS check size of context  - should be 8 */