From 65bb32d1c2b0b7f2c881b2c5d099f7d35e701fb1 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 8 Aug 2017 21:51:42 +0200 Subject: net2kiss: Switch from private openpty() implementation to libutil. In particular the openpty() implementation was still using only the old BSD terminals so not working on modern distributions which ship their kernels with CONFIG_LEGACY_PTYS disabled. Signed-off-by: Ralf Baechle --- kiss/Makefile.am | 1 + kiss/net2kiss.c | 49 +------------------------------------------------ 2 files changed, 2 insertions(+), 48 deletions(-) diff --git a/kiss/Makefile.am b/kiss/Makefile.am index e7dcf30..6f74c67 100644 --- a/kiss/Makefile.am +++ b/kiss/Makefile.am @@ -4,6 +4,7 @@ installconf: sbin_PROGRAMS = kissattach kissnetd kissparms mkiss net2kiss LDADD= $(AX25_LIB) +net2kiss_LDADD = $(UTIL_LIB) dist_man_MANS = kissattach.8 spattach.8 kissnetd.8 kissparms.8 mkiss.8 \ net2kiss.8 diff --git a/kiss/net2kiss.c b/kiss/net2kiss.c index 093a191..9c0afef 100644 --- a/kiss/net2kiss.c +++ b/kiss/net2kiss.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -234,54 +235,6 @@ static void display_packet(unsigned char *bp, unsigned int len) /* ---------------------------------------------------------------------- */ -static int openpty(int *amaster, int *aslave, char *name, - struct termios *termp, struct winsize *winp) -{ - char line[PATH_MAX]; - const char *cp1, *cp2; - int master, slave; - struct group *gr = getgrnam("tty"); - - strcpy(line, "/dev/ptyXX"); - for (cp1 = "pqrstuvwxyzPQRST"; *cp1; cp1++) { - line[8] = *cp1; - for (cp2 = "0123456789abcdef"; *cp2; cp2++) { - line[9] = *cp2; - if ((master = open(line, O_RDWR, 0)) == -1) { - if (errno == ENOENT) - return -1; /* out of ptys */ - } else { - line[5] = 't'; - chown(line, getuid(), gr ? gr->gr_gid : -1); - chmod(line, S_IRUSR|S_IWUSR|S_IWGRP); -#if 0 - revoke(line); -#endif - slave = open(line, O_RDWR, 0); - if (slave != -1) { - *amaster = master; - *aslave = slave; - if (name) - strcpy(name, line); - if (termp) - tcsetattr(slave, TCSAFLUSH, - termp); - if (winp) - ioctl(slave, TIOCSWINSZ, - (char *)winp); - return 0; - } - close(master); - line[5] = 'p'; - } - } - } - errno = ENOENT; /* out of ptys */ - return -1; -} - -/* ---------------------------------------------------------------------- */ - static void restore_ifflags(int signum) { if (ioctl(fdif, SIOCSIFFLAGS, &ifr) < 0) -- cgit v1.2.3