[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#6257) libldap: getopt flag to return the SASL username

masarati@aero.polimi.it wrote:
> My concern was not from an operational point of view: the simple concept
> of having a library dynamically loading something that could no longer be
> present is calling for trouble, unless handled appropriately, and probably
> there is no way to do it safely as one could always remove a .so while
> it's in use (although I guess on any decent system the object will be
> cached or loaded somewhere until it's in use).
> My concern is about the char* array returned by that call: if for any
> reason the library decides to refresh it, but the caller of
> ldap_get_option() is still holding a pointer to that array, this calls for
> pointing to freed memory and things like that, as far as I understand.
> For this reason, returning a copy sounds wiser.  Whether the contents of
> that copy is valid or not, namely the related mechanism is available or
> not, that's an entirely different issue.

The Cyrus mechlist is only initialized once during the life of the library. 
(Subsequent init calls just increment an init counter and then return.) It 
will not change in normal use. If an application loads / unloads / reloads the 
library, the list may change, but any app that goes thru this trouble will 
already know they have to call the init functions all over again, and re-fetch 
this list.

   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/