summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@mail.ru>2023-05-05 03:03:27 +0500
committerVladislav Grishenko <themiron@mail.ru>2023-05-05 03:05:02 +0500
commitb84b85f1222717b8ddee87adeed952095c267743 (patch)
treed456bc58e973419aa14097330e23c8a9bd20a586 /accel-pppd
parent8bb85f829aae15e370a3289735bf2428bd4236dd (diff)
downloadaccel-ppp-b84b85f1222717b8ddee87adeed952095c267743.tar.gz
accel-ppp-b84b85f1222717b8ddee87adeed952095c267743.zip
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.
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/ctrl/sstp/sstp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c
index 188cada1..050e54a6 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;
}