From: Amos Jeffries Date: Sun, 3 May 2009 11:45:57 +0000 (+1200) Subject: Remove infinite loop in MSNT auth helper X-Git-Tag: SQUID_3_1_0_8~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f17141ab5c99c7cb02f00cea738154467cbe639f;p=thirdparty%2Fsquid.git 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. --- 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;