ftp: add missing import statements

Previous back-ported patch assumed certain import statements that are
missing in 2.7 and earlier.  This patch adds the missing imports,
allowing the code to compile.