#include <string.h>
#include <pwd.h>
#include <crypt.h>
+#include <shadow.h>
+#include <time.h>
+#include <utmp.h>
+#include <fcntl.h>
+#include <unistd.h>
#include "pppd.h"
#include "session.h"
const char *ttyName;
char **msg;
{
- bool ok = 1;
#ifdef USE_PAM
+ bool ok = 1;
const char *usr;
int pam_error;
bool try_session = 0;
#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);
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;