sos/SOURCES/sos-bz1916729-ftp-upload-no-passwd.patch
2021-09-10 04:41:46 +00:00

36 lines
1.4 KiB
Diff

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