]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Maintenance: rework SASL detection (#1694)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Wed, 20 Mar 2024 15:24:05 +0000 (15:24 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Wed, 20 Mar 2024 15:24:17 +0000 (15:24 +0000)
MacOS Homebrew offers Cyrus SASL.

acinclude/squid-util.m4
configure.ac
doc/release-notes/release-7.sgml.in
src/acl/external/kerberos_ldap_group/Makefile.am
src/acl/external/kerberos_ldap_group/required.m4
src/acl/external/kerberos_ldap_group/support.h
src/acl/external/kerberos_ldap_group/support_ldap.cc
src/acl/external/kerberos_ldap_group/support_sasl.cc
src/auth/basic/SASL/Makefile.am
src/auth/basic/SASL/required.m4

index 45584f3bd504e0d86f6b94be758c40c0ad5f5802..c71f975aac988b6658d0f8b9a5d4d92ebfbb1ba4 100644 (file)
@@ -332,30 +332,3 @@ AS_IF([test "$ac_res" != no],[
   $3],[$4])
 AS_VAR_POPDEF([ac_Search])dnl
 ])
-
-dnl Check for Cyrus SASL
-AC_DEFUN([SQUID_CHECK_SASL],[
-  squid_cv_check_sasl="auto"
-  AC_CHECK_HEADERS([sasl/sasl.h sasl.h])
-  AC_CHECK_LIB(sasl2,sasl_errstring,[LIBSASL="-lsasl2"],[
-    AC_CHECK_LIB(sasl,sasl_errstring,[LIBSASL="-lsasl"], [
-      squid_cv_check_sasl="no"
-    ])
-  ])
-  AS_IF([test "$squid_host_os" = "darwin"],[
-    AS_IF([test "$ac_cv_lib_sasl2_sasl_errstring" = "yes"],[
-      AC_DEFINE(HAVE_SASL_DARWIN,1,[Define to 1 if Mac Darwin without sasl.h])
-      echo "checking for MAC Darwin without sasl.h ... yes"
-      squid_cv_check_sasl="yes"
-    ],[
-      echo "checking for MAC Darwin without sasl.h ... no"
-      squid_cv_check_sasl="no"
-    ])
-  ])
-  AS_IF([test "x$squid_cv_check_sasl" = "xno"],[
-    AC_MSG_WARN([Neither SASL nor SASL2 found])
-  ],[
-    squid_cv_check_sasl="yes"
-  ])
-  AC_SUBST(LIBSASL)
-])
index 4f0d7651cded572043da3aba3f61c67269e856d1..6054c881a909f22d10634ef107fef2a1a081c348 100644 (file)
@@ -1207,6 +1207,16 @@ SQUID_CHECK_LIB_WORKS(ldap,[
   SQUID_STATE_ROLLBACK(squid_ldap_state)
 ])
 
+SQUID_AUTO_LIB(sasl,[Cyrus SASL],[LIBSASL])
+SQUID_CHECK_LIB_WORKS([sasl],[
+  SQUID_STATE_SAVE(sasl_state)
+  PKG_CHECK_MODULES([LIBSASL],[libsasl2],[:],[:])
+  CPPFLAGS="$LIBSASL_CFLAGS $CPPFLAGS"
+  LIBS="$LIBSASL_LIBS $LIBS"
+  AC_CHECK_HEADERS([sasl/sasl.h sasl.h])
+  SQUID_STATE_ROLLBACK(sasl_state)
+])
+
 SQUID_AUTO_LIB(systemd,[systemd API for start-up notification],[LIBSYSTEMD])
 SQUID_CHECK_LIB_WORKS(systemd,[
   SQUID_STATE_SAVE(squid_systemd_state)
index c08c73e9dea5507d3bd86a6394ff347d3ac38884..971e5a36de04693568ad985117ad4959480d1f72 100644 (file)
@@ -194,6 +194,9 @@ This section gives an account of those changes in three categories:
        <tag>--without-psapi</tag>
        <p>Disable auto-detection of Windows PSAPI library.
 
+       <tag>--without-sasl</tag>
+       <p>Disable auto-detection of Cyrus SASL (or compatible) library.
+
        <tag>CPPFLAGS=-DINCOMING_FACTOR=</tag>
        <p>Control the listening sockets responsiveness with poll(2) and select(2).
           The higher the INCOMING_FACTOR, the slower the algorithm will
index c76c94820a5858d2c2ed6080e06bc1c04f758f7d..03b4d032be6ac2ec11841e935849fbc996c21b4d 100644 (file)
@@ -40,5 +40,5 @@ ext_kerberos_ldap_group_acl_LDADD = \
        $(LIBHEIMDAL_KRB5_LIBS) \
        $(LIBLDAP_LIBS) \
        $(LIBMIT_KRB5_LIBS) \
-       $(LIBSASL) \
+       $(LIBSASL_LIBS) \
        $(XTRA_LIBS)
index 0298bf2e34adf6e16181e0fc385866b359f9a472..16978cc35fdb8ce93055dcedcac70e1903383863 100644 (file)
@@ -6,6 +6,7 @@
 ##
 
 AS_IF([test "x$LIBMIT_KRB5_LIBS" != "x" -o "x$LIBHEIMDAL_KRB5_LIBS" != "x" -o "x$LIBGSS_LIBS" != "x"],[
-  SQUID_CHECK_SASL
-  AS_IF([test "x$LIBLDAP_LIBS" != "x"],[BUILD_HELPER="kerberos_ldap_group"])
+  AS_IF([test "x$LIBLDAP_LIBS" != "x" -a "x$LIBSASL_LIBS" != "x"],[
+    BUILD_HELPER="kerberos_ldap_group"
+  ])
 ])
index 3073b8cd8ab19222617b7906b4cf8cd89386e272..124c55655144c7dd64d2a01863ee8c931799cb5c 100644 (file)
@@ -149,7 +149,7 @@ size_t get_ldap_hostname_list(struct main_args *margs, struct hstruct **hlist, s
 size_t get_hostname_list(struct hstruct **hlist, size_t nhosts, char *name);
 size_t free_hostname_list(struct hstruct **hlist, size_t nhosts);
 
-#if HAVE_SASL_H || HAVE_SASL_SASL_H || HAVE_SASL_DARWIN
+#if HAVE_SASL_H || HAVE_SASL_SASL_H
 int tool_sasl_bind(LDAP * ld, char *binddn, char *ssl);
 #endif
 
index 9a1f8ed752f5e957c6d4febf2b0c81e6cb429fc6..3a7902924dcc81051221384d22cf7c4fdaf314a3 100644 (file)
@@ -85,7 +85,7 @@ int search_group_tree(struct main_args *margs, LDAP * ld, char *bindp,
 #if HAVE_SUN_LDAP_SDK || HAVE_MOZILLA_LDAP_SDK
 #if HAVE_LDAP_REBINDPROC_CALLBACK
 
-#if HAVE_SASL_H || HAVE_SASL_SASL_H || HAVE_SASL_DARWIN
+#if HAVE_SASL_H || HAVE_SASL_SASL_H
 static LDAP_REBINDPROC_CALLBACK ldap_sasl_rebind;
 
 static int LDAP_CALL LDAP_CALLBACK
@@ -121,7 +121,7 @@ ldap_simple_rebind(LDAP * ld,
                             nullptr);
 }
 #elif HAVE_LDAP_REBIND_PROC
-#if HAVE_SASL_H || HAVE_SASL_SASL_H || HAVE_SASL_DARWIN
+#if HAVE_SASL_H || HAVE_SASL_SASL_H
 static LDAP_REBIND_PROC ldap_sasl_rebind;
 
 static int
@@ -131,7 +131,7 @@ ldap_sasl_rebind(LDAP * ld,
     struct ldap_creds *cp = (struct ldap_creds *) params;
     return tool_sasl_bind(ld, cp->dn, cp->pw);
 }
-#endif /* HAVE_SASL_H || HAVE_SASL_SASL_H || HAVE_SASL_DARWIN */
+#endif /* HAVE_SASL_H || HAVE_SASL_SASL_H */
 
 static LDAP_REBIND_PROC ldap_simple_rebind;
 
@@ -153,7 +153,7 @@ ldap_simple_rebind(LDAP * ld,
 #ifndef LDAP_REFERRALS
 #define LDAP_REFERRALS
 #endif /* LDAP_REFERRALS */
-#if HAVE_SASL_H || HAVE_SASL_SASL_H || HAVE_SASL_DARWIN
+#if HAVE_SASL_H || HAVE_SASL_SASL_H
 static LDAP_REBIND_FUNCTION ldap_sasl_rebind;
 
 static int
@@ -192,7 +192,7 @@ ldap_simple_rebind(LDAP * ld,
 #error "No rebind functione defined"
 #endif
 #else /* HAVE_SUN_LDAP_SDK */
-#if HAVE_SASL_H || HAVE_SASL_SASL_H || HAVE_SASL_DARWIN
+#if HAVE_SASL_H || HAVE_SASL_SASL_H
 static LDAP_REBIND_PROC ldap_sasl_rebind;
 
 static int
@@ -1070,7 +1070,7 @@ get_memberof(struct main_args *margs, char *user, char *domain, char *group)
              * ldap bind with SASL/GSSAPI authentication (only possible if a domain was part of the username)
              */
 
-#if HAVE_SASL_H || HAVE_SASL_SASL_H || HAVE_SASL_DARWIN
+#if HAVE_SASL_H || HAVE_SASL_SASL_H
             debug((char *)
                   "%s| %s: DEBUG: Bind to ldap server with SASL/GSSAPI\n",
                   LogTime(), PROGRAM);
index 6633c7c5349808341e0bb5834ce2fe08beaef479..1b62c62e5fa25f9364d177df9315c2c3728fef04 100644 (file)
 #include <sasl.h>
 #elif HAVE_SASL_SASL_H
 #include <sasl/sasl.h>
-#elif HAVE_SASL_DARWIN
-typedef struct sasl_interact {
-    unsigned long id;       /* same as client/user callback ID */
-    const char *challenge;  /* presented to user (e.g. OTP challenge) */
-    const char *prompt;     /* presented to user (e.g. "Username: ") */
-    const char *defresult;  /* default result string */
-    const void *result;     /* set to point to result */
-    unsigned len;       /* set to length of result */
-} sasl_interact_t;
-
-#define SASL_CB_USER         0x4001 /* client user identity to login as */
-#define SASL_CB_AUTHNAME     0x4002 /* client authentication name */
-#define SASL_CB_PASS         0x4004 /* client passphrase-based secret */
-#define SASL_CB_ECHOPROMPT   0x4005 /* challenge and client enterred result */
-#define SASL_CB_NOECHOPROMPT 0x4006 /* challenge and client enterred result */
-#define SASL_CB_GETREALM     0x4008 /* realm to attempt authentication in */
-#define SASL_CB_LIST_END   0    /* end of list */
 #endif
 
-#if HAVE_SASL_H || HAVE_SASL_SASL_H || HAVE_SASL_DARWIN
+#if HAVE_SASL_H || HAVE_SASL_SASL_H
 void *lutil_sasl_defaults(
     LDAP * ld,
     char *mech,
index b487f33a13b04228a85abe618a8c550f53a5dc54..eeab73a03c8df816d6b6a3eabc4fa89c4664f468 100644 (file)
@@ -15,7 +15,7 @@ basic_sasl_auth_SOURCES = \
 basic_sasl_auth_LDADD= \
        $(top_builddir)/lib/libmiscencoding.la \
        $(COMPAT_LIB) \
-       $(LIBSASL) \
+       $(LIBSASL_LIBS) \
        $(XTRA_LIBS)
 
 EXTRA_DIST= \
index d50d7a15568163badb3750874368fab17ce3431c..dd26615aabb666b024f02b15bd58ab918914b74f 100755 (executable)
@@ -5,5 +5,4 @@
 ## Please see the COPYING and CONTRIBUTORS files for details.
 ##
 
-SQUID_CHECK_SASL
-AS_IF([test "x$squid_cv_check_sasl" = "xyes"],[BUILD_HELPER="SASL"])
+AS_IF([test "x$LIBSASL_LIBS" != "x"],[BUILD_HELPER="SASL"])