+2009-04-22 Nicolas François <nicolas.francois@centraliens.net>
+
+ * src/login.c: Removed temp_shell. No more used.
+ * src/login.c: lastlog is only used #ifndef USE_PAM
+ * src/login.c: Rename lastlog to ll to avoid name clash with the
+ lastlog type.
+
2009-04-22 Nicolas François <nicolas.francois@centraliens.net>
* src/login.c: Added update_utmp() to group the prepare_utmp and
#include <errno.h>
#include <grp.h>
+#ifndef USE_PAM
#include <lastlog.h>
+#endif /* !USE_PAM */
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
#endif /* USE_PAM */
+#ifndef USE_PAM
/*
* Needed for MkLinux DR1/2/2.1 - J.
*/
#ifndef LASTLOG_FILE
#define LASTLOG_FILE "/var/log/lastlog"
#endif
+#endif /* !USE_PAM */
/*
* Global variables
static char *username = NULL;
static int reason = PW_LOGIN;
-struct lastlog lastlog;
+#ifndef USE_PAM
+static struct lastlog ll;
+#endif /* !USE_PAM */
static bool pflg = false;
static bool fflg = false;
char fromhost[512];
struct passwd *pwd = NULL;
char **envp = environ;
-#ifndef USE_PAM
- static char temp_shell[] = "/bin/sh";
-#endif
const char *failent_user;
struct utmp *utent;
#ifndef USE_PAM /* pam_lastlog handles this */
if (getdef_bool ("LASTLOG_ENAB")) { /* give last login and log this one */
- dolastlog (&lastlog, pwd, tty, hostname);
+ dolastlog (&ll, pwd, tty, hostname);
}
#endif
}
}
if ( getdef_bool ("LASTLOG_ENAB")
- && (lastlog.ll_time != 0)) {
- time_t ll_time = lastlog.ll_time;
+ && (ll.ll_time != 0)) {
+ time_t ll_time = ll.ll_time;
#ifdef HAVE_STRFTIME
strftime (ptime, sizeof (ptime),
"%a %b %e %H:%M:%S %z %Y",
localtime (&ll_time));
printf (_("Last login: %s on %s"),
- ptime, lastlog.ll_line);
+ ptime, ll.ll_line);
#else
printf (_("Last login: %.19s on %s"),
- ctime (&ll_time), lastlog.ll_line);
+ ctime (&ll_time), ll.ll_line);
#endif
#ifdef HAVE_LL_HOST /* __linux__ || SUN4 */
- if ('\0' != lastlog.ll_host[0]) {
+ if ('\0' != ll.ll_host[0]) {
printf (_(" from %.*s"),
- (int) sizeof lastlog.
- ll_host, lastlog.ll_host);
+ (int) sizeof ll.ll_host, ll.ll_host);
}
#endif
printf (".\n");