X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsession.c;h=491d3bfaac11c79791f5fd3eba2628aa89397a4a;hp=05dcb769994190879741a83dca51fe952113ad6d;hb=7a7ed0a1a26961a165fd17183fd161c36a4b088f;hpb=e5b9a1061f126b36c558aea09fd76fd691ebf018 diff --git a/pppd/session.c b/pppd/session.c index 05dcb76..491d3bf 100644 --- a/pppd/session.c +++ b/pppd/session.c @@ -73,6 +73,11 @@ #include #include #include +#include +#include +#include +#include +#include #include "pppd.h" #include "session.h" @@ -164,8 +169,8 @@ session_start(flags, user, passwd, ttyName, msg) const char *ttyName; char **msg; { - bool ok = 1; #ifdef USE_PAM + bool ok = 1; const char *usr; int pam_error; bool try_session = 0; @@ -289,9 +294,11 @@ session_start(flags, user, passwd, ttyName, msg) #else /* #ifdef USE_PAM */ /* - * Use the non-PAM methods directly + * Use the non-PAM methods directly. 'pw' will remain NULL if the user + * has not been authenticated using local UNIX system services. */ + pw = NULL; if ((SESS_AUTH & flags)) { pw = getpwnam(user); @@ -357,7 +364,12 @@ session_start(flags, user, passwd, ttyName, msg) logged_in = 1; #if defined(_PATH_LASTLOG) && !defined(USE_PAM) - { + /* + * Enter the user in lastlog only if he has been authenticated using + * local system services. If he has not, then we don't know what his + * UID might be, and lastlog is indexed by UID. + */ + if (pw != NULL) { struct lastlog ll; int fd;