From fbc7e7f4903d95e2348e70a0c61497d00d990836 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20Salvet?= Date: Thu, 22 May 2008 13:49:03 +0000 Subject: [PATCH] Use gss_inquire_cred() correctly. Fixes moderately large memory leak too. --- org.glite.lb.client/src/connection.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/org.glite.lb.client/src/connection.c b/org.glite.lb.client/src/connection.c index d2adcf6..5b02d66 100644 --- a/org.glite.lb.client/src/connection.c +++ b/org.glite.lb.client/src/connection.c @@ -196,6 +196,7 @@ int edg_wll_open(edg_wll_Context ctx, int* connToUse) int index; edg_wll_GssStatus gss_stat; OM_uint32 lifetime = 0; + OM_uint32 maj_stat, min_stat = 0; struct stat statinfo; int acquire_cred = 0; @@ -247,11 +248,11 @@ int edg_wll_open(edg_wll_Context ctx, int* connToUse) // Check if credentials exist. If so, check validity if (ctx->connections->connPool[index].gsiCred) { - gss_inquire_cred(ctx->connections->connPool[index].gsiCred, NULL, &lifetime, NULL, NULL, NULL); + maj_stat = gss_inquire_cred(&min_stat, ctx->connections->connPool[index].gsiCred, NULL, &lifetime, NULL, NULL); #ifdef EDG_WLL_CONNPOOL_DEBUG printf ("Credential exists, lifetime: %d\n", lifetime); #endif - if (!lifetime) acquire_cred = 1; // Credentials exist and lifetime is OK. No need to authenticate. + if (GSS_ERROR(maj_stat) || !lifetime) acquire_cred = 1; // Credentials exist and lifetime is OK. No need to authenticate. } else { acquire_cred = 1; // No credentials exist so far, acquire. -- 1.8.2.3