summaryrefslogtreecommitdiffstats
path: root/crypto/heimdal/appl/telnet/telnetd/sys_term.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/heimdal/appl/telnet/telnetd/sys_term.c')
-rw-r--r--crypto/heimdal/appl/telnet/telnetd/sys_term.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/crypto/heimdal/appl/telnet/telnetd/sys_term.c b/crypto/heimdal/appl/telnet/telnetd/sys_term.c
index 7c529af..067f8da 100644
--- a/crypto/heimdal/appl/telnet/telnetd/sys_term.c
+++ b/crypto/heimdal/appl/telnet/telnetd/sys_term.c
@@ -33,7 +33,7 @@
#include "telnetd.h"
-RCSID("$Id: sys_term.c,v 1.97 2000/12/08 23:32:06 assar Exp $");
+RCSID("$Id: sys_term.c,v 1.100 2001/04/24 23:11:43 assar Exp $");
#if defined(_CRAY) || (defined(__hpux) && !defined(HAVE_UTMPX_H))
# define PARENT_DOES_UTMP
@@ -1110,7 +1110,8 @@ make_id (char *tty)
/* ARGSUSED */
void
-startslave(char *host, int autologin, char *autoname)
+startslave(const char *host, const char *utmp_host,
+ int autologin, char *autoname)
{
int i;
@@ -1158,7 +1159,7 @@ startslave(char *host, int autologin, char *autoname)
wtmp.ut_type = LOGIN_PROCESS;
wtmp.ut_pid = pid;
strncpy(wtmp.ut_user, "LOGIN", sizeof(wtmp.ut_user));
- strncpy(wtmp.ut_host, host, sizeof(wtmp.ut_host));
+ strncpy(wtmp.ut_host, utmp_host, sizeof(wtmp.ut_host));
strncpy(wtmp.ut_line, clean_ttyname(line), sizeof(wtmp.ut_line));
#ifdef HAVE_STRUCT_UTMP_UT_ID
strncpy(wtmp.ut_id, wtmp.ut_line + 3, sizeof(wtmp.ut_id));
@@ -1192,7 +1193,6 @@ extern char **environ;
void
init_env(void)
{
- extern char *getenv(const char *);
char **envp;
envp = envinit;
@@ -1259,10 +1259,10 @@ scrub_env(void)
struct arg_val {
int size;
int argc;
- char **argv;
+ const char **argv;
};
-static void addarg(struct arg_val*, char*);
+static void addarg(struct arg_val*, const char*);
/*
* start_login(host)
@@ -1272,10 +1272,11 @@ static void addarg(struct arg_val*, char*);
*/
void
-start_login(char *host, int autologin, char *name)
+start_login(const char *host, int autologin, char *name)
{
struct arg_val argv;
char *user;
+ int save_errno;
#ifdef HAVE_UTMPX_H
int pid = getpid();
@@ -1316,7 +1317,7 @@ start_login(char *host, int autologin, char *name)
/* init argv structure */
argv.size=0;
argv.argc=0;
- argv.argv=(char**)malloc(0); /*so we can call realloc later */
+ argv.argv=malloc(0); /*so we can call realloc later */
addarg(&argv, "login");
addarg(&argv, "-h");
addarg(&argv, host);
@@ -1371,14 +1372,14 @@ start_login(char *host, int autologin, char *name)
sleep(1);
execv(new_login, argv.argv);
-
+ save_errno = errno;
syslog(LOG_ERR, "%s: %m\n", new_login);
- fatalperror(net, new_login);
+ fatalperror_errno(net, new_login, save_errno);
/*NOTREACHED*/
}
static void
-addarg(struct arg_val *argv, char *val)
+addarg(struct arg_val *argv, const char *val)
{
if(argv->size <= argv->argc+1) {
argv->argv = realloc(argv->argv, sizeof(char*) * (argv->size + 10));
OpenPOWER on IntegriCloud