Re: BUG #2246: Bad malloc interactions: ecpg, openssl - Mailing list pgsql-bugs

From Stephen Frost
Subject Re: BUG #2246: Bad malloc interactions: ecpg, openssl
Date
Msg-id 20060214201413.GH4474@ns.snowman.net
Whole thread Raw
In response to BUG #2246: Bad malloc interactions: ecpg, openssl  ("Andy Klosterman" <andrew5@ece.cmu.edu>)
Responses Re: BUG #2246: Bad malloc interactions: ecpg, openssl
List pgsql-bugs
* Andrew Klosterman (andrew5@ece.cmu.edu) wrote:
> Alright, I have built a system with the symbols left into the binaries.
[...]
> Again, it is showing a bad malloc in what appears to be some code using
> kerberos.  But there's nothing in my setup that I can think of right now
> that should induce a connection to be set up using kerberos.

The Kerberos libraries are still called when support for them has been
compiled in.  They generally don't cause any problems though.  For some
reason the line numbers in the backtrace line up but the function names
don't quite (perhaps inlineing).  Anyhow, the error is being reported
down in 'krb5_init_context()' so either something strange is happening
or it's actually a Kerberos bug after all.  The reason the Kerberos
libraries are called is to get the 'username' to use, which is
determined prior to actually connecting to the backend (and finding
out what authentication mechanism the backend thinks we should be
trying).

It's kind of a chicken-and-egg here because the backend decides what
authentication mechanism to ask for based off the username (at least in
part) through pg_hba.conf, so you can't find out the authentication
method until you know the username so all methods to find the username
have to be exhausted.  You could avoid this by explicitly passing
'user=' into the connection parameters though...  Would be interesting
to know what happens then...

Might also be interesting to look into the Kerberos libraries to see why
they're attempting to malloc(0), perhaps there's a bug there when
Kerberos isn't set up on the machine?

    Thanks,

        Stephen

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #2257: Can' stop server while autovacuum is running
Next
From: Stephen Frost
Date:
Subject: Re: BUG #2246: Bad malloc interactions: ecpg, openssl