* 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.
This commit is contained in:
parent
790dbb07fc
commit
332a50c273
@ -1,3 +1,10 @@
|
|||||||
|
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>
|
2009-04-22 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* src/login.c: Added update_utmp() to group the prepare_utmp and
|
* src/login.c: Added update_utmp() to group the prepare_utmp and
|
||||||
|
26
src/login.c
26
src/login.c
@ -36,7 +36,9 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
|
#ifndef USE_PAM
|
||||||
#include <lastlog.h>
|
#include <lastlog.h>
|
||||||
|
#endif /* !USE_PAM */
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -66,12 +68,14 @@ static pam_handle_t *pamh = NULL;
|
|||||||
|
|
||||||
#endif /* USE_PAM */
|
#endif /* USE_PAM */
|
||||||
|
|
||||||
|
#ifndef USE_PAM
|
||||||
/*
|
/*
|
||||||
* Needed for MkLinux DR1/2/2.1 - J.
|
* Needed for MkLinux DR1/2/2.1 - J.
|
||||||
*/
|
*/
|
||||||
#ifndef LASTLOG_FILE
|
#ifndef LASTLOG_FILE
|
||||||
#define LASTLOG_FILE "/var/log/lastlog"
|
#define LASTLOG_FILE "/var/log/lastlog"
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* !USE_PAM */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
@ -82,7 +86,9 @@ static const char *hostname = "";
|
|||||||
static char *username = NULL;
|
static char *username = NULL;
|
||||||
static int reason = PW_LOGIN;
|
static int reason = PW_LOGIN;
|
||||||
|
|
||||||
struct lastlog lastlog;
|
#ifndef USE_PAM
|
||||||
|
static struct lastlog ll;
|
||||||
|
#endif /* !USE_PAM */
|
||||||
static bool pflg = false;
|
static bool pflg = false;
|
||||||
static bool fflg = false;
|
static bool fflg = false;
|
||||||
|
|
||||||
@ -509,9 +515,6 @@ int main (int argc, char **argv)
|
|||||||
char fromhost[512];
|
char fromhost[512];
|
||||||
struct passwd *pwd = NULL;
|
struct passwd *pwd = NULL;
|
||||||
char **envp = environ;
|
char **envp = environ;
|
||||||
#ifndef USE_PAM
|
|
||||||
static char temp_shell[] = "/bin/sh";
|
|
||||||
#endif
|
|
||||||
const char *failent_user;
|
const char *failent_user;
|
||||||
struct utmp *utent;
|
struct utmp *utent;
|
||||||
|
|
||||||
@ -1113,7 +1116,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
#ifndef USE_PAM /* pam_lastlog handles this */
|
#ifndef USE_PAM /* pam_lastlog handles this */
|
||||||
if (getdef_bool ("LASTLOG_ENAB")) { /* give last login and log this one */
|
if (getdef_bool ("LASTLOG_ENAB")) { /* give last login and log this one */
|
||||||
dolastlog (&lastlog, pwd, tty, hostname);
|
dolastlog (&ll, pwd, tty, hostname);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1242,24 +1245,23 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( getdef_bool ("LASTLOG_ENAB")
|
if ( getdef_bool ("LASTLOG_ENAB")
|
||||||
&& (lastlog.ll_time != 0)) {
|
&& (ll.ll_time != 0)) {
|
||||||
time_t ll_time = lastlog.ll_time;
|
time_t ll_time = ll.ll_time;
|
||||||
|
|
||||||
#ifdef HAVE_STRFTIME
|
#ifdef HAVE_STRFTIME
|
||||||
strftime (ptime, sizeof (ptime),
|
strftime (ptime, sizeof (ptime),
|
||||||
"%a %b %e %H:%M:%S %z %Y",
|
"%a %b %e %H:%M:%S %z %Y",
|
||||||
localtime (&ll_time));
|
localtime (&ll_time));
|
||||||
printf (_("Last login: %s on %s"),
|
printf (_("Last login: %s on %s"),
|
||||||
ptime, lastlog.ll_line);
|
ptime, ll.ll_line);
|
||||||
#else
|
#else
|
||||||
printf (_("Last login: %.19s on %s"),
|
printf (_("Last login: %.19s on %s"),
|
||||||
ctime (&ll_time), lastlog.ll_line);
|
ctime (&ll_time), ll.ll_line);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LL_HOST /* __linux__ || SUN4 */
|
#ifdef HAVE_LL_HOST /* __linux__ || SUN4 */
|
||||||
if ('\0' != lastlog.ll_host[0]) {
|
if ('\0' != ll.ll_host[0]) {
|
||||||
printf (_(" from %.*s"),
|
printf (_(" from %.*s"),
|
||||||
(int) sizeof lastlog.
|
(int) sizeof ll.ll_host, ll.ll_host);
|
||||||
ll_host, lastlog.ll_host);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
printf (".\n");
|
printf (".\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user