mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-01 02:03:31 +00:00
a minimal set of changes to adapt to the utmp->utmpx changes.
lastlog still not implemented, i am hoping that Ed or someone has some idea on how to fix this, but it is really not important.
This commit is contained in:
parent
d07dc8e3eb
commit
91f88f8e7a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=203876
@ -76,7 +76,7 @@ static const char rcsid[] =
|
||||
#include <syslog.h>
|
||||
#include <ttyent.h>
|
||||
#include <unistd.h>
|
||||
#include <utmp.h>
|
||||
#include <utmpx.h>
|
||||
|
||||
#ifdef USE_PAM
|
||||
#include <security/pam_appl.h>
|
||||
@ -119,7 +119,6 @@ static char **environ_pam;
|
||||
#endif
|
||||
|
||||
static int auth_traditional(void);
|
||||
extern void login(struct utmp *);
|
||||
static void usage(void);
|
||||
|
||||
#define TTYGRPNAME "tty" /* name of group to own ttys */
|
||||
@ -152,7 +151,7 @@ main(argc, argv)
|
||||
struct group *gr;
|
||||
struct stat st;
|
||||
struct timeval tp;
|
||||
struct utmp utmp;
|
||||
struct utmpx utmp;
|
||||
int rootok, retries, backoff;
|
||||
int ask, ch, cnt, fflag, hflag, pflag, quietlog, rootlogin, rval;
|
||||
int changepass;
|
||||
@ -164,6 +163,8 @@ main(argc, argv)
|
||||
char tname[sizeof(_PATH_TTY) + 10];
|
||||
const char *shell = NULL;
|
||||
login_cap_t *lc = NULL;
|
||||
int UT_HOSTSIZE = sizeof(utmp.ut_host);
|
||||
int UT_NAMESIZE = sizeof(utmp.ut_user);
|
||||
#ifdef USE_PAM
|
||||
pid_t pid;
|
||||
int e;
|
||||
@ -508,14 +509,18 @@ main(argc, argv)
|
||||
refused("Permission denied", "ACCESS", 1);
|
||||
#endif /* LOGIN_ACCESS */
|
||||
|
||||
#if 1
|
||||
ulog_login(tty, username, hostname);
|
||||
#else
|
||||
/* Nothing else left to fail -- really log in. */
|
||||
memset((void *)&utmp, 0, sizeof(utmp));
|
||||
(void)time(&utmp.ut_time);
|
||||
(void)strncpy(utmp.ut_name, username, sizeof(utmp.ut_name));
|
||||
(void)gettimeofday(&utmp.ut_tv, NULL);
|
||||
(void)strncpy(utmp.ut_user, username, sizeof(utmp.ut_user));
|
||||
if (hostname)
|
||||
(void)strncpy(utmp.ut_host, hostname, sizeof(utmp.ut_host));
|
||||
(void)strncpy(utmp.ut_line, tty, sizeof(utmp.ut_line));
|
||||
login(&utmp);
|
||||
#endif
|
||||
|
||||
dolastlog(quietlog);
|
||||
|
||||
@ -903,7 +908,7 @@ usage()
|
||||
* Allow for authentication style and/or kerberos instance
|
||||
*/
|
||||
|
||||
#define NBUFSIZ UT_NAMESIZE + 64
|
||||
#define NBUFSIZ 128 // XXX was UT_NAMESIZE + 64
|
||||
|
||||
void
|
||||
getloginname()
|
||||
@ -985,6 +990,7 @@ void
|
||||
dolastlog(quiet)
|
||||
int quiet;
|
||||
{
|
||||
#if 0 /* XXX not implemented after utmp->utmpx change */
|
||||
struct lastlog ll;
|
||||
int fd;
|
||||
|
||||
@ -1016,6 +1022,7 @@ dolastlog(quiet)
|
||||
} else {
|
||||
syslog(LOG_ERR, "cannot open %s: %m", _PATH_LASTLOG);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user