]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Remove infinite loop in MSNT auth helper
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 3 May 2009 11:45:57 +0000 (23:45 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 3 May 2009 11:45:57 +0000 (23:45 +1200)
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

index ea72f2fca896cdfc084624dc04a2a769be1eb18d..a877089fe79d65995c6a5f6b371f9e6f22f913f4 100644 (file)
@@ -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;