From f42a91ed7a0c835b98b3193cc8a29687b36f2f3a Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 23 Nov 2011 19:48:30 +0000 Subject: [PATCH] Don't loop forever on authentication failure. If the first attempt to fetch the article doesn't succeed, we should try authenticating; but if the second attempt fails, then authentication didn't work, so we should give up rather than try it pointlessly again. git-svn-id: svn://svn.tartarus.org/sgt/utils@9340 cda61777-01e9-0310-a592-d414129be87e --- nntpid/nntpid | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nntpid/nntpid b/nntpid/nntpid index 298dbf3..f1544bb 100755 --- a/nntpid/nntpid +++ b/nntpid/nntpid @@ -174,7 +174,12 @@ sub getline { sub docmd { my ($cmd) = @_; - while (1) { + # We go at most twice round the following loop. If the first attempt + # to fetch the article fails with a 480 response, we try again + # having authenticated first; but if the second attempt also fails + # with 480, then the authentication didn't work, so we should give + # up rather than try it pointlessly again. + for my $n (0,1) { &putline($cmd); $line = &getline; if ($code eq "480") { &auth; } else { last; } -- 2.11.0