Blame SOURCES/sos-bz1916729-ftp-upload-no-passwd.patch

bdbf16
From 486a7918934041306bae8ccc11da2196e8f4c9bb Mon Sep 17 00:00:00 2001
bdbf16
From: Jake Hunsaker <jhunsake@redhat.com>
bdbf16
Date: Wed, 13 Jan 2021 10:57:58 -0500
bdbf16
Subject: [PATCH] [Policy] Handle additional FTP authentication issues
bdbf16
bdbf16
It was found that some implementations will return a 530 rather than a
bdbf16
503 as the more specific error for incorrect passwords. Handle this
bdbf16
error code explicitly, and then also add a catch-all for any other
bdbf16
ftplib errors that may get raised.
bdbf16
bdbf16
Resolves: #2368
bdbf16
bdbf16
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
bdbf16
---
bdbf16
 sos/policies/__init__.py | 4 ++++
bdbf16
 1 file changed, 4 insertions(+)
bdbf16
bdbf16
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
bdbf16
index c5fb4801e..a4f550c96 100644
bdbf16
--- a/sos/policies/__init__.py
bdbf16
+++ b/sos/policies/__init__.py
bdbf16
@@ -477,9 +477,13 @@ def upload_ftp(self, url=None, directory=None, user=None, password=None):
bdbf16
             errno = str(err).split()[0]
bdbf16
             if errno == '503':
bdbf16
                 raise Exception("could not login as '%s'" % user)
bdbf16
+            if errno == '530':
bdbf16
+                raise Exception("invalid password for user '%s'" % user)
bdbf16
             if errno == '550':
bdbf16
                 raise Exception("could not set upload directory to %s"
bdbf16
                                 % directory)
bdbf16
+            raise Exception("error trying to establish session: %s"
bdbf16
+                            % str(err))
bdbf16
 
bdbf16
         try:
bdbf16
             with open(self.upload_archive, 'rb') as _arcfile: