[25625] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

svn rev #25115: trunk/src/lib/kadm5/clnt/

daemon@ATHENA.MIT.EDU (ghudson@mit.edu)
Fri Aug 26 13:56:49 2011

Date: Fri, 26 Aug 2011 13:56:44 -0400
From: ghudson@mit.edu
Message-Id: <201108261756.p7QHui0s006907@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

http://src.mit.edu/fisheye/changelog/krb5/?cs=25115
Commit By: ghudson
Log Message:
ticket: 6949

Remember and close the kadmin socket we opened.

Prior to ticket #6746, the RPC library opened the kadmin socket and
took responsibility for closing.  When we added IPv6 support, the
calling code became the owner of the socket but wasn't closing it,
resulting in a file descriptor leak.


Changed Files:
U   trunk/src/lib/kadm5/clnt/client_init.c
U   trunk/src/lib/kadm5/clnt/client_internal.h
Modified: trunk/src/lib/kadm5/clnt/client_init.c
===================================================================
--- trunk/src/lib/kadm5/clnt/client_init.c	2011-08-24 21:33:47 UTC (rev 25114)
+++ trunk/src/lib/kadm5/clnt/client_init.c	2011-08-26 17:56:44 UTC (rev 25115)
@@ -155,7 +155,7 @@
          kadm5_config_params *params_in, krb5_ui_4 struct_version,
          krb5_ui_4 api_version, char **db_args, void **server_handle)
 {
-    int fd;
+    int fd = -1;
 
     krb5_boolean iprop_enable;
     int port;
@@ -192,6 +192,7 @@
     handle->struct_version = struct_version;
     handle->api_version = api_version;
     handle->clnt = 0;
+    handle->client_socket = -1;
     handle->cache_name = 0;
     handle->destroy_cache = 0;
     handle->context = 0;
@@ -301,7 +302,9 @@
 #endif
         goto error;
     }
+    handle->client_socket = fd;
     handle->lhandle->clnt = handle->clnt;
+    handle->lhandle->client_socket = fd;
 
     /* now that handle->clnt is set, we can check the handle */
     if ((code = _kadm5_check_handle((void *) handle)))
@@ -372,6 +375,8 @@
         AUTH_DESTROY(handle->clnt->cl_auth);
     if(handle->clnt)
         clnt_destroy(handle->clnt);
+    if (fd != -1)
+        close(fd);
 
     kadm5_free_config_params(handle->context, &handle->params);
 
@@ -796,6 +801,8 @@
         AUTH_DESTROY(handle->clnt->cl_auth);
     if (handle->clnt)
         clnt_destroy(handle->clnt);
+    if (handle->client_socket != -1)
+        close(handle->client_socket);
     if (handle->lhandle)
         free (handle->lhandle);
 

Modified: trunk/src/lib/kadm5/clnt/client_internal.h
===================================================================
--- trunk/src/lib/kadm5/clnt/client_internal.h	2011-08-24 21:33:47 UTC (rev 25114)
+++ trunk/src/lib/kadm5/clnt/client_internal.h	2011-08-26 17:56:44 UTC (rev 25115)
@@ -72,6 +72,7 @@
     char *          cache_name;
     int             destroy_cache;
     CLIENT *        clnt;
+    int             client_socket;
     krb5_context    context;
     kadm5_config_params params;
     struct _kadm5_server_handle_t *lhandle;

_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post