From 2edaa676dafc6f99879ba7cc977498d1fb24ad70 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20Salvet?= Date: Wed, 10 Mar 2010 14:55:36 +0000 Subject: [PATCH] Fix filedescriptor leak in glite_gsplugin_accept(). --- org.glite.security.gsoap-plugin/src/glite_gsplugin.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.glite.security.gsoap-plugin/src/glite_gsplugin.c b/org.glite.security.gsoap-plugin/src/glite_gsplugin.c index 73bc35e..ca8852b 100644 --- a/org.glite.security.gsoap-plugin/src/glite_gsplugin.c +++ b/org.glite.security.gsoap-plugin/src/glite_gsplugin.c @@ -367,6 +367,7 @@ glite_gsplugin_accept(struct soap *soap, int s, struct sockaddr *a, int *n) if ( (conn = accept(s, (struct sockaddr *)&a, (socklen_t *)n)) < 0 ) return conn; if ( !ctx->connection ) { if ( !(ctx->connection = (edg_wll_GssConnection *)malloc(sizeof(*ctx->connection))) ) { + close(conn); soap_set_receiver_error(soap, "malloc error", strerror(ENOMEM), ENOMEM); return SOAP_INVALID_SOCKET; } @@ -374,6 +375,7 @@ glite_gsplugin_accept(struct soap *soap, int s, struct sockaddr *a, int *n) } if ( edg_wll_gss_accept(ctx->cred, conn, ctx->timeout, ctx->connection, &gss_code)) { pdprintf(("GSLITE_GSPLUGIN: Client authentication failed, closing.\n")); + close(conn); edg_wll_gss_get_error(&gss_code, "Client authentication failed", &ctx->error_msg); soap->errnum = SOAP_SVR_FAULT; soap_set_receiver_error(soap, "SSL error", "SSL authentication failed in tcp_connect(): check password, key file, and ca file.", SOAP_SSL_ERROR); -- 1.8.2.3