URL: https://github.com/SSSD/sssd/pull/5743
Author: pbrezina
 Title: #5743: ad: fallback to ldap if cldap is not available in libldap
Action: opened

PR body:
"""
Some distributions do not have cldap support available in libldap. Now
we fallback to ad ping over ldap conditionally during build time.

Resolves: https://github.com/SSSD/sssd/issues/5720

```
:fixes: AD ping is now sent over `ldap` if `cldap` support is not available
  during build. This helps to build SSSD on distributions without `cldap`
  support in `libldap`.
```
"""

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/5743/head:pr5743
git checkout pr5743
From 97d1205336c5117c2dff73187bfeaff700eef165 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrez...@redhat.com>
Date: Wed, 11 Aug 2021 12:29:42 +0200
Subject: [PATCH] ad: fallback to ldap if cldap is not available in libldap

Some distributions do not have cldap support available in libldap. Now
we fallback to ad ping over ldap conditionally during build time.

Resolves: https://github.com/SSSD/sssd/issues/5720

:fixes: AD ping is now sent over `ldap` if `cldap` support is not available
  during build. This helps to build SSSD on distributions without `cldap`
  support in `libldap`.
---
 src/external/ldap.m4             |  3 ++-
 src/providers/ad/ad_cldap_ping.c | 11 +++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/external/ldap.m4 b/src/external/ldap.m4
index cd13fde624..f42023cd44 100644
--- a/src/external/ldap.m4
+++ b/src/external/ldap.m4
@@ -67,7 +67,8 @@ LIBS="$LIBS $OPENLDAP_LIBS"
 AC_CHECK_FUNCS([ldap_control_create ldap_init_fd \
                 ldap_create_deref_control_value  \
                 ldap_parse_derefresponse_control \
-                ldap_derefresponse_free])
+                ldap_derefresponse_free \
+                ldap_is_ldapc_url])
 AC_CHECK_MEMBERS([struct ldap_conncb.lc_arg],
                  [AC_RUN_IFELSE(
                    [AC_LANG_PROGRAM(
diff --git a/src/providers/ad/ad_cldap_ping.c b/src/providers/ad/ad_cldap_ping.c
index 7722af98a0..889ad420c8 100644
--- a/src/providers/ad/ad_cldap_ping.c
+++ b/src/providers/ad/ad_cldap_ping.c
@@ -36,6 +36,12 @@
 #include "providers/ldap/sdap_async.h"
 #include "db/sysdb.h"
 
+#ifdef HAVE_LDAP_IS_LDAPC_URL
+#define AD_PING_PROTOCOL "cldap"
+#else
+#define AD_PING_PROTOCOL "ldap"
+#endif
+
 struct ad_cldap_ping_dc_state {
     struct tevent_context *ev;
     struct sdap_options *opts;
@@ -76,8 +82,9 @@ static struct tevent_req *ad_cldap_ping_dc_send(TALLOC_CTX *mem_ctx,
     state->ad_domain = ad_domain;
 
     subreq = sdap_connect_host_send(state, ev, opts, be_res->resolv,
-                                    be_res->family_order, host_db, "cldap",
-                                    dc->host, dc->port, false);
+                                    be_res->family_order, host_db,
+                                    AD_PING_PROTOCOL, dc->host, dc->port,
+                                    false);
     if (subreq == NULL) {
         ret = ENOMEM;
         goto done;
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/sssd-devel@lists.fedorahosted.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to