packages: add ftplib

Needed by newest hasciicam.

git-svn-id: svn://svn.openwrt.org/openwrt/packages@28996 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jogo 2011-11-12 20:22:28 +00:00
parent d0fe7bf2a3
commit 0a286c4af4
3 changed files with 117 additions and 0 deletions

51
libs/ftplib/Makefile Normal file
View File

@ -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))

View File

@ -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)

View File

@ -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;
}
}