git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1790 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-06-01 03:14:38 +00:00
parent daed744f7f
commit f3750c9f04
3 changed files with 19 additions and 20 deletions

View File

@@ -14,10 +14,11 @@ static void
utmpx_update(struct utmpx *ut, char *line, char *user, char *host)
{
struct timeval tmp;
char *clean_tty = clean_ttyname(line);
strncpy(ut->ut_line, clean_ttyname(line), sizeof(ut->ut_line));
strncpy(ut->ut_line, clean_tty, sizeof(ut->ut_line));
#ifdef HAVE_UT_ID
strncpy(ut->ut_id, make_id(ut->ut_line), sizeof(ut->ut_id));
strncpy(ut->ut_id, make_id(clean_tty), sizeof(ut->ut_id));
#endif
strncpy(ut->ut_user, user, sizeof(ut->ut_user));
strncpy(ut->ut_host, host, sizeof(ut->ut_host));

View File

@@ -1944,14 +1944,12 @@ ayt_status(void)
}
#endif
static char *rcname = 0;
static char rcbuf[128];
static Command *getcmd(char *name);
static void
cmdrc(char *m1, char *m2)
{
static char rcname[128];
Command *c;
FILE *rcfile;
int gotmachine = 0;
@@ -1965,14 +1963,11 @@ cmdrc(char *m1, char *m2)
strcpy(m1save, m1);
m1 = m1save;
if (rcname == 0) {
rcname = getenv("HOME");
if (rcname)
strcpy(rcbuf, rcname);
else
rcbuf[0] = '\0';
strcat(rcbuf, "/.telnetrc");
rcname = rcbuf;
if (rcname[0] == 0) {
char *home = getenv("HOME");
snprintf (rcname, sizeof(rcname), "%s/.telnetrc",
home ? home : "");
}
if ((rcfile = fopen(rcname, "r")) == 0) {

View File

@@ -1251,17 +1251,18 @@ void start_login(char *host, int autologin, char *name)
int pid = getpid();
struct utmpx utmpx;
struct timeval tmp;
char *clean_tty;
/*
* Create utmp entry for child
*/
clean_tty = clean_ttyname(line);
memset(&utmpx, 0, sizeof(utmpx));
strncpy(utmpx.ut_user, ".telnet", sizeof(utmpx.ut_user));
strncpy(utmpx.ut_line, clean_ttyname(line), sizeof(utmpx.ut_line));
strncpy(utmpx.ut_line, clean_tty, sizeof(utmpx.ut_line));
#ifdef HAVE_UT_ID
strncpy(utmpx.ut_id, make_id(utmpx.ut_line), sizeof(utmpx.ut_id));
strncpy(utmpx.ut_id, make_id(clean_tty), sizeof(utmpx.ut_id));
#endif
utmpx.ut_pid = pid;
@@ -1379,6 +1380,7 @@ rmut(void)
struct stat statbf;
struct timeval tmp;
struct utmpx *utxp, utmpx;
char *clean_tty = clean_ttyname(line);
/*
* This updates the utmpx and utmp entries and make a wtmp/x entry
@@ -1386,7 +1388,7 @@ rmut(void)
setutxent();
memset(&utmpx, 0, sizeof(utmpx));
strncpy(utmpx.ut_line, clean_ttyname(line), sizeof(utmpx.ut_line));
strncpy(utmpx.ut_line, clean_tty, sizeof(utmpx.ut_line));
utmpx.ut_type = LOGIN_PROCESS;
utxp = getutxline(&utmpx);
if (utxp) {
@@ -1412,7 +1414,7 @@ rmut(void)
int f = open(wtmpf, O_WRONLY|O_APPEND);
struct utmp wtmp;
if (f >= 0) {
strncpy(wtmp.ut_line, clean_ttyname(line), sizeof(wtmp.ut_line));
strncpy(wtmp.ut_line, clean_tty, sizeof(wtmp.ut_line));
strncpy(wtmp.ut_name, "", sizeof(wtmp.ut_name));
#ifdef HAVE_UT_HOST
strncpy(wtmp.ut_host, "", sizeof(wtmp.ut_host));
@@ -1439,6 +1441,7 @@ rmut(void)
struct utmp *u, *utmp;
int nutmp;
struct stat statbf;
char *clean_tty = clean_ttyname(line);
f = open(utmpf, O_RDWR);
if (f >= 0) {
@@ -1452,7 +1455,7 @@ rmut(void)
for (u = utmp ; u < &utmp[nutmp] ; u++) {
if (strncmp(u->ut_line,
clean_ttyname(line),
clean_tty,
sizeof(u->ut_line)) ||
u->ut_name[0]==0)
continue;
@@ -1471,7 +1474,7 @@ rmut(void)
if (found) {
f = open(wtmpf, O_WRONLY|O_APPEND);
if (f >= 0) {
strncpy(wtmp.ut_line, clean_ttyname(line), sizeof(wtmp.ut_line));
strncpy(wtmp.ut_line, clean_tty, sizeof(wtmp.ut_line));
strncpy(wtmp.ut_name, "", sizeof(wtmp.ut_name));
#ifdef HAVE_UT_HOST
strncpy(wtmp.ut_host, "", sizeof(wtmp.ut_host));