Bug 323021

Summary: amd automounter and LDAP leaks sockets to the ldap server
Product: Red Hat Enterprise Linux 4 Reporter: Jose Plans <jplans>
Component: am-utilsAssignee: Karel Zak <kzak>
Status: CLOSED DUPLICATE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 4.5CC: tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-10-16 13:24:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
am-utils-ldap-rebind.patch none

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.