[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: krb5_config_set

On Sat, 4 Aug 2007 20:19:23 +0200
Love Hörnquist Åstrand <lha@kth.se> wrote:

> Hello Michael,
> > I want to implement krb5_config_set, krb5_config_vset ... etc. Is  
> > it safe
> > to delete, replace and elements to the krb5_config_section *cf  
> > member of
> > the krb5_context? Or could deleting an element create a dangling  
> > pointer
> > somewhere? I'm just wondering what you think about the whole idea.
> Much of the code today assumes that krb5_config_get_string returns a  
> static
> string, so if you want to change the strings you have to modify all  
> consumers
> to make a local copy.
> krb5_config is heimdal specific, so its possible to change the  
> interface.

Hey Love,

It seems to me you could just change the semantics of the API slightly
such that the man page might read:

  "The string returned by krb5_config_get_string may not be valid after
  a call to krb5_config_set_string"

Which is to say, if the caller needs to save the string for anything
beyond the immediate stack frame, they better make a copy.