From b84b85f1222717b8ddee87adeed952095c267743 Mon Sep 17 00:00:00 2001 From: Vladislav Grishenko Date: Fri, 5 May 2023 03:03:27 +0500 Subject: sstp: fix termios structure initialization Fixes ad94c19554d7c6bb18ab2e251e4ee403ee0b7732, tios is sill left partially initialized with sane values. Also, log get/set attr errors with error level as well since it raises pty allocation error and connection drop therefore. --- accel-pppd/ctrl/sstp/sstp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c index 188cada..050e54a 100644 --- a/accel-pppd/ctrl/sstp/sstp.c +++ b/accel-pppd/ctrl/sstp/sstp.c @@ -992,6 +992,10 @@ static int ppp_allocate_pty(int *master, int *slave, int flags) flags &= ~O_CLOEXEC; } + if (tcgetattr(sfd, &tios) < 0) { + log_ppp_error("sstp: ppp: get pty attributes: %s\n", strerror(errno)); + goto error; + } tios.c_cflag &= ~(CSIZE | CSTOPB | PARENB); tios.c_cflag |= CS8 | CREAD | CLOCAL; tios.c_iflag = IGNBRK | IGNPAR; @@ -1000,7 +1004,7 @@ static int ppp_allocate_pty(int *master, int *slave, int flags) tios.c_cc[VMIN] = 1; tios.c_cc[VTIME] = 0; if (tcsetattr(sfd, TCSAFLUSH, &tios) < 0) { - log_ppp_warn("sstp: ppp: set pty attributes: %s\n", strerror(errno)); + log_ppp_error("sstp: ppp: set pty attributes: %s\n", strerror(errno)); goto error; } -- cgit v1.2.3