From e1670779086710754a9cbefac7ad0006721bff21 Mon Sep 17 00:00:00 2001 From: jow Date: Mon, 6 Feb 2012 19:30:53 +0000 Subject: [PATCH] [packages_10.03.2] ftplib: merge r28996 git-svn-id: svn://svn.openwrt.org/openwrt/branches/packages_10.03.2@30343 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- libs/ftplib/Makefile | 51 ++++++++++++++++++++++ .../patches/001-fix_ascii_read_without_eol.patch | 38 ++++++++++++++++ .../ftplib/patches/002-check_getserv_by_name.patch | 28 ++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 libs/ftplib/Makefile create mode 100644 libs/ftplib/patches/001-fix_ascii_read_without_eol.patch create mode 100644 libs/ftplib/patches/002-check_getserv_by_name.patch diff --git a/libs/ftplib/Makefile b/libs/ftplib/Makefile new file mode 100644 index 0000000..f7199ad --- /dev/null +++ b/libs/ftplib/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=ftplib +PKG_VERSION:=3.1-1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://nbpfaus.net/~pfau/ftplib/ +PKG_MD5SUM:=763be9c7e7b110776f88521a558dbc55 + +include $(INCLUDE_DIR)/package.mk + +MAKE_PATH:=src + +define Package/ftplib + SECTION:=libs + CATEGORY:=Libraries + TITLE:=ftplib + URL:=http://nbpfaus.net/~pfau/ftplib/ +endef + +define Package/ftplib/description +ftplib is a set of routines that implement the FTP protocol. They allow +applications to create and access remote files through function calls instead +of needing to fork and exec an interactive ftp client program. +endef + +define Build/Compile + $(call Build/Compile/Default,all) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/ftplib.h $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib/ + $(CP) $(PKG_BUILD_DIR)/src/libftp.{so*,a} $(1)/usr/lib/ +endef + +define Package/ftplib/install + $(INSTALL_DIR) $(1)/usr/lib/ + $(CP) $(PKG_BUILD_DIR)/src/libftp.so* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,ftplib)) diff --git a/libs/ftplib/patches/001-fix_ascii_read_without_eol.patch b/libs/ftplib/patches/001-fix_ascii_read_without_eol.patch new file mode 100644 index 0000000..a1b56c7 --- /dev/null +++ b/libs/ftplib/patches/001-fix_ascii_read_without_eol.patch @@ -0,0 +1,38 @@ +Description: Fix reading FTP data is ASCII mode + In ASCII mode, if you don't have a line in the next block that you're + trying to read, then ftplib would set the first character to '\0'. + . + Upstream probably intented to return an empty string when requesting + to read only 1 character since that doesn't make much sense when the + EOL delimiter is 2 characters already (\r\n). However, due to the + way data is read, max can be set to 1 just after having read max-1 + legitimate bytes and we should not be overwriting the first byte. + . + Patch is not submitted upstream since upstream is not actively + maintaining it. +Origin: vendor, see Author +Author: Raphaël Hertzog +Last-Update: 2009-11-24 + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Forwarded: +Reviewed-By: +Last-Update: + +--- a/src/ftplib.c ++++ b/src/ftplib.c +@@ -220,7 +220,6 @@ static int readline(char *buf,int max,ne + } + if (max == 1) + { +- *buf = '\0'; + break; + } + if (ctl->cput == ctl->cget) diff --git a/libs/ftplib/patches/002-check_getserv_by_name.patch b/libs/ftplib/patches/002-check_getserv_by_name.patch new file mode 100644 index 0000000..59ab73d --- /dev/null +++ b/libs/ftplib/patches/002-check_getserv_by_name.patch @@ -0,0 +1,28 @@ +Description: Verify value returned by getservbyname + getservbyname() can return a NULL pointer and dereferencing it + would lead to a segfault. + . + The patch is not forwarded upstream but there's no real maintainance + upstream any more. +Origin: vendor, see changelog entry 3.1-1-2 +Author: Richard Braakman +Last-Update: 2009-10-29 +Forwarded: no + +diff --git a/linux/ftplib.c b/linux/ftplib.c +index 9089a5b..c4a5873 100644 +--- a/src/ftplib.c ++++ b/src/ftplib.c +@@ -416,7 +416,11 @@ GLOBALDEF int FtpConnect(const char *host, netbuf **nControl) + sin.sin_port = htons(atoi(pnum)); + else + { +- pse = getservbyname(pnum,"tcp"); ++ if ((pse = getservbyname(pnum,"tcp")) == NULL) ++ { ++ perror("getservbyname"); ++ return 0; ++ } + sin.sin_port = pse->s_port; + } + } -- 2.11.0