From f17141ab5c99c7cb02f00cea738154467cbe639f Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sun, 3 May 2009 23:45:57 +1200 Subject: [PATCH] Remove infinite loop in MSNT auth helper On one starting error condition the helper enters a read loop without exit conditions. Made this exit when read was done and shutdown helper as per behavior comment by the loop. Also removes one useless goto. --- helpers/basic_auth/MSNT/msntauth.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/helpers/basic_auth/MSNT/msntauth.c b/helpers/basic_auth/MSNT/msntauth.c index ea72f2fca8..a877089fe7 100644 --- a/helpers/basic_auth/MSNT/msntauth.c +++ b/helpers/basic_auth/MSNT/msntauth.c @@ -73,10 +73,13 @@ main(int argc, char **argv) if ((Read_denyusers() == 1) || (Read_allowusers() == 1)) { while (1) { memset(wstr, '\0', sizeof(wstr)); - fgets(wstr, 255, stdin); + if (fgets(wstr, 255, stdin) == NULL) + break; puts("ERR"); } + return 1; } + /* * Make Check_forchange() the handle for HUP signals. * Don't use alarms any more. I don't think it was very @@ -98,7 +101,9 @@ main(int argc, char **argv) } if (err) { syslog(LOG_WARNING, "oversized message"); - goto error; + puts("ERR"); + err = 0; + continue; } /* @@ -133,7 +138,6 @@ main(int argc, char **argv) puts("OK"); else { syslog(LOG_INFO, "'%s' login failed", username); -error: puts("ERR"); } err = 0; -- 2.47.3