[PATCH] limit smtp auth retry to 2 attempts

Carl Chenet carl.chenet at ohmytux.com
Sun May 3 14:05:05 UTC 2009


---
 reportbug/submit.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/reportbug/submit.py b/reportbug/submit.py
index ca25063..2ab2056 100644
--- a/reportbug/submit.py
+++ b/reportbug/submit.py
@@ -349,6 +349,7 @@ def send_report(body, attachments, mua, fromaddr, sendto, ccaddr, bccaddr,
 
         tryagain = True
         refused = None
+        retry = 0
         while tryagain:
             tryagain = False
             ewrite("Connecting to %s via SMTP...\n", smtphost)
@@ -382,7 +383,11 @@ def send_report(body, attachments, mua, fromaddr, sendto, ccaddr, bccaddr,
                     ewrite('SMTP error: authentication failed.  Try again.\n')
                     tryagain = True
                     smtppasswd = None
-                    continue
+                    retry += 1
+                    if retry <= 2:
+                        continue
+                    else:
+                        tryagain = False
 
                 failed = True
                 ewrite('SMTP send failure: %s\n', x)
-- 
1.5.4.3


--=-zJ978iobpycr7shTYMVh--






More information about the Reportbug-maint mailing list