diff options
Diffstat (limited to 'libexec/telnetd/sys_term.c')
-rw-r--r-- | libexec/telnetd/sys_term.c | 68 |
1 files changed, 2 insertions, 66 deletions
diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c index 4f98a2bef5e..0d05a0da07f 100644 --- a/libexec/telnetd/sys_term.c +++ b/libexec/telnetd/sys_term.c @@ -1101,42 +1101,6 @@ make_id (char *tty) } #endif -static int -fgets0(char *s, int size, FILE *f) -{ - int i, c, trunc; - - i = 0; - trunc = 0; - while ((c = getc(f)) != EOF && c) - if (i < size - 1) - s[i++] = c; - else - trunc = 1; - s[i] = 0; - - if (c == EOF) - fatal(-1, "fgets0: Unexpected EOF"); - - return trunc; -} - -extern char *goodenv_table[]; -extern int envvarok(char *varp, char *valp); - -static void -fgetenv(FILE *f) -{ - char **name, value[0x100]; - - for (name = goodenv_table; *name; name++) { - if (fgets0(value, sizeof(value), f) || !value[0]) - continue; - if (envvarok(*name, value)) - setenv(*name, value, 1); - } -} - /* * startslave(host) * @@ -1146,19 +1110,12 @@ fgetenv(FILE *f) /* ARGSUSED */ void -startslave(const char *host, int channel[2]) +startslave(const char *host, const char *utmp_host, + int autologin, char *autoname) { int i; - int autologin; - char autoname[9]; - FILE *masterf; - - autologin = -1; /* shouldn't be used */ - autoname[0] = '\0'; #ifdef AUTHENTICATION - autologin = AUTH_REJECT; - if (!autoname || !autoname[0]) autologin = 0; @@ -1211,27 +1168,6 @@ startslave(const char *host, int channel[2]) utmp_sig_notify(pid); # endif /* PARENT_DOES_UTMP */ } else { - close(channel[1]); - - masterf = fdopen(channel[0], "r"); - if (!masterf) - fatalperror(-1, "fdopen"); - -#ifdef AUTHENTICATION - if (fread(&autologin, sizeof(autologin), 1, masterf) != 1) - fatalperror(-1, "fread"); - - if (fgets0(autoname, sizeof(autoname), masterf)) { - /* Truncation of a username isn't safe */ - autologin = AUTH_REJECT; - autoname[0] = 0; - } -#endif - - fgetenv(masterf); - - fclose(masterf); - getptyslave(); #if defined(DCE) /* if we authenticated via K5, try and join the PAG */ |