[15676] in Kerberos_V5_Development
Re: issue with krb5_prompter_posix() design
daemon@ATHENA.MIT.EDU (Russ Allbery)
Thu Apr 15 18:00:26 2010
From: Russ Allbery <rra@stanford.edu>
To: MIT Kerberos Dev List <krbdev@mit.edu>
In-Reply-To: <20100415214929.GY10389@Sun.COM> (Nicolas Williams's message of
"Thu, 15 Apr 2010 16:49:30 -0500")
Date: Thu, 15 Apr 2010 15:00:20 -0700
Message-ID: <87r5mgcr63.fsf@windlord.stanford.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: krbdev-bounces@mit.edu
Nicolas Williams <Nicolas.Williams@oracle.com> writes:
> On Thu, Apr 15, 2010 at 02:31:02PM -0700, Russ Allbery wrote:
>> This allocator/deallocator matching problem is often thought of as only
>> a Windows issue, and hence not relevant to PAM, but I'm seeing more and
>> more application software use its own allocators for one reason or
>> another. (OpenLDAP, for example.) In combination with dynamically
>> loaded libraries and modules and various types of symbol binding, this
>> can cause weird issues if allocations and deallocations cross library
>> boundaries.
> Note though: while I think good hygiene alone demands that allocation/
> deallocation not cross API boundaries, it is a very, very, very, very,
> very, very, very, VERY bad idea to make libraries use their own
> allocators by default, and worse, much, much, much worse to _require_
> that their callers tell them what allocators to use. The same thing
> applies to synchronization primitives.
Yes, agreed. To be clear, custom allocators come up with OpenLDAP in the
context of the slapd server, not the library.
> All library API designers should expect multiple distinct callers in one
> process and aim to have zero global variables/state. Any state that one
> is tempted to think of as global should be encapsulated in a handle
> (such as krb5_context). Look at any major library that you can think
> of, say, NSS, PKCS#11, OpenSSL, libevent -- all of them have got this
> wrong, and some of them have thankfully evolved to address this (e.g.,
> libevent).
Yes. The library world thankfully looks a lot more like object-oriented C
than it used to, but there's still work to do there. (The most relevant
example I can think of in the Kerberos library space is the difficulty in
specifying the Kerberos configuration, default ticket cache, and keytab
file through various API boundaries, particularly GSS-API; there are APIs
that mostly do the right thing for some of those, but they're not widely
used. And memory ticket caches are exactly the sort of global state
that's hard to deal with and breaks in various shared library combination
scenarios.)
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
_______________________________________________
krbdev mailing list krbdev@mit.edu
https://mailman.mit.edu/mailman/listinfo/krbdev