Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 655134

Summary: proxy tunnel support for LDAP requests is broken
Product: Red Hat Enterprise Linux 6 Reporter: Kamil Dudka <kdudka>
Component: curlAssignee: Kamil Dudka <kdudka>
Status: CLOSED ERRATA QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: jentrena, mhusnain, mvadkert, ovasik, prc
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
libcurl failed when an LDAP request was sent using curl through a HTTP proxy in tunnel mode (curl option "-p" or "--proxytunnel"). Curl tried to connect directly to the LDAP server via the proxy port and consequently failed. This is now fixed to allow libcurl LDAP connections through HTTP proxies to work as expected.
Story Points: ---
Clone Of: 655073 Environment:
Last Closed: 2011-05-19 13:12:29 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:
Bug Depends On:    
Bug Blocks: 655073    
Attachments:
Description Flags
ugly draft of a patch none

Comment 2 Kamil Dudka 2010-11-19 18:06:17 UTC
In contrast to the RHEL-5 sibling (bug 655073 comment #2), we have ldap_init_fd() available in RHEL-6 openldap.  We, however, still need to patch lib/ldap.c, instead of lib/openldap.c, which the upstream patch is applied against.

Comment 5 Pierre Carrier 2010-11-21 17:32:43 UTC
Created attachment 461845 [details]
ugly draft of a patch

Comment 8 Kamil Dudka 2010-11-22 21:38:31 UTC
Great work!  I can indeed connect to LDAP with/without proxy on RHEL-6 using your patch and test-case, spotted only a few differences with the upstream patch:

1) There is no string given as URL to ldap_init_fd().  But to be honest, I am not sure if the string is ever used by the LDAP protocol.  The upstream code passes in something like "ldap://ldap.corp.redhat.com:3128", which feels wrong to me.  3128 is port of the http proxy, not the port of LDAP.

2) There is no check of ldap_init_fd() return value.  It seems to be OK, because the LDAP pointer is nullified before the first return from ldap_init_fd():

ldap_init_fd(
  ber_socket_t fd,
  int proto,
  LDAP_CONST char *url,
  LDAP **ldp
)
{
  int rc;
  LDAP *ld;
  LDAPConn *conn;

  *ldp = NULL;
  rc = ldap_create( &ld );
  if( rc != LDAP_SUCCESS )
    return( rc );
  ...

3) There is no #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_PROXY) around the proxy connection code, but that should be fine for RHEL-6.

Comment 11 Kamil Dudka 2010-11-22 23:14:00 UTC
(In reply to comment #8)
> 1) There is no string given as URL to ldap_init_fd().  But to be honest, I am
> not sure if the string is ever used by the LDAP protocol.  The upstream code
> passes in something like "ldap://ldap.corp.redhat.com:3128", which feels wrong
> to me.  3128 is port of the http proxy, not the port of LDAP.

I believe it was a bug, thus pushed a one-line fix for that upstream:

https://github.com/bagder/curl/commit/d212fe4

Comment 13 Kamil Dudka 2010-11-23 00:05:27 UTC
I quickly checked configure.ac and I don't think this patch would be much interesting from upstream perspective.  The choice between lib/ldap.c and lib/openldap.c is based exactly on the availability of ldap_init_fd().  So there is no point in making the lib/ldap.c code using that function, because the code would not run anyway in that case:

https://github.com/bagder/curl/blob/master/configure.ac#L878

I am fine with keeping your patch for RHEL-6 as it as now.

Comment 16 Kamil Dudka 2010-11-26 15:13:49 UTC
available updates for stable Fedora:

curl-7.20.1-5.fc13
curl-7.21.0-6.fc14

Comment 20 Misha H. Ali 2011-04-20 01:17:37 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
libcurl failed when an LDAP request was sent using curl through a HTTP proxy in tunnel mode (curl option "-p" or "--proxytunnel"). Curl tried to connect directly to the LDAP server via the proxy port, hence failed. This is now fixed to allow libcurl LDAP connections through HTTP proxies to work as expected.

Comment 21 Misha H. Ali 2011-04-20 01:28:46 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-libcurl failed when an LDAP request was sent using curl through a HTTP proxy in tunnel mode (curl option "-p" or "--proxytunnel"). Curl tried to connect directly to the LDAP server via the proxy port, hence failed. This is now fixed to allow libcurl LDAP connections through HTTP proxies to work as expected.+libcurl failed when an LDAP request was sent using curl through a HTTP proxy in tunnel mode (curl option "-p" or "--proxytunnel"). Curl tried to connect directly to the LDAP server via the proxy port and consequently failed. This is now fixed to allow libcurl LDAP connections through HTTP proxies to work as expected.

Comment 22 errata-xmlrpc 2011-05-19 13:12:29 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0573.html