Package: dput
Version: 0.9.2.30
Severity: wishlist
Tags: patch
User: [EMAIL PROTECTED]
Usertags: origin-ubuntu hardy ubuntu-patch

Please add a "ftp_port" option to dput.cf to override the default FTP
port (21).

LKRaider has submitted the patch for this at
https://launchpad.net/bugs/140612, which I have slightly changed.

Thank you.
diff -Nru /tmp/ayERPk5A0i/dput-0.9.2.30/dput 
/tmp/vgfTl4pos1/dput-0.9.2.30ubuntu1/dput
--- dput-0.9.2.30/dput  2008-01-28 21:10:03.000000000 +0100
+++ dput-0.9.2.30ubuntu1/dput   2008-02-07 23:11:22.000000000 +0100
@@ -109,6 +109,7 @@
     config.set('DEFAULT', 'passive_ftp', '1')
     config.set('DEFAULT', 'progress_indicator', '0')
     config.set('DEFAULT', 'delayed', '')
+    config.set('DEFAULT', 'ftp_port', '21')
 
     if extra_config:
        config_files = (extra_config,)
@@ -856,16 +857,18 @@
             if not os.isatty(1):
              progress = 0
             if method == 'ftp':
+                port = config.getint(host,'ftp_port')
                 ftp_mode = config.getboolean(host, 'passive_ftp')
                 if ftp_passive_mode == 1: ftp_mode = 1
                 if debug:
+                    print "D: FTP port: %s" % port
                     if ftp_mode == 1:
                         print "D: Using passive ftp"
                     else:
                         print "D: Using active ftp"
                 upload_methods[method](
                   fqdn, login, incoming,
-                  files_to_upload, debug, ftp_mode, progress=progress)
+                  files_to_upload, debug, ftp_mode, progress=progress, 
port=port)
             elif method == 'scp':
                 if debug and config.getboolean(host, 'scp_compress'):
                     print "D: Setting compression for scp"
diff -Nru /tmp/ayERPk5A0i/dput-0.9.2.30/dput.cf.5 
/tmp/vgfTl4pos1/dput-0.9.2.30ubuntu1/dput.cf.5
--- dput-0.9.2.30/dput.cf.5     2008-01-28 20:54:36.000000000 +0100
+++ dput-0.9.2.30ubuntu1/dput.cf.5      2008-02-07 22:56:58.000000000 +0100
@@ -115,6 +115,9 @@
 connections. If you need to use active ftp connections, set
 passive_ftp to 0.
 .TP
+.B ftp_port
+This option defines the ftp port to use. The default is 21.
+.TP
 .B progress_indicator
 This integer option defines if dput should display a progress indicator for
 the upload. (Currently implemented in ftp only.)
diff -Nru /tmp/ayERPk5A0i/dput-0.9.2.30/ftp.py 
/tmp/vgfTl4pos1/dput-0.9.2.30ubuntu1/ftp.py
--- dput-0.9.2.30/ftp.py        2006-10-21 21:34:09.000000000 +0200
+++ dput-0.9.2.30ubuntu1/ftp.py 2008-02-07 22:43:28.000000000 +0100
@@ -1,9 +1,10 @@
 import os, sys, ftplib, getpass, dputhelper
 
 # Upload the files via ftp. (Could need a bit more error-checking.)
-def upload(fqdn, login, incoming, files_to_upload, debug, ftp_mode, 
progress=0):
+def upload(fqdn, login, incoming, files_to_upload, debug, ftp_mode, 
progress=0, port=21):
     try:
-        ftp_connection = ftplib.FTP(fqdn)
+        ftp_connection = ftplib.FTP()
+        ftp_connection.connect(fqdn, port)
         if debug:
             print "D: FTP-Connection to host: %s" % fqdn
     except ftplib.all_errors, e:

Reply via email to