#include <sys/syslog.h>
#include <sys/sysmacros.h>
#include <netdb.h>
+#include "pathnames.h"
#include "my_crypt.h"
+#include "login.h"
#include "nls.h"
#ifdef __linux__
};
#endif
-#include "pathnames.h"
-#define P_(s) ()
-void opentty P_((const char *tty));
-void getloginname P_((void));
-void timedout P_((void));
-int rootterm P_((char *ttyn));
-void motd P_((void));
-void sigint P_((void));
-void checknologin P_((void));
-void dolastlog P_((int quiet));
-void badlogin P_((const char *name));
-char *stypeof P_((char *ttyid));
-void checktty P_((char *user, char *tty, struct passwd *pwd));
-void sleepexit P_((int eval));
+static void getloginname (void);
+static void timedout (int);
+static void sigint (int);
+static int rootterm (char *ttyn);
+static void motd (void);
+static void checknologin (void);
+static void dolastlog (int quiet);
+
+#ifndef __linux__
+static char *stypeof (char *ttyid);
+#endif
+
#ifdef CRYPTOCARD
-int cryptocard P_((void));
+#include "cryptocard.h"
#endif
-#undef P_
#ifdef KERBEROS
#include <kerberos/krb.h>
#ifndef __linux__
int timeout = 300;
#else
-int timeout = 60;
+int timeout = 60; /* used in cryptocard.c */
#endif
-struct passwd *pwd;
-int failures = 1;
+struct passwd *pwd; /* used in cryptocard.c */
+struct hostent hostaddress; /* used in checktty.c */
char term[64], *hostname, *username, *tty;
-struct hostent hostaddress;
-char thishost[100];
+static char thishost[100];
+static int failures = 1;
#ifndef __linux__
struct sgttyb sgttyb;
connection. I believe login should open the line in the non-blocking mode
leaving the decision to make a connection to getty (where it actually
belongs). */
-void
+static void
opentty(const char * tty)
{
int i;
int quietlog, passwd_req;
char *domain, *ttyn;
char tbuf[MAXPATHLEN + 2], tname[sizeof(_PATH_TTY) + 10];
- char *ctime(), *ttyname(), *stypeof();
- time_t time();
- void timedout();
char *termenv;
- char vcsn[20], vcsan[20];
char * childArgv[10];
char * buff;
int childArgc = 0;
#else
char *salt, *pp;
#endif
+#ifdef CHOWNVCS
+ char vcsn[20], vcsan[20];
+#endif
#ifndef __linux__
int ioctlval;
#endif
ttyn = tname;
}
+#ifdef CHOWNVCS
/* find names of Virtual Console devices, for later mode change */
{
char *p = ttyn;
strcpy(vcsn, "/dev/vcs"); strcat(vcsn, p);
strcpy(vcsan, "/dev/vcsa"); strcat(vcsan, p);
}
+#endif
setpgrp();
tcgetattr(0, &tt);
ttt = tt;
ttt.c_cflag &= ~HUPCL;
-
- if((chown(ttyn, 0, 0) == 0) && (chmod(ttyn, 0622) == 0)) {
+
+ if((chown(ttyn, 0, 0) == 0) && (chmod(ttyn, TTY_MODE) == 0)) {
tcsetattr(0,TCSAFLUSH,&ttt);
signal(SIGHUP, SIG_IGN); /* so vhangup() wont kill us */
vhangup();
else if (tp.tv_sec - pwd->pw_change < TWOWEEKS && !quietlog) {
struct tm *ttp;
ttp = localtime(&pwd->pw_change);
- printf(_("Warning: your password expires on %s %d, %d\n"),
- months[ttp->tm_mon], ttp->tm_mday,
+ printf(_("Warning: your password expires on %d %s %d.\n"),
+ ttp->tm_mday, months[ttp->tm_mon],
TM_YEAR_BASE + ttp->tm_year);
}
}
else if (tp.tv_sec - pwd->pw_expire < TWOWEEKS && !quietlog) {
struct tm *ttp;
ttp = localtime(&pwd->pw_expire);
- printf(_("Warning: your account expires on %s %d, %d\n"),
- months[ttp->tm_mon], ttp->tm_mday,
+ printf(_("Warning: your account expires on %d %s %d.\n"),
+ ttp->tm_mday, months[ttp->tm_mon],
TM_YEAR_BASE + ttp->tm_year);
}
}
(gr = getgrnam(TTYGRPNAME)) ? gr->gr_gid : pwd->pw_gid);
chmod(ttyn, TTY_MODE);
+#ifdef CHOWNVCS
/* if tty is one of the VC's then change owner and mode of the
special /dev/vcs devices as well */
if (consoletty(0)) {
chmod(vcsn, TTY_MODE);
chmod(vcsan, TTY_MODE);
}
+#endif
setgid(pwd->pw_gid);
}
void
-getloginname()
-{
- register int ch;
- register char *p;
+getloginname(void) {
+ int ch, cnt, cnt2;
+ char *p;
static char nbuf[UT_NAMESIZE + 1];
- int cnt, cnt2;
cnt2 = 0;
for (;;) {
}
void
-timedout()
-{
+timedout(int sig) {
struct termio ti;
fprintf(stderr, _("Login timed out after %d seconds\n"), timeout);
}
int
-rootterm(ttyn)
- char *ttyn;
+rootterm(char * ttyn)
#ifndef __linux__
{
struct ttyent *t;
jmp_buf motdinterrupt;
void
-motd()
-{
- register int fd, nchars;
- void (*oldint)(), sigint();
+motd(void) {
+ int fd, nchars;
+ void (*oldint)(int);
char tbuf[8192];
if ((fd = open(_PATH_MOTDFILE, O_RDONLY, 0)) < 0)
}
void
-sigint()
-{
+sigint(int sig) {
longjmp(motdinterrupt, 1);
}
#ifndef USE_PAM /* PAM takes care of this */
void
-checknologin()
-{
+checknologin(void) {
register int fd, nchars;
char tbuf[8192];
#endif
void
-dolastlog(quiet)
- int quiet;
-{
+dolastlog(int quiet) {
struct lastlog ll;
int fd;
#ifndef __linux__
char *
-stypeof(ttyid)
- char *ttyid;
-{
+stypeof(char *ttyid) {
struct ttyent *t;
return(ttyid && (t = getttynam(ttyid)) ? t->ty_type : UNKNOWN);
/* should not be called from PAM code... Why? */
void
-sleepexit(eval)
- int eval;
-{
+sleepexit(int eval) {
sleep(SLEEP_EXIT_TIMEOUT);
exit(eval);
}