clean-up
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1790 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -14,10 +14,11 @@ static void
|
|||||||
utmpx_update(struct utmpx *ut, char *line, char *user, char *host)
|
utmpx_update(struct utmpx *ut, char *line, char *user, char *host)
|
||||||
{
|
{
|
||||||
struct timeval tmp;
|
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
|
#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
|
#endif
|
||||||
strncpy(ut->ut_user, user, sizeof(ut->ut_user));
|
strncpy(ut->ut_user, user, sizeof(ut->ut_user));
|
||||||
strncpy(ut->ut_host, host, sizeof(ut->ut_host));
|
strncpy(ut->ut_host, host, sizeof(ut->ut_host));
|
||||||
|
@@ -1944,14 +1944,12 @@ ayt_status(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *rcname = 0;
|
|
||||||
static char rcbuf[128];
|
|
||||||
|
|
||||||
static Command *getcmd(char *name);
|
static Command *getcmd(char *name);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cmdrc(char *m1, char *m2)
|
cmdrc(char *m1, char *m2)
|
||||||
{
|
{
|
||||||
|
static char rcname[128];
|
||||||
Command *c;
|
Command *c;
|
||||||
FILE *rcfile;
|
FILE *rcfile;
|
||||||
int gotmachine = 0;
|
int gotmachine = 0;
|
||||||
@@ -1965,14 +1963,11 @@ cmdrc(char *m1, char *m2)
|
|||||||
strcpy(m1save, m1);
|
strcpy(m1save, m1);
|
||||||
m1 = m1save;
|
m1 = m1save;
|
||||||
|
|
||||||
if (rcname == 0) {
|
if (rcname[0] == 0) {
|
||||||
rcname = getenv("HOME");
|
char *home = getenv("HOME");
|
||||||
if (rcname)
|
|
||||||
strcpy(rcbuf, rcname);
|
snprintf (rcname, sizeof(rcname), "%s/.telnetrc",
|
||||||
else
|
home ? home : "");
|
||||||
rcbuf[0] = '\0';
|
|
||||||
strcat(rcbuf, "/.telnetrc");
|
|
||||||
rcname = rcbuf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rcfile = fopen(rcname, "r")) == 0) {
|
if ((rcfile = fopen(rcname, "r")) == 0) {
|
||||||
|
@@ -1251,17 +1251,18 @@ void start_login(char *host, int autologin, char *name)
|
|||||||
int pid = getpid();
|
int pid = getpid();
|
||||||
struct utmpx utmpx;
|
struct utmpx utmpx;
|
||||||
struct timeval tmp;
|
struct timeval tmp;
|
||||||
|
char *clean_tty;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create utmp entry for child
|
* Create utmp entry for child
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
clean_tty = clean_ttyname(line);
|
||||||
memset(&utmpx, 0, sizeof(utmpx));
|
memset(&utmpx, 0, sizeof(utmpx));
|
||||||
strncpy(utmpx.ut_user, ".telnet", sizeof(utmpx.ut_user));
|
strncpy(utmpx.ut_user, ".telnet", sizeof(utmpx.ut_user));
|
||||||
|
strncpy(utmpx.ut_line, clean_tty, sizeof(utmpx.ut_line));
|
||||||
strncpy(utmpx.ut_line, clean_ttyname(line), sizeof(utmpx.ut_line));
|
|
||||||
#ifdef HAVE_UT_ID
|
#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
|
#endif
|
||||||
utmpx.ut_pid = pid;
|
utmpx.ut_pid = pid;
|
||||||
|
|
||||||
@@ -1379,6 +1380,7 @@ rmut(void)
|
|||||||
struct stat statbf;
|
struct stat statbf;
|
||||||
struct timeval tmp;
|
struct timeval tmp;
|
||||||
struct utmpx *utxp, utmpx;
|
struct utmpx *utxp, utmpx;
|
||||||
|
char *clean_tty = clean_ttyname(line);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This updates the utmpx and utmp entries and make a wtmp/x entry
|
* This updates the utmpx and utmp entries and make a wtmp/x entry
|
||||||
@@ -1386,7 +1388,7 @@ rmut(void)
|
|||||||
|
|
||||||
setutxent();
|
setutxent();
|
||||||
memset(&utmpx, 0, sizeof(utmpx));
|
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;
|
utmpx.ut_type = LOGIN_PROCESS;
|
||||||
utxp = getutxline(&utmpx);
|
utxp = getutxline(&utmpx);
|
||||||
if (utxp) {
|
if (utxp) {
|
||||||
@@ -1412,7 +1414,7 @@ rmut(void)
|
|||||||
int f = open(wtmpf, O_WRONLY|O_APPEND);
|
int f = open(wtmpf, O_WRONLY|O_APPEND);
|
||||||
struct utmp wtmp;
|
struct utmp wtmp;
|
||||||
if (f >= 0) {
|
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));
|
strncpy(wtmp.ut_name, "", sizeof(wtmp.ut_name));
|
||||||
#ifdef HAVE_UT_HOST
|
#ifdef HAVE_UT_HOST
|
||||||
strncpy(wtmp.ut_host, "", sizeof(wtmp.ut_host));
|
strncpy(wtmp.ut_host, "", sizeof(wtmp.ut_host));
|
||||||
@@ -1439,6 +1441,7 @@ rmut(void)
|
|||||||
struct utmp *u, *utmp;
|
struct utmp *u, *utmp;
|
||||||
int nutmp;
|
int nutmp;
|
||||||
struct stat statbf;
|
struct stat statbf;
|
||||||
|
char *clean_tty = clean_ttyname(line);
|
||||||
|
|
||||||
f = open(utmpf, O_RDWR);
|
f = open(utmpf, O_RDWR);
|
||||||
if (f >= 0) {
|
if (f >= 0) {
|
||||||
@@ -1452,7 +1455,7 @@ rmut(void)
|
|||||||
|
|
||||||
for (u = utmp ; u < &utmp[nutmp] ; u++) {
|
for (u = utmp ; u < &utmp[nutmp] ; u++) {
|
||||||
if (strncmp(u->ut_line,
|
if (strncmp(u->ut_line,
|
||||||
clean_ttyname(line),
|
clean_tty,
|
||||||
sizeof(u->ut_line)) ||
|
sizeof(u->ut_line)) ||
|
||||||
u->ut_name[0]==0)
|
u->ut_name[0]==0)
|
||||||
continue;
|
continue;
|
||||||
@@ -1471,7 +1474,7 @@ rmut(void)
|
|||||||
if (found) {
|
if (found) {
|
||||||
f = open(wtmpf, O_WRONLY|O_APPEND);
|
f = open(wtmpf, O_WRONLY|O_APPEND);
|
||||||
if (f >= 0) {
|
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));
|
strncpy(wtmp.ut_name, "", sizeof(wtmp.ut_name));
|
||||||
#ifdef HAVE_UT_HOST
|
#ifdef HAVE_UT_HOST
|
||||||
strncpy(wtmp.ut_host, "", sizeof(wtmp.ut_host));
|
strncpy(wtmp.ut_host, "", sizeof(wtmp.ut_host));
|
||||||
|
Reference in New Issue
Block a user