Bug 323021 - amd automounter and LDAP leaks sockets to the ldap server
amd automounter and LDAP leaks sockets to the ldap server
Status: CLOSED DUPLICATE of bug 237751
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: am-utils (Show other bugs)
4.5
All Linux
high Severity high
: ---
: ---
Assigned To: Karel Zak
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-08 07:41 EDT by Jose Plans
Modified: 2009-07-20 05:59 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-10-16 09:24:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Jose Plans 2007-10-08 07:41:41 EDT
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 07:41:42 EDT
Created attachment 219661 [details]
am-utils-ldap-rebind.patch
Comment 5 Karel Zak 2007-10-08 14:45:25 EDT
Please, update to amd-6.0.9-16 (RHEL4.6), see:
errata 2007:0782, and bug #237751 
Comment 7 RHEL Product and Program Management 2007-10-11 14:05:07 EDT
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 09:24:50 EDT

*** This bug has been marked as a duplicate of 237751 ***
Comment 9 Ludek Smid 2008-01-08 08:05:59 EST
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.