[packages_10.03.2] ftplib: merge r28996
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Mon, 6 Feb 2012 19:30:53 +0000 (19:30 +0000)
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Mon, 6 Feb 2012 19:30:53 +0000 (19:30 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/branches/packages_10.03.2@30343 3c298f89-4303-0410-b956-a3cf2f4a3e73

libs/ftplib/Makefile [new file with mode: 0644]
libs/ftplib/patches/001-fix_ascii_read_without_eol.patch [new file with mode: 0644]
libs/ftplib/patches/002-check_getserv_by_name.patch [new file with mode: 0644]

diff --git a/libs/ftplib/Makefile b/libs/ftplib/Makefile
new file mode 100644 (file)
index 0000000..f7199ad
--- /dev/null
@@ -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 (file)
index 0000000..a1b56c7
--- /dev/null
@@ -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 <hertzog@debian.org>
+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: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: http://bugs.debian.org/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: <YYYY-MM-DD>
+
+--- 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 (file)
index 0000000..59ab73d
--- /dev/null
@@ -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 <dark@xs4all.nl>
+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;
+       }
+     }