list mechs bug in cyrus-sasl 2.1.22 and memory leak

Quanah Gibson-Mount quanah at zimbra.com
Thu Jan 24 13:32:11 EST 2008


The problem does not occur with the Mac system sasl library.  It only 
occurs with stock builds of cyrus-sasl.  I.e., Apple's fixed the issue 
apparently, but their source is very heavily modified, I've just begun 
looking into it.  They also are using the rather old 2.1.18, and I need 
2.1.22. ;) The same issues with a stock 2.1.18 build as well.


Using 2.1.22 stock build:

build-mac:~/sasl build$ gcc -I/Users/build/sasl 
-I/opt/zimbra/cyrus-sasl/include/sasl -L/opt/zimbra/cyrus-sasl/lib -lsasl2 
testsuite.c

build-mac:~/sasl build$ ./a.out
Testing sasl_listmech()...
 [EXTERNAL,ANONYMOUS,ANONYMOUS,ANONYMOUS,CRAM-MD5,CRAM-MD5,CRAM-MD5,DIGEST-MD
5,DIGEST-MD5,DIGEST-MD5,GSSAPI,GSSAPI,GSSAPI,LOGIN,LOGIN,LOGIN,OTP,OTP,OTP,PLAIN,PLAIN,PLAIN]
Client mechlist:
 [PLAIN,PLAIN,PLAIN,OTP,OTP,OTP,LOGIN,LOGIN,LOGIN,GSSAPI,GSSAPI,GSSAPI,DIGEST
-MD5,DIGEST-MD5,DIGEST-MD5,CRAM-MD5,CRAM-MD5,CRAM-MD5,ANONYMOUS,ANONYMOUS,ANONYMOUS,EXTERNAL]
We have the following mechs:
 [PLAIN,PLAIN,PLAIN,LOGIN,LOGIN,LOGIN,GSSAPI,GSSAPI,GSSAPI,DIGEST-MD5,DIGEST-
MD5,DIGEST-MD5,CRAM-MD5,CRAM-MD5,CRAM-MD5,ANONYMOUS,ANONYMOUS,ANONYMOUS,EXTERNAL]
  Currently Still Allocated:
    502BF0 (  360)      00  00  00  00  00  00  00  00  00  00  00  00  ...
    502BB0 (   20)      00  00  00  01  00  00  00  00  00  'P' '+' E0  ...
    5029D0 (  360)      00  00  00  00  00  00  00  00  00  00  00  00  ...
    502990 (   20)      00  00  00  01  00  00  00  00  00  'P' ')' C0  ...
    500B10 (   20)      00  00  00  00  00  00  00  00  00  00  00  00  ...
    500A70 (   20)      00  00  00  00  00  00  00  00  00  00  00  00  ...
Failed with: memory error



Using the system SASL library instead:

build-mac:~/sasl build$ gcc -I/Users/build/sasl 
-I/opt/zimbra/cyrus-sasl/include/sasl -L/usr/lib -lsasl2 testsuite.c

Testing sasl_listmech()...
 [EXTERNAL,APOP,DHX,WEBDAV-DIGEST,ANONYMOUS,CRAM-MD5,DIGEST-MD5,GSSAPI,LOGIN,
NTLM,OTP,PLAIN,MS-CHAPv2,SMB-LAN-MANAGER,SMB-NT,SMB-NTLMv2]
Client mechlist:
 [SMB-NTLMv2,SMB-NT,SMB-LAN-MANAGER,MS-CHAPv2,PLAIN,OTP,NTLM,LOGIN,GSSAPI,DIG
EST-MD5,CRAM-MD5,ANONYMOUS,WEBDAV-DIGEST,DHX,APOP,EXTERNAL]
We have the following mechs:
 [SMB-NTLMv2,SMB-NT,SMB-LAN-MANAGER,MS-CHAPv2,PLAIN,OTP,NTLM,LOGIN,GSSAPI,DIG
EST-MD5,CRAM-MD5,ANONYMOUS,WEBDAV-DIGEST,DHX,APOP,EXTERNAL]
  All memory accounted for!
Testing sasl_listmech()... ok


--Quanah

--On Thursday, January 24, 2008 1:20 PM -0500 Ken Murchison 
<murch at andrew.cmu.edu> wrote:

> I'll see if I can find a Mac on which to test the stock SASL source.  If
> Apple is modifying our source code, then you may have to take this up
> with them.
>
>
>
> Quanah Gibson-Mount wrote:
>> Me too.  This problem only occurs on the Mac (PPC or i386), and does not
>> show up on linux at all.  I'm guessing this is due to the Mac having a
>> slightly different source tree.  I've verified it goes back as far as
>> 2.1.18.
>>
>> The multi-listed mechanisms was what pointed me in the direction of
>> SASL, as that was what showed up in the OpenLDAP backtrace.
>>
>> --Quanah
>>
>> --On Thursday, January 24, 2008 1:05 PM -0500 Ken Murchison
>> <murch at andrew.cmu.edu> wrote:
>>
>>> I don't have access to a Mac to play with, but I can't reproduce this on
>>> my Linux dev box.  I'm curious why each of the plugin mechs is listed 3
>>> times.
>>>
>>>
>>> Quanah Gibson-Mount wrote:
>>>> In playing on the Mac platform, I found there is a bug in the mechanism
>>>> listing code on both PPC and x86 Mac.  From testsuite.c:
>>>>
>>>> Testing sasl_listmech()...
>>>> [EXTERNAL,ANONYMOUS,ANONYMOUS,ANONYMOUS,CRAM-MD5,CRAM-MD5,CRAM-MD5,DIG
>>>> ES T-MD
>>>>
>>>> 5,DIGEST-MD5,DIGEST-MD5,GSSAPI,GSSAPI,GSSAPI,LOGIN,LOGIN,LOGIN,OTP,OTP
>>>> ,O TP,PLAIN,PLAIN,PLAIN]
>>>>
>>>> Client mechlist:
>>>> [PLAIN,PLAIN,PLAIN,OTP,OTP,OTP,LOGIN,LOGIN,LOGIN,GSSAPI,GSSAPI,GSSAPI,
>>>> DI GEST
>>>>
>>>> -MD5,DIGEST-MD5,DIGEST-MD5,CRAM-MD5,CRAM-MD5,CRAM-MD5,ANONYMOUS,ANONYM
>>>> OU S,ANONYMOUS,EXTERNAL]
>>>>
>>>> We have the following mechs:
>>>> [PLAIN,PLAIN,PLAIN,LOGIN,LOGIN,LOGIN,GSSAPI,GSSAPI,GSSAPI,DIGEST-MD5,D
>>>> IG EST-
>>>>
>>>> MD5,DIGEST-MD5,CRAM-MD5,CRAM-MD5,CRAM-MD5,ANONYMOUS,ANONYMOUS,ANONYMOU
>>>> S, EXTERNAL]
>>>>
>>>>  Currently Still Allocated:
>>>>    302EE0 (  360)      00  00  00  00  00  00  00  00  00  00  00  00
>>>>    ... 302EA0 (   20)      01  00  00  00  00  00  00  00  D0  '.' '0'
>>>>    00  ... 302CC0 (  360)      00  00  00  00  00  00  00  00  00  00
>>>>    00  00  ... 302C80 (   20)      01  00  00  00  00  00  00  00  B0
>>>>    ',' '0' 00  ... 300AE0 (   20)      00  00  00  00  00  00  00  00
>>>>    00  00  00  00  ... 300A40 (   20)      00  00  00  00  00  00  00
>>>>    00  00  00  00  00  ... Failed with: memory error
>>>>
>>>>
>>>> Does anyone know of a fix for this?  I can't imagine I'm the first to
>>>> hit it.  It's causing problems with OpenLDAP, as after a while the
>>>> server will crash, and the stack trace on the core points to this being
>>>> the issue.
>>>>
>>>> Thanks!
>>>>
>>>> --Quanah
>>>>
>>>> --
>>>>
>>>> Quanah Gibson-Mount
>>>> Principal Software Engineer
>>>> Zimbra, Inc
>>>> --------------------
>>>> Zimbra ::  the leader in open source messaging and collaboration
>>>>
>>>
>>>
>>> --
>>> Kenneth Murchison
>>> Systems Programmer
>>> Project Cyrus Developer/Maintainer
>>> Carnegie Mellon University
>>
>>
>>
>> --
>>
>> Quanah Gibson-Mount
>> Principal Software Engineer
>> Zimbra, Inc
>> --------------------
>> Zimbra ::  the leader in open source messaging and collaboration
>>
>
>
> --
> Kenneth Murchison
> Systems Programmer
> Project Cyrus Developer/Maintainer
> Carnegie Mellon University



--

Quanah Gibson-Mount
Principal Software Engineer
Zimbra, Inc
--------------------
Zimbra ::  the leader in open source messaging and collaboration


More information about the Cyrus-sasl mailing list