summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b702c21)
SCCS-vsn: libexec/telnetd/telnetd.c 5.46
SCCS-vsn: libexec/telnetd/sys_term.c 5.9
-static char sccsid[] = "@(#)sys_term.c 5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)sys_term.c 5.9 (Berkeley) %G%";
#endif /* not lint */
#include "telnetd.h"
#endif /* not lint */
#include "telnetd.h"
/*
* set up standard paths before forking to login
*/
/*
* set up standard paths before forking to login
*/
-#ifndef NO_SETSID
- if (setsid() < 0)
- fatalperror(net, "setsid");
-#endif
-
-#ifdef TIOCSCTTY
- if (ioctl(t, TIOCSCTTY, (char *)0) < 0)
- fatalperror(net, "ioctl(sctty)");
-#endif
- (void) close(net);
- (void) close(pty);
+#if BSD > 43
+ if (login_tty(t) == -1)
+ fatalperror(net, "login_tty");
+#else
(void) dup2(t, 0);
(void) dup2(t, 1);
(void) dup2(t, 2);
(void) close(t);
(void) dup2(t, 0);
(void) dup2(t, 1);
(void) dup2(t, 2);
(void) close(t);
+#endif
+ if (net > 2)
+ (void) close(net);
+ if (pty > 2)
+ (void) close(pty);
/*
* -h : pass on name of host.
* WARNING: -h is accepted by login if and only if
/*
* -h : pass on name of host.
* WARNING: -h is accepted by login if and only if
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)telnetd.c 5.45 (Berkeley) %G%";
+static char sccsid[] = "@(#)telnetd.c 5.46 (Berkeley) %G%";
#endif /* not lint */
#include "telnetd.h"
#endif /* not lint */
#include "telnetd.h"
char *host, *inet_ntoa();
int t;
struct hostent *hp;
char *host, *inet_ntoa();
int t;
struct hostent *hp;
+#if BSD > 43
+ extern char *line;
+ if (openpty(&pty, &t, line, NULL, NULL) == -1)
+ fatal(net, "All network ports in use");
+ init_termbuf();
+#else
+
/*
* Find an available pty to use.
*/
/*
* Find an available pty to use.
*/
fatal(net, "All network ports in use");
t = getptyslave();
fatal(net, "All network ports in use");
t = getptyslave();
/* get name of connected client */
hp = gethostbyaddr((char *)&who->sin_addr, sizeof (struct in_addr),
/* get name of connected client */
hp = gethostbyaddr((char *)&who->sin_addr, sizeof (struct in_addr),