Package: dput-ng
Version: 1.10
Severity: normal

Dear Maintainer,

with ye olde 'dput', "fqdn" could be used with '[:port]' appended to specify an 
alternate port for the ftp uploader.

With dput-ng, [:port] is not honored (and there is also no other way to specify 
an alternate port via the new json config style).

Please accept this patch, which re-establishes the olde behaviour (and should 
not hurt or break any existing configs).

Thanks for considering!

Stephan

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***


-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.3.0-0.bpo.1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages dput-ng depends on:
ii  python-dput  1.10
pn  python:any   <none>

Versions of packages dput-ng recommends:
ii  bash-completion  1:2.1-4.2

dput-ng suggests no packages.

-- no debconf information
>From 3a3059e095eed48cf327c888fe0755aa5f601b26 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Stephan=20S=C3=BCrken?= <[email protected]>
Date: Thu, 11 Feb 2016 14:47:04 +0000
Subject: [PATCH] dput/uploaders/ftp.py: Parse and use optional [:port] part
 for fqdn.

---
 dput/uploaders/ftp.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/dput/uploaders/ftp.py b/dput/uploaders/ftp.py
index ebcac40..2ee6ce8 100644
--- a/dput/uploaders/ftp.py
+++ b/dput/uploaders/ftp.py
@@ -59,12 +59,10 @@ class FtpUploader(AbstractUploader):
         timeout = conf['timeout'] if 'timeout' in conf else 10
 
         try:
-            self._ftp = ftplib.FTP(
-                self._config["fqdn"],
-                self._config["login"],
-                None,
-                timeout=timeout
-            )
+            self._ftp = ftplib.FTP()
+            host, dummy, port = self._config["fqdn"].partition(":")
+            self._ftp.connect(host, None if port == "" else int(port), timeout)
+            self._ftp.login(self._config["login"])
         except Exception as e:
             raise FtpUploadException(
                 "Could not establish FTP connection to %s: %s" % (
-- 
2.7.0

Reply via email to