Bug 323021 - amd automounter and LDAP leaks sockets to the ldap server
Summary: amd automounter and LDAP leaks sockets to the ldap server
Keywords:
Status: CLOSED DUPLICATE of bug 237751
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: am-utils
Version: 4.5
Hardware: All
OS: Linux
high
high
Target Milestone: ---
: ---
Assignee: Karel Zak
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-10-08 11:41 UTC by Jose Plans
Modified: 2009-07-20 09:59 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-10-16 13:24:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
am-utils-ldap-rebind.patch (540 bytes, patch)
2007-10-08 11:41 UTC, Jose Plans
no flags Details | Diff

Description Jose Plans 2007-10-08 11:41:41 UTC
Description of problem:

If am-utils' amd is used with ldap, this one will keep opening connections and
not closing them. In fact, lsof shows 100's of established connections to the
ldap server from amd, yet amd scrolls:  "Unable to ldap_open to ldap_server:389"
in /var/log/messages.

RHEL4 am-utils amd/info_ldap.c amu_ldap_rebind() does:

 if (a->ldap != NULL) {
   if ((a->timestamp - now) > AMD_LDAP_TTL) {
#ifdef DEBUG
     dlog("Reestablishing ldap connection\n");
#endif /* DEBUG */
     ldap_unbind(a->ldap);
     a->timestamp = now;
   }
 }
... ldap_open()...ldap_bind_s()...

But if the cache is not expired and an ldap connection is established, I don't
think it's correct to do the ldap_open() and ldap_bind_s(). Version 6.1.5 from
upstream includes the following changes that fixes the problem:

--
       ldap_unbind(a->ldap);
       a->timestamp = now;
+      a->ldap = NULL;
+    } else {
+      /* Assume all is OK.  If it wasn't we'll be back! */
+#ifdef DEBUG
+      dlog("amu_ldap_rebind: timestamp OK\n");
+#endif /* DEBUG */
+      return (0);
     }
   }
--
returning from amu_ldap_rebind() before attempting to ldap_open() ldap_bind_s().

Version-Release number of selected component (if applicable):
am-utils-6.0.9-15

How reproducible:
Always

Steps to Reproduce:
1. setup automounter with ldap.
2. see connections leaking.
  
Actual results:
Leakage of hundreds of fd's.

Expected results:
no leakage after closing a conection.

Additional info:
[patch] attached and verified by the customer.

Comment 1 Jose Plans 2007-10-08 11:41:42 UTC
Created attachment 219661 [details]
am-utils-ldap-rebind.patch

Comment 5 Karel Zak 2007-10-08 18:45:25 UTC
Please, update to amd-6.0.9-16 (RHEL4.6), see:
errata 2007:0782, and bug #237751 

Comment 7 RHEL Program Management 2007-10-11 18:05:07 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 8 Jose Plans 2007-10-16 13:24:50 UTC

*** This bug has been marked as a duplicate of 237751 ***

Comment 9 Ludek Smid 2008-01-08 13:05:59 UTC
Closed in 4.6, cleared rhel-4.6.z flag.


Note You need to log in before you can comment on or make changes to this bug.