Compare commits

...

2 Commits

Author SHA1 Message Date
Marcelo Roberto Jimenez
7275c1ab6f Creating tag release-1.4.5.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/tags/release-1.4.5@169 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2007-04-28 19:38:27 +00:00
Marcelo Roberto Jimenez
a7ab0acfe8 Merge of trunk into branch-1.4.x.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.4.x@168 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2007-04-28 19:36:19 +00:00
11 changed files with 168 additions and 81 deletions

View File

@@ -1,3 +1,31 @@
*************************************************************************
Version 1.4.5
*************************************************************************
2007-04-19 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Case insensitive comparison in raw_find_str() (httpparser.c) as
suggested by Craig Nelson in SF Tracker [ 1689382 ] DLINK DIR-625
patch.
2007-04-07 Nektarios K. Papadopoulos <npapadop(at)inaccessnetworks.com>
* Fix for a bug in makeAction where va_arg was beeing called one
extra time.
2007-04-28 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* SF Tracker [ 1703533 ] Patch to make it compile under FreeBSD
Submitted By: Timothy Redaelli - drittz
I made some patches to make it compile under FreeBSD using
gethostbyaddr_r when supported.
2007-04-28 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* [pupnp-devel] Type mixup on x86_64 causes UPNP_E_OUTOF_MEMORY
Submitted By: Glen Masgai
after an UpnpSendActionAsync() for example, i get UPNP_E_OUTOF_MEMORY
in the callback using 1.4.4 on a x86_64 system. This happens in
http_MakeMessage(), which in some cases get called with wrong types
(int instead of size_t) in combination with format "b" and "Q".
The attached patch should fix this.
************************************************************************* *************************************************************************
Version 1.4.4 Version 1.4.4
************************************************************************* *************************************************************************

3
THANKS
View File

@@ -8,12 +8,14 @@ exempt of errors.
- Arno Willig - Arno Willig
- Chaos - Chaos
- Craig Nelson
- David Maass - David Maass
- Emil Ljungdahl - Emil Ljungdahl
- Erik Johansson - Erik Johansson
- Eric Tanguy - Eric Tanguy
- Erwan Velu - Erwan Velu
- Fredrik Svensson - Fredrik Svensson
- Glen Masgai
- Jiri Zouhar - Jiri Zouhar
- John Dennis - John Dennis
- Jonathan (no_dice) - Jonathan (no_dice)
@@ -27,4 +29,5 @@ exempt of errors.
- Michael (Oxy) - Michael (Oxy)
- Paul Vixie - Paul Vixie
- Siva Chandran - Siva Chandran
- Timothy Redaelli

View File

@@ -13,7 +13,3 @@ autoreconf --force --install -Wall -Wno-obsolete $* || exit 1
echo "Now run ./configure and then make." echo "Now run ./configure and then make."
exit 0 exit 0

View File

@@ -10,7 +10,7 @@
AC_PREREQ(2.60) AC_PREREQ(2.60)
AC_INIT([libupnp], [1.4.4], [mroberto@users.sourceforge.net]) AC_INIT([libupnp], [1.4.5], [mroberto@users.sourceforge.net])
# *Independently* of the above libupnp package version, the libtool version # *Independently* of the above libupnp package version, the libtool version
# of the 3 libraries need to be updated whenever there is a change released : # of the 3 libraries need to be updated whenever there is a change released :
# "current:revision:age" (this is NOT the same as the package version), where: # "current:revision:age" (this is NOT the same as the package version), where:
@@ -48,6 +48,11 @@ AC_CONFIG_SRCDIR(upnp/inc/upnp.h)
AM_INIT_AUTOMAKE([1.8 -Wall foreign subdir-objects dist-bzip2]) AM_INIT_AUTOMAKE([1.8 -Wall foreign subdir-objects dist-bzip2])
#
# Get canonical host names in host and host_os
#
AC_CANONICAL_HOST
# #
# There are 3 configuration files : # There are 3 configuration files :
# 1) "./autoconfig.h" is auto-generated and used only internally during build # 1) "./autoconfig.h" is auto-generated and used only internally during build
@@ -131,11 +136,14 @@ RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code])
# version on that. # version on that.
docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}" docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}"
AC_MSG_CHECKING([for documentation directory]) AC_MSG_CHECKING([for documentation directory])
AC_ARG_WITH([documentation], AC_ARG_WITH(
AS_HELP_STRING([--with-documentation=directory_name], [documentation],
AS_HELP_STRING(
[--with-documentation=directory_name],
[where documentation is installed [where documentation is installed
@<:@[DATADIR/doc/]AC_PACKAGE_NAME[-]AC_PACKAGE_VERSION@:>@]) @<:@[DATADIR/doc/]AC_PACKAGE_NAME[-]AC_PACKAGE_VERSION@:>@])
AS_HELP_STRING([--without-documentation], AS_HELP_STRING(
[--without-documentation],
[do not install the documentation]), [do not install the documentation]),
[], [],
[with_documentation=no]) [with_documentation=no])
@@ -159,10 +167,19 @@ AC_PROG_INSTALL
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
AC_PROG_EGREP AC_PROG_EGREP
# #
# Default compilation flags # Default compilation flags
# #
echo "--------------------- Default compilation flags -------------------------------"
echo host is $host
echo host_os is $host_os
case $host_os in
FreeBSD*)
echo "Using FreeBSD specific compiler settings"
# Put FreeBSD specific compiler flags here
;;
*)
echo "Using non-specific system compiler settings"
if test x"$enable_debug" = xyes; then if test x"$enable_debug" = xyes; then
# AC_PROG_CC already sets CFLAGS to "-g -O2" by default # AC_PROG_CC already sets CFLAGS to "-g -O2" by default
: :
@@ -170,14 +187,20 @@ else
# add optimise for size # add optimise for size
AX_CFLAGS_GCC_OPTION([-Os]) AX_CFLAGS_GCC_OPTION([-Os])
fi fi
;;
esac
AX_CFLAGS_WARN_ALL AX_CFLAGS_WARN_ALL
echo "-------------------------------------------------------------------------------"
# #
# Lot's of stuff to ensure large file support # Lot's of stuff to ensure large file support
# #
AC_TYPE_SIZE_T
AC_TYPE_OFF_T AC_TYPE_OFF_T
AC_DEFINE(_LARGE_FILE_SOURCE, [], [Large files support]) AC_DEFINE([_LARGE_FILE_SOURCE], [], [Large files support])
AC_DEFINE(_FILE_OFFSET_BITS, [64], [File Offset size]) AC_DEFINE([_FILE_OFFSET_BITS], [64], [File Offset size])
# #
@@ -186,7 +209,24 @@ AC_DEFINE(_FILE_OFFSET_BITS, [64], [File Offset size])
AC_HEADER_STDC AC_HEADER_STDC
# libupnp code doesn't use autoconf variables yet, # libupnp code doesn't use autoconf variables yet,
# so just abort if a header file is not found. # so just abort if a header file is not found.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h],[],[AC_MSG_ERROR([required header file missing])]) AC_CHECK_HEADERS(
[ \
arpa/inet.h \
fcntl.h \
limits.h \
netdb.h \
netinet/in.h \
stdlib.h \
string.h \
sys/ioctl.h \
sys/socket.h \
sys/time.h \
sys/timeb.h \
syslog.h \
unistd.h \
],
[],
[AC_MSG_ERROR([required header file missing])])
# #
@@ -202,17 +242,19 @@ TYPE_SOCKLEN_T
# #
AC_FUNC_VPRINTF AC_FUNC_VPRINTF
AC_FUNC_FSEEKO AC_FUNC_FSEEKO
AC_CHECK_FUNCS(ftime,, [AC_CHECK_LIB(compat, ftime)])
# #
# Checks for POSIX Threads # Checks for POSIX Threads
# #
ACX_PTHREAD([],[AC_MSG_ERROR([POSIX threads are required to build this program])]) ACX_PTHREAD(
[],
[AC_MSG_ERROR([POSIX threads are required to build this program])])
AC_CONFIG_FILES([
Makefile
AC_CONFIG_FILES([Makefile
ixml/Makefile ixml/Makefile
ixml/doc/Makefile ixml/doc/Makefile
threadutil/Makefile threadutil/Makefile
@@ -222,5 +264,6 @@ AC_CONFIG_FILES([Makefile
libupnp.pc libupnp.pc
]) ])
AC_OUTPUT AC_OUTPUT

View File

@@ -620,7 +620,7 @@ ixmlNode_cloneNode(IXML_Node *nodeptr,
*/ */
EXPORT_SPEC BOOL EXPORT_SPEC BOOL
ixmlNode_hasAttributes(IXML_Node *node ixmlNode_hasAttributes(IXML_Node *nodeptr
/** The {\bf Node} to query for attributes. */ /** The {\bf Node} to query for attributes. */
); );
@@ -630,7 +630,7 @@ ixmlNode_hasAttributes(IXML_Node *node
*/ */
EXPORT_SPEC void EXPORT_SPEC void
ixmlNode_free(IXML_Node *IXML_Node ixmlNode_free(IXML_Node *nodeptr
/** The {\bf Node} to free. */ /** The {\bf Node} to free. */
); );

View File

@@ -47,6 +47,10 @@ extern "C" {
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef __FreeBSD__
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#endif
#ifdef PTHREAD_MUTEX_RECURSIVE #ifdef PTHREAD_MUTEX_RECURSIVE
/* This system has SuS2-compliant mutex attributes. /* This system has SuS2-compliant mutex attributes.
* E.g. on Cygwin, where we don't have the old nonportable (NP) symbols * E.g. on Cygwin, where we don't have the old nonportable (NP) symbols

View File

@@ -256,8 +256,8 @@ makeAction( IN int response,
IN const char *Arg, IN const char *Arg,
IN va_list ArgList ) IN va_list ArgList )
{ {
const char *ArgName, const char *ArgName;
*ArgValue; const char *ArgValue;
char *ActBuff; char *ActBuff;
int Idx = 0; int Idx = 0;
IXML_Document *ActionDoc; IXML_Document *ActionDoc;
@@ -298,7 +298,7 @@ makeAction( IN int response,
if( NumArg > 0 ) { if( NumArg > 0 ) {
//va_start(ArgList, Arg); //va_start(ArgList, Arg);
ArgName = Arg; ArgName = Arg;
while( Idx++ != NumArg ) { for ( ; ; ) {
ArgValue = va_arg( ArgList, const char * ); ArgValue = va_arg( ArgList, const char * );
if( ArgName != NULL ) { if( ArgName != NULL ) {
@@ -313,7 +313,11 @@ makeAction( IN int response,
ixmlNode_appendChild( node, ( IXML_Node * ) Ele ); ixmlNode_appendChild( node, ( IXML_Node * ) Ele );
} }
if (++Idx < NumArg) {
ArgName = va_arg( ArgList, const char * ); ArgName = va_arg( ArgList, const char * );
} else {
break;
}
} }
//va_end(ArgList); //va_end(ArgList);
} }

View File

@@ -34,6 +34,7 @@
* messages. * messages.
************************************************************************/ ************************************************************************/
#define _GNU_SOURCE // For strcasestr() in string.h
#include "config.h" #include "config.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
@@ -2434,7 +2435,8 @@ raw_find_str( IN memptr * raw_value,
c = raw_value->buf[raw_value->length]; // save c = raw_value->buf[raw_value->length]; // save
raw_value->buf[raw_value->length] = 0; // null-terminate raw_value->buf[raw_value->length] = 0; // null-terminate
ptr = strstr( raw_value->buf, str ); // Use strcasestr because the string may not always be exact case
ptr = strcasestr( raw_value->buf, str );
raw_value->buf[raw_value->length] = c; // restore raw_value->buf[raw_value->length] = c; // restore

View File

@@ -606,8 +606,8 @@ http_Download( IN const char *url_str,
*hoststr, *hoststr,
*temp; *temp;
http_parser_t response; http_parser_t response;
size_t msg_length, size_t msg_length;
hostlen; size_t hostlen;
memptr ctype; memptr ctype;
size_t copy_len; size_t copy_len;
membuffer request; membuffer request;
@@ -648,9 +648,10 @@ http_Download( IN const char *url_str,
ret_code = http_MakeMessage( ret_code = http_MakeMessage(
&request, 1, 1, &request, 1, 1,
"QsbcDCUc", "Q" "s" "bcDCUc",
HTTPMETHOD_GET, url.pathquery.buff, url.pathquery.size, HTTPMETHOD_GET, url.pathquery.buff, url.pathquery.size,
"HOST: ", hoststr, hostlen ); "HOST: ",
hoststr, hostlen );
if( ret_code != 0 ) { if( ret_code != 0 ) {
DBGONLY( UpnpPrintf DBGONLY( UpnpPrintf
( UPNP_INFO, HTTP, __FILE__, __LINE__, ( UPNP_INFO, HTTP, __FILE__, __LINE__,
@@ -766,7 +767,7 @@ MakePostMessage( const char *url_str,
{ {
int ret_code = 0; int ret_code = 0;
char *urlPath = alloca( strlen( url_str ) + 1 ); char *urlPath = alloca( strlen( url_str ) + 1 );
int hostlen = 0; size_t hostlen = 0;
char *hoststr, char *hoststr,
*temp; *temp;
@@ -799,7 +800,7 @@ MakePostMessage( const char *url_str,
hostlen = strlen( hoststr ); hostlen = strlen( hoststr );
*temp = '/'; *temp = '/';
DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__, DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
"HOSTNAME : %s Length : %d\n", hoststr, hostlen ); "HOSTNAME : %s Length : %zd\n", hoststr, hostlen );
) )
if( contentLength >= 0 ) { if( contentLength >= 0 ) {
@@ -1101,9 +1102,9 @@ MakeGetMessage( const char *url_str,
{ {
int ret_code; int ret_code;
char *urlPath = alloca( strlen( url_str ) + 1 ); char *urlPath = alloca( strlen( url_str ) + 1 );
int querylen = 0; size_t querylen = 0;
const char *querystr; const char *querystr;
int hostlen = 0; size_t hostlen = 0;
char *hoststr, char *hoststr,
*temp; *temp;
@@ -1136,7 +1137,7 @@ MakeGetMessage( const char *url_str,
hostlen = strlen( hoststr ); hostlen = strlen( hoststr );
*temp = '/'; *temp = '/';
DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__, DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
"HOSTNAME : %s Length : %d\n", hoststr, hostlen ); "HOSTNAME : %s Length : %zd\n", hoststr, hostlen );
) )
if( proxy_str ) { if( proxy_str ) {
@@ -1149,9 +1150,10 @@ MakeGetMessage( const char *url_str,
ret_code = http_MakeMessage( ret_code = http_MakeMessage(
request, 1, 1, request, 1, 1,
"QsbcDCUc", "Q" "s" "bcDCUc",
HTTPMETHOD_GET, querystr, querylen, HTTPMETHOD_GET, querystr, querylen,
"HOST: ", hoststr, hostlen ); "HOST: ",
hoststr, hostlen );
if( ret_code != 0 ) { if( ret_code != 0 ) {
DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__, DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
@@ -1780,8 +1782,8 @@ http_SendStatusResponse( IN SOCKINFO * info,
* fmt types: * fmt types:
* 'B': arg = int status_code * 'B': arg = int status_code
* appends content-length, content-type and HTML body for given code * appends content-length, content-type and HTML body for given code
* 'b': arg1 = const char* buf; arg2 = size_t buf_length * 'b': arg1 = const char* buf;
* memory ptr * arg2 = size_t buf_length memory ptr
* 'C': (no args) appends a HTTP CONNECTION: close header * 'C': (no args) appends a HTTP CONNECTION: close header
* depending on major,minor version * depending on major,minor version
* 'c': (no args) appends CRLF "\r\n" * 'c': (no args) appends CRLF "\r\n"
@@ -1790,15 +1792,17 @@ http_SendStatusResponse( IN SOCKINFO * info,
* 'G': arg = range information // add range header * 'G': arg = range information // add range header
* 'h': arg = off_t number // appends off_t number * 'h': arg = off_t number // appends off_t number
* 'K': (no args) // add chunky header * 'K': (no args) // add chunky header
* 'N': arg1 = int content_length // content-length header * 'N': arg1 = off_t content_length // content-length header
* 'q': arg1 = http_method_t, arg2 = (uri_type *) // request start line and HOST header * 'q': arg1 = http_method_t // request start line and HOST header
* 'Q': arg1 = http_method_t; arg2 = char* url; * arg2 = (uri_type *)
* arg3 = int url_length // start line of request * 'Q': arg1 = http_method_t; // start line of request
* arg2 = char* url;
* arg3 = size_t url_length
* 'R': arg = int status_code // adds a response start line * 'R': arg = int status_code // adds a response start line
* 'S': (no args) appends HTTP SERVER: header * 'S': (no args) appends HTTP SERVER: header
* 's': arg = const char* C_string * 's': arg = const char* C_string
* 'T': arg = char * content_type; format e.g: "text/html"; * 'T': arg = char * content_type; format
* content-type header * e.g: "text/html"; content-type header
* 't': arg = time_t * gmt_time // appends time in RFC 1123 fmt * 't': arg = time_t * gmt_time // appends time in RFC 1123 fmt
* 'U': (no args) appends HTTP USER-AGENT: header * 'U': (no args) appends HTTP USER-AGENT: header
* 'X': arg = const char useragent; "redsonic" HTTP X-User-Agent: useragent * 'X': arg = const char useragent; "redsonic" HTTP X-User-Agent: useragent
@@ -2165,7 +2169,7 @@ MakeGetMessageEx( const char *url_str,
{ {
int errCode = UPNP_E_SUCCESS; int errCode = UPNP_E_SUCCESS;
char *urlPath = NULL; char *urlPath = NULL;
int hostlen = 0; size_t hostlen = 0;
char *hoststr, char *hoststr,
*temp; *temp;
@@ -2210,16 +2214,16 @@ MakeGetMessageEx( const char *url_str,
*temp = '/'; *temp = '/';
DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__, DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
"HOSTNAME : %s Length : %d\n", hoststr, "HOSTNAME : %s Length : %zd\n",
hostlen ); hoststr, hostlen );
) )
errCode = http_MakeMessage( errCode = http_MakeMessage(
request, 1, 1, request, 1, 1,
"QsbcGDCUc", "Q" "s" "bc" "GDCUc",
HTTPMETHOD_GET, HTTPMETHOD_GET, url->pathquery.buff, url->pathquery.size,
url->pathquery.buff, url->pathquery.size, "HOST: ",
"HOST: ", hoststr, hostlen, hoststr, hostlen,
pRangeSpecifier ); pRangeSpecifier );
if( errCode != 0 ) { if( errCode != 0 ) {

View File

@@ -34,8 +34,11 @@
************************************************************************/ ************************************************************************/
#ifdef __FreeBSD__ #ifdef __FreeBSD__
#include <osreldate.h>
#if __FreeBSD_version < 601103
#include <lwres/netdb.h> #include <lwres/netdb.h>
#endif #endif
#endif
#include "config.h" #include "config.h"
#include "uri.h" #include "uri.h"
@@ -620,7 +623,7 @@ parse_hostport( const char *in,
&h, &h,
temp_hostbyname_buff, temp_hostbyname_buff,
BUFFER_SIZE, &errcode ); BUFFER_SIZE, &errcode );
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__) && __FreeBSD_version < 601103
h = lwres_gethostbyname_r( temp_host_name, h = lwres_gethostbyname_r( temp_host_name,
&h_buf, &h_buf,
temp_hostbyname_buff, temp_hostbyname_buff,

View File

@@ -611,9 +611,9 @@ SoapSendAction( IN char *action_url,
char *xml_end = char *xml_end =
"</s:Body>\r\n" "</s:Body>\r\n"
"</s:Envelope>\r\n\r\n"; "</s:Envelope>\r\n\r\n";
int xml_start_len; size_t xml_start_len;
int xml_end_len; size_t xml_end_len;
int action_str_len; size_t action_str_len;
*response_node = NULL; // init *response_node = NULL; // init
@@ -757,13 +757,13 @@ SoapSendActionEx( IN char *action_url,
char *xml_end = char *xml_end =
"</s:Body>\r\n" "</s:Body>\r\n"
"</s:Envelope>\r\n"; "</s:Envelope>\r\n";
int xml_start_len; size_t xml_start_len;
int xml_header_start_len; size_t xml_header_start_len;
int xml_header_str_len; size_t xml_header_str_len;
int xml_header_end_len; size_t xml_header_end_len;
int xml_body_start_len; size_t xml_body_start_len;
int action_str_len; size_t action_str_len;
int xml_end_len; size_t xml_end_len;
off_t content_length; off_t content_length;
*response_node = NULL; // init *response_node = NULL; // init
@@ -821,7 +821,7 @@ SoapSendActionEx( IN char *action_url,
xml_body_start_len + action_str_len + xml_end_len; xml_body_start_len + action_str_len + xml_end_len;
if (http_MakeMessage( if (http_MakeMessage(
&request, 1, 1, &request, 1, 1,
"q" "N" "s" "sssbsc" "Uc" "bbbbbbb", "q" "N" "s" "sssbsc" "Uc" "b" "b" "b" "b" "b" "b" "b",
SOAPMETHOD_POST, &url, SOAPMETHOD_POST, &url,
content_length, content_length,
ContentTypeHeader, ContentTypeHeader,