Package: ftp-ssl
Severity: normal
Tags: patch

With #531822, the package was changed to build with editline. Debian's
editline was not updated in several years and ftp-ssl is the only user
of that package. An alternative is the libedit package.

Updates of two of the existing patches are enclosed. Additionally,
d/control has to depend on libedit-dev instead of libeditline-dev to
build with libedit.

If you apply the patches, the editline package could be removed from
Debian: #923489.
Description: Use editline instead of readline
 netkit-ftp-ssl links against openssl, which is incompatible with
 the GPL. Unfortunately readline is GPLed, so link to libedit
 (BSD licensed) instead.
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=531822
Author: Ian Beckwith <i...@debian.org>
Forwarded: no
Last-Update: 2014-12-23

--- a/ftp/cmds.c
+++ b/ftp/cmds.c
@@ -65,6 +65,10 @@
 #include <readline/history.h>
 #endif
 
+#ifdef __USE_EDITLINE__
+#include <editline/readline.h>
+#endif
+
 #include "ftp_var.h"
 #include "pathnames.h"
 #include "cmds.h"
@@ -1890,7 +1894,7 @@
 	if (!interactive)
 		return (1);
 
-#ifdef __USE_READLINE__
+#ifdef __USE_LINE_EDITOR__
 	if (fromatty && !rl_inhibit) {
 		char *lineread;
 		snprintf(lyne, BUFSIZ, "%s %s? ", cmd, file);
@@ -1912,7 +1916,7 @@
 		if (fgets(lyne, sizeof(lyne), stdin) == NULL) {
 		    return 0;
 		}
-#ifdef __USE_READLINE__
+#ifdef __USE_LINE_EDITOR__
 	}
 #endif
 	return (*lyne != 'n' && *lyne != 'N');
--- a/ftp/main.c
+++ b/ftp/main.c
@@ -78,6 +78,10 @@
 #include <readline/history.h>
 #endif
 
+#ifdef	__USE_EDITLINE__
+#include <editline/readline.h>
+#endif
+
 #define Extern
 #include "ftp_var.h"
 #include "main.h"
@@ -198,7 +202,7 @@
 	printf("   -p                     enable passive mode (default for pftp)\n");
 	printf("   -i                     turn off prompting during mget\n");
 	printf("   -n                     inhibit auto-login\n");
-	printf("   -e                     disable readline support, if present\n");
+	printf("   -e                     disable readline/editline support, if present\n");
 	printf("   -g                     disable filename globbing\n");
 	printf("   -v                     verbose mode\n");
 	printf("   -t                     enable packet tracing [nonfunctional]\n");
@@ -515,7 +519,7 @@
 	size_t size;
 	ssize_t len;
 
-#ifdef __USE_READLINE__
+#ifdef __USE_LINE_EDITOR__
 	if (fromatty && !rl_inhibit) {
 		lineread = readline("ftp> ");
 		INTOFF;
--- a/ftp/main.h
+++ b/ftp/main.h
@@ -31,3 +31,11 @@
 #define MAXHOSTNAMELEN 64
 #endif
 
+#ifdef __USE_READLINE__
+#define __USE_LINE_EDITOR__
+#endif
+
+#ifdef __USE_EDITLINE__
+#define __USE_LINE_EDITOR__
+#endif
+
Description: Add SSL support
Author: Christoph Biedl <debian.a...@manchmal.in-ulm.de>
Forwarded: not-needed
Last-Update: 2019-02-24

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,11 @@
 cmake_minimum_required(VERSION 3.7)
-project(netkit-ftp)
+project(netkit-ftp-ssl)
 
 set(BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin")
 set(MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man")
 
-find_library(USE_READLINE readline)
-find_library(USE_CRYPT crypt REQUIRED)
+find_library(USE_EDITLINE edit REQUIRED)
+find_library(LIBTERMCAP lncurses REQUIRED)
+find_library(USE_SSL ssl REQUIRED)
 
 add_subdirectory(ftp)
--- a/ftp/CMakeLists.txt
+++ b/ftp/CMakeLists.txt
@@ -1,11 +1,21 @@
 
+set(
+    LIBS
+)
+
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64")
 if(USE_READLINE)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__USE_READLINE__")
+    set(LIBS ${LIBS} readline)
 endif()
+if(USE_EDITLINE)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__USE_EDITLINE__")
+    set(LIBS ${LIBS} edit)
+endif()
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_SSL -DBUILD_SSL_CLIENT")
 
 add_executable(
-    netkit-ftp
+    ftp-ssl
     cmds.c
     cmdtab.c
     domacro.c
@@ -13,24 +23,25 @@
     main.c
     ruserpass.c
 )
+target_link_libraries(
+    ftp-ssl
+    crypto
+    ssl
+    ${LIBS}
+)
 install(
-    TARGETS netkit-ftp
+    TARGETS ftp-ssl
     DESTINATION ${BIN_DIR}
 )
-if(USE_READLINE)
-    target_link_libraries(
-        netkit-ftp
-        readline
-    )
-endif()
+
 install(
     FILES ftp.1
     DESTINATION ${MAN_DIR}/man1/
-    RENAME netkit-ftp.1
+    RENAME ftp-ssl.1
 )
 
 install(
     FILES netrc.5
     DESTINATION ${MAN_DIR}/man5/
-    RENAME netkit-netrc.5
+    RENAME netrc-ssl.5
 )

Reply via email to