diff mbox

[1/1] Fix private data giveaway

Message ID 1365201425-21702-2-git-send-email-simo@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Simo Sorce April 5, 2013, 10:37 p.m. UTC
When the private data is given away the gss context also needs to go,
because the caller may destroy it, such as when the context is exported
into a lucid context to hand it to the kernel.
---
 src/auth_gss.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Steve Dickson April 10, 2013, 3:39 p.m. UTC | #1
On 05/04/13 18:37, Simo Sorce wrote:
> When the private data is given away the gss context also needs to go,
> because the caller may destroy it, such as when the context is exported
> into a lucid context to hand it to the kernel.
> ---
>  src/auth_gss.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
Committed...

steved.

> 
> diff --git a/src/auth_gss.c b/src/auth_gss.c
> index 81ae8aee316c6f42f317f81cd1438369fb2102c5..703bc3f7b42236b0d4cc3ddbd8935df2aaccf85a 100644
> --- a/src/auth_gss.c
> +++ b/src/auth_gss.c
> @@ -269,6 +269,7 @@ authgss_get_private_data(AUTH *auth, struct authgss_private_data *pd)
>  	 * send an RPCSEC_GSS_DESTROY request which might inappropriately
>  	 * destroy the context.
>  	 */
> +        gd->ctx = GSS_C_NO_CONTEXT;
>  	gd->gc.gc_ctx.length = 0;
>  	gd->gc.gc_ctx.value = NULL;
>  
> @@ -284,7 +285,8 @@ authgss_free_private_data(struct authgss_private_data *pd)
>  	if (!pd)
>  		return (FALSE);
>  
> -	pd->pd_ctx = NULL;
> +	if (pd->pd_ctx != GSS_C_NO_CONTEXT)
> +		gss_delete_sec_context(&min_stat, &pd->pd_ctx, NULL);
>  	gss_release_buffer(&min_stat, &pd->pd_ctx_hndl);
>  	memset(&pd->pd_ctx_hndl, 0, sizeof(pd->pd_ctx_hndl));
>  	pd->pd_seq_win = 0;
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/auth_gss.c b/src/auth_gss.c
index 81ae8aee316c6f42f317f81cd1438369fb2102c5..703bc3f7b42236b0d4cc3ddbd8935df2aaccf85a 100644
--- a/src/auth_gss.c
+++ b/src/auth_gss.c
@@ -269,6 +269,7 @@  authgss_get_private_data(AUTH *auth, struct authgss_private_data *pd)
 	 * send an RPCSEC_GSS_DESTROY request which might inappropriately
 	 * destroy the context.
 	 */
+        gd->ctx = GSS_C_NO_CONTEXT;
 	gd->gc.gc_ctx.length = 0;
 	gd->gc.gc_ctx.value = NULL;
 
@@ -284,7 +285,8 @@  authgss_free_private_data(struct authgss_private_data *pd)
 	if (!pd)
 		return (FALSE);
 
-	pd->pd_ctx = NULL;
+	if (pd->pd_ctx != GSS_C_NO_CONTEXT)
+		gss_delete_sec_context(&min_stat, &pd->pd_ctx, NULL);
 	gss_release_buffer(&min_stat, &pd->pd_ctx_hndl);
 	memset(&pd->pd_ctx_hndl, 0, sizeof(pd->pd_ctx_hndl));
 	pd->pd_seq_win = 0;