[MacPorts] #62468: _sasl_locate_entry() in Cyrus SASL's lib/dlopen.c assumes a leading underscore is needed for calls to dlsym()

MacPorts noreply at macports.org
Wed Mar 17 00:44:33 UTC 2021


#62468: _sasl_locate_entry() in Cyrus SASL's lib/dlopen.c assumes a leading
underscore is needed for calls to dlsym()
---------------------------------------------+--------------------
  Reporter:  steven-michaud                  |      Owner:  (none)
      Type:  defect                          |     Status:  new
  Priority:  Normal                          |  Milestone:
 Component:  ports                           |    Version:
Resolution:                                  |   Keywords:
      Port:  cyrus-sasl2 @2.1.27_2+kerberos  |
---------------------------------------------+--------------------
Description changed by kencu:

Old description:

> I've installed cyrus-sasl2 @2.1.27_2+kerberos on macOS 11.2.3 and have
> been using it with postfix @3.5.9_0+dovecot_sasl+pcre+sasl+tls and
> dovecot @2.3.11.3_2. Sending mail with STARTTLS and the SASL PLAIN
> mechanism simply didn't work. I've spent the last several days debugging
> the problem, and now I've found the cause.
>
> Here's a fragment of code from _sasl_locate_entry():
>
> #if defined(DLSYM_NEEDS_UNDERSCORE) || (defined(__OpenBSD__) &&
> !defined(__ELF__))
>     snprintf(adj_entryname, sizeof adj_entryname, "_%s", entryname);
> #endif
>
>     *entry_point = NULL;
>     *entry_point = dlsym(library, adj_entryname);
>     if (*entry_point == NULL) {
> #if 0 /* This message appears to confuse people */
>       _sasl_log(NULL, SASL_LOG_DEBUG,
>                 "unable to get entry point %s: %s", adj_entryname,
>                 dlerror());
> #endif
>       return SASL_FAIL;
>     }
>
> By means of various tests, and by looking at libsasl2.3.dylib in a
> disassembler, I've found that (in your distro) this code is behaving as
> if DLSYM_NEEDS_UNDERSCORE is defined. Of course it shouldn't be. I don't
> know why. The sasl_cv_dlsym_adds_uscore test in configure.ac looks like
> it should work. Could your cyrus_sasl2 distro have been compiled on
> something other than a Mac? In other words, might it have been cross-
> compiled on some other kind of system (e.g. Linux)?
>
> Every time I try to send mail via STARTTLS and the SASL PLAIN mechanism,
> I get the error message "No worthy mechs found". Postfix is correctly set
> up -- the same setup works fine on other machines which use Cyrus SASL
> from other providers (like Apple). The reason is that my connection's
> list of mechanisms (sasl_client_conn_t.mech_list) only includes the
> "EXTERNAL" mechanism. sasl_client_add_plugin() is only ever called on
> this mechanism. The reason it isn't called on all the others (including
> the PLAIN mechanism) is that _sasl_locate_entry() (called from
> _sasl_plugin_load()) always fails, because it always adds an underscore
> in front of entryname.

New description:

 I've installed cyrus-sasl2 @2.1.27_2+kerberos on macOS 11.2.3 and have
 been using it with postfix @3.5.9_0+dovecot_sasl+pcre+sasl+tls and dovecot
 @2.3.11.3_2. Sending mail with STARTTLS and the SASL PLAIN mechanism
 simply didn't work. I've spent the last several days debugging the
 problem, and now I've found the cause.

 Here's a fragment of code from _sasl_locate_entry():
 {{{
 #if defined(DLSYM_NEEDS_UNDERSCORE) || (defined(__OpenBSD__) &&
 !defined(__ELF__))
     snprintf(adj_entryname, sizeof adj_entryname, "_%s", entryname);
 #endif

     *entry_point = NULL;
     *entry_point = dlsym(library, adj_entryname);
     if (*entry_point == NULL) {
 #if 0 /* This message appears to confuse people */
       _sasl_log(NULL, SASL_LOG_DEBUG,
                 "unable to get entry point %s: %s", adj_entryname,
                 dlerror());
 #endif
       return SASL_FAIL;
     }
 }}}
 By means of various tests, and by looking at libsasl2.3.dylib in a
 disassembler, I've found that (in your distro) this code is behaving as if
 DLSYM_NEEDS_UNDERSCORE is defined. Of course it shouldn't be. I don't know
 why. The sasl_cv_dlsym_adds_uscore test in configure.ac looks like it
 should work. Could your cyrus_sasl2 distro have been compiled on something
 other than a Mac? In other words, might it have been cross-compiled on
 some other kind of system (e.g. Linux)?

 Every time I try to send mail via STARTTLS and the SASL PLAIN mechanism, I
 get the error message "No worthy mechs found". Postfix is correctly set up
 -- the same setup works fine on other machines which use Cyrus SASL from
 other providers (like Apple). The reason is that my connection's list of
 mechanisms (sasl_client_conn_t.mech_list) only includes the "EXTERNAL"
 mechanism. sasl_client_add_plugin() is only ever called on this mechanism.
 The reason it isn't called on all the others (including the PLAIN
 mechanism) is that _sasl_locate_entry() (called from _sasl_plugin_load())
 always fails, because it always adds an underscore in front of entryname.

--

-- 
Ticket URL: <https://trac.macports.org/ticket/62468#comment:16>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list