On Sun, 4 Mar 2001, Andrew Morgan wrote: > > I don't follow you here. How does the Linux-PAM definition give us more > > flexibility? All I see is added complexity. If the double-pointer is > Its been my experience that an extra layer of abstraction generally > means more flexibility. > If I'm a module writer, I'm not allowed to use writable static data > since I have to watch out for the application calling pam_start() > multiple times. But I can use static read-only data. > I might need to do a conversation like this: {PAM_TEXT:"You need to > re-enter your password"} {PAM_NOECHO, "password for luser: "}. With the > Linux-PAM convention, I can build the message structure for the first > prompt at compile time, and simply malloc a pointer array at run time. > With the Solaris definition, I need to malloc the whole pam_message > array structure in one go and copy in each prompt. > If I have a variable number of prompts depending on context and I want > to construct the conversation out of a fixed set of prompts, then I can > mix and match with fewer memory copies than if I have to memcpy message > arrays at run time. Ah... Yes, I see now. Though not necessarily compelling, this capability does offset the additional complexity. Until now it's seemed to me that the Linux-PAM way included more hoops to jump through, but no additional functionality. > > for (i = 0; i < pam_prompts; i++) { > > pmsg[i] = &msg[i]; > > } > > into the code, whereas with the Solaris interpretation, > > pmsg = &msg; > > would be sufficient. I think the first method obfuscates more than it does > This makes very little sense to me as an argument. Are you saying that > this one module is some sort of definition of correct behavior? My meaning was that, all things being equal, the simpler approach is preferable. But I accept your evidence that all things are not equal here. > How the FreeBSD folk messed this up I have no idea. They used the Linux > codebase, and besides inheriting sample source code, they had explicit > directions in the inherited documentation for this issue. I think you > will find that to this day Sun has not documented its preferred behavior > anywhere. See my reply to Nico; I was jumping to conclusions here, and don't know with any certainty what the behavior of FreeBSD's implementation is. Steve Langasek postmodern programmer