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

Re: An interference between PAM and other libraries [was: Linux-PAM and syslog]



On Sun, 29 Mar 1998, Cristian Gafton wrote:
>On Sun, 29 Mar 1998, Savochkin Andrey Vladimirovich wrote:
>> Do you consider my strdup() call as a hack?
[...]
>You don't compare the same things here. The gethostbyXXX calls alter
>some information in _structures_ that you know that are subject to this
>modifications. Like struct passwd, struct hostent, etc, etc.
>
>Syslog in this case is different. You don't have access to that internal
>file descriptor and you can not save the state. Why don't you get it
>? Not only you get your program state modified, but the PAM lib is doing
>a closelog() for you ! It's broken.

To clarify, gethostbyname() is giving the caller access to its own state.
Even though you have access to that data, that data is still "owned"
and maintained by gethostbyname().  It's also important to note that
gethostbyname() is explicitly giving you a pointer to that information;
it's explicitly sharing it with the caller.

PAM, on the other hand, is stealing data from the caller, data that
the caller has not explicitly shared and may not want to share.  PAM is
taking advantage of the fact that the library implementation keeps certain
data in a global scope.  Use of PAM has side-effects, side-effects are
to be avoided because they introduce confusion and unpredictability.
That's basic computer science.

-- 
    Steve Coile
 scoile@patriot.net



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