From 1eeaf99b83e73d6f0bfd949f763e958fa1a22ef8 Mon Sep 17 00:00:00 2001 From: Marcelo Roberto Jimenez Date: Sun, 27 Jan 2008 02:13:08 +0000 Subject: [PATCH] Merge of trunk into branch-1.6.x. git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@306 119443c7-1b9e-41f8-b6fc-b9c35fce742c --- ChangeLog | 38 ++++++ THANKS | 4 + configure.ac | 25 +++- docs/dist/Makefile.am | 4 +- ...=> UPNP_E_UNSUBSCRIBE_UNACCEPTED-302.html} | 0 libupnp.spec | 2 +- m4/rt_bool_arg_enable.m4 | 4 +- threadutil/src/LinkedList.c | 2 +- threadutil/src/ThreadPool.c | 4 +- upnp/inc/upnp.h | 2 +- upnp/src/genlib/net/http/webserver.c | 2 +- upnp/src/genlib/net/uri/uri.c | 4 +- upnp/src/inc/webserver.h | 129 +++++++++--------- upnp/src/ssdp/ssdp_server.c | 10 +- 14 files changed, 147 insertions(+), 83 deletions(-) rename docs/dist/html/upnp/{UPNP_E_UNSUBSCRIBE_UNACCAPTED-302.html => UPNP_E_UNSUBSCRIBE_UNACCEPTED-302.html} (100%) diff --git a/ChangeLog b/ChangeLog index 0edd3a7..527536b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +******************************************************************************* +Version 1.6.4 +******************************************************************************* + +2008-01-23 Marcelo Jimenez + * Workaround for a problem with the new automake AM_CONDITIONAL macro + from autotools-1.10. Thanks to Ingo Hofmann for helping with debugging + this one. + +2008-01-22 Marcelo Jimenez + * Added quoting to macros AC_CONFIG_AUX_DIR, AC_CONFIG_MACRO_DIR and + AC_CONFIG_SRCDIR in configure.ac. Also changed the name of the + auxiliary directory in AC_CONFIG_AUX_DIR to build-aux. + +2008-01-22 Marcelo Jimenez + * Fix for setsockopt() in Threadpool.c to allow more than one process + to join the multicast-group on OSX. Thanks to Ingo Hofmann. + +2008-01-22 Marcelo Jimenez + * Using defined(__OSX__) || defined(__APPLE__) instead of just + defined(__OSX__) in the code. Thanks to Ingo Hofmann and Chris + Pickel. + +2008-01-21 Marcelo Jimenez + * Fix for isFileInVirtualDir. Thanks to Peter Hartley for the patch. + +2008-01-07 Marcelo Jimenez + * Putting back a "defined(__OSX__)" that has been removed in the + previous *BSD patch. Thanks to Chris Pickel for pointing it out. + +2008-01-07 Marcelo Jimenez + * SF Patches Tracker [ 1865812 ] typo in docs comment + Submitted By: Hartmut Holzgraefe - hholzgra + typo in docs comment ACCAPTED instead of ACCEPTED in + @name UPNP_E_UNSUBSCRIBE_UNACCAPTED [-302] + Also, the documentation file name was mispelled and was corrected in + the Makefile.am. + ******************************************************************************* Version 1.6.3 ******************************************************************************* diff --git a/THANKS b/THANKS index ec9682e..f226472 100644 --- a/THANKS +++ b/THANKS @@ -10,6 +10,7 @@ exempt of errors. - Arno Willig - Bob Ciora - Chaos +- Chris Pickel - Craig Nelson - David Maass - Emil Ljungdahl @@ -20,6 +21,8 @@ exempt of errors. - Fabrice Fontaine - Fredrik Svensson - Glen Masgai +- Hartmut Holzgraefe - hholzgra +- Ingo Hofmann - Jiri Zouhar - John Dennis - Jonathan Casiot (no_dice) @@ -34,6 +37,7 @@ exempt of errors. - Oskar Liljeblad - Michael (oxygenic) - Paul Vixie +- Peter Hartley - Rene Hexel - Robert Gingher (robsbox) - Siva Chandran diff --git a/configure.ac b/configure.ac index c8e84d2..092bdc2 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ AC_PREREQ(2.60) -AC_INIT([libupnp], [1.6.3], [mroberto@users.sourceforge.net]) +AC_INIT([libupnp], [1.6.4], [mroberto@users.sourceforge.net]) dnl ############################################################################ dnl # *Independently* of the above libupnp package version, the libtool version dnl # of the 3 libraries need to be updated whenever there is a change released: @@ -107,9 +107,22 @@ dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:1:2]) dnl #AC_SUBST([LT_VERSION_UPNP], [3:2:0]) dnl # dnl ############################################################################ +dnl # Release 1.6.4: +dnl # "current:revision:age" +dnl # +dnl # - Code has changed in threadutil +dnl # revision: 1 -> 2 +dnl # - Code has changed in upnp +dnl # revision: 2 -> 3 +dnl # +dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0]) +dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:2:2]) +dnl #AC_SUBST([LT_VERSION_UPNP], [3:3:0]) +dnl # +dnl ############################################################################ AC_SUBST([LT_VERSION_IXML], [2:4:0]) -AC_SUBST([LT_VERSION_THREADUTIL], [4:1:2]) -AC_SUBST([LT_VERSION_UPNP], [3:2:0]) +AC_SUBST([LT_VERSION_THREADUTIL], [4:2:2]) +AC_SUBST([LT_VERSION_UPNP], [3:3:0]) dnl ############################################################################ dnl # Repeating the algorithm to place it closer to the modificatin place: dnl # - library code modified: revision++ @@ -120,9 +133,9 @@ dnl # *please update only once, before a formal release, not for each change* dnl ############################################################################ -AC_CONFIG_AUX_DIR(config.aux) -AC_CONFIG_MACRO_DIR(m4) -AC_CONFIG_SRCDIR(upnp/inc/upnp.h) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_SRCDIR([upnp/inc/upnp.h]) AM_INIT_AUTOMAKE([1.8 -Wall foreign subdir-objects dist-bzip2]) diff --git a/docs/dist/Makefile.am b/docs/dist/Makefile.am index 729f244..18b2b5e 100644 --- a/docs/dist/Makefile.am +++ b/docs/dist/Makefile.am @@ -39,7 +39,7 @@ EXTRA_DIST = \ ./html/upnp/UPNP_E_SOCKET_ERROR-208.html \ ./html/upnp/UPNP_E_CANCELED-210.html \ ./html/upnp/UPNP_E_SUBSCRIBE_UNACCEPTED-301.html \ - ./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCAPTED-302.html \ + ./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCEPTED-302.html \ ./html/upnp/UPNP_E_NOTIFY_UNACCEPTED-303.html \ ./html/upnp/UPNP_E_INVALID_ARGUMENT-501.html \ ./html/upnp/UPNP_E_FILE_NOT_FOUND-502.html \ @@ -295,7 +295,7 @@ if WITH_DOCUMENTATION ./html/upnp/UPNP_E_SOCKET_ERROR-208.html \ ./html/upnp/UPNP_E_CANCELED-210.html \ ./html/upnp/UPNP_E_SUBSCRIBE_UNACCEPTED-301.html \ - ./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCAPTED-302.html \ + ./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCEPTED-302.html \ ./html/upnp/UPNP_E_NOTIFY_UNACCEPTED-303.html \ ./html/upnp/UPNP_E_INVALID_ARGUMENT-501.html \ ./html/upnp/UPNP_E_FILE_NOT_FOUND-502.html \ diff --git a/docs/dist/html/upnp/UPNP_E_UNSUBSCRIBE_UNACCAPTED-302.html b/docs/dist/html/upnp/UPNP_E_UNSUBSCRIBE_UNACCEPTED-302.html similarity index 100% rename from docs/dist/html/upnp/UPNP_E_UNSUBSCRIBE_UNACCAPTED-302.html rename to docs/dist/html/upnp/UPNP_E_UNSUBSCRIBE_UNACCEPTED-302.html diff --git a/libupnp.spec b/libupnp.spec index 7bcc7a4..893bf58 100644 --- a/libupnp.spec +++ b/libupnp.spec @@ -1,4 +1,4 @@ -Version: 1.6.2 +Version: 1.6.4 Summary: Universal Plug and Play (UPnP) SDK Name: libupnp Release: 1%{?dist} diff --git a/m4/rt_bool_arg_enable.m4 b/m4/rt_bool_arg_enable.m4 index 91300f8..789b3c0 100644 --- a/m4/rt_bool_arg_enable.m4 +++ b/m4/rt_bool_arg_enable.m4 @@ -12,7 +12,7 @@ dnl $2 = default value, shall be m4 constant, either [yes] or [no] dnl $3 = help string (default value is appended) e.g. [compile debugging code] dnl dnl @version $Id: rt_bool_arg_enable.m4,v 1.2 2006/02/18 14:35:09 r3mi Exp $ -dnl @author Rémi Turboult +dnl @author R�mi Turboult dnl @license GPLWithACException dnl dnl This file is free software, distributed under the terms of the GNU @@ -41,7 +41,7 @@ AC_DEFUN([RT_BOOL_ARG_ENABLE],[ )]) test "x$enable_[$1]" != [x]m4_if([$2],[yes],[no],[yes]) dnl && enable_[]Name=[$2] - AC_MSG_RESULT($enable_[]Name)dnl + AC_MSG_RESULT($enable_[]Name) AM_CONDITIONAL([ENABLE_]NAME, test x"$enable_[]Name" = xyes) dnl m4_popdef([NAME])dnl diff --git a/threadutil/src/LinkedList.c b/threadutil/src/LinkedList.c index 675c4f1..a67330f 100644 --- a/threadutil/src/LinkedList.c +++ b/threadutil/src/LinkedList.c @@ -31,7 +31,7 @@ #include "LinkedList.h" #include -#if (defined(BSD) && BSD >= 199306) || defined(__OSX__) +#if (defined(BSD) && BSD >= 199306) || defined(__OSX__) || defined(__APPLE__) #include #else #include diff --git a/threadutil/src/ThreadPool.c b/threadutil/src/ThreadPool.c index 6734a58..0085c89 100644 --- a/threadutil/src/ThreadPool.c +++ b/threadutil/src/ThreadPool.c @@ -229,7 +229,7 @@ static int SetPolicyType( PolicyType in ) #ifdef __CYGWIN__ /* TODO not currently working... */ return 0; -#elif defined(__OSX__) +#elif defined(__OSX__) || defined(__APPLE__) setpriority( PRIO_PROCESS, 0, 0 ); return 0; #elif defined(WIN32) @@ -389,7 +389,7 @@ static void SetSeed() gettimeofday(&t, NULL); #if defined(WIN32) srand( ( unsigned int )t.tv_usec + (unsigned int)ithread_get_current_thread_id().p ); -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__OSX__) || defined(__APPLE__) srand( ( unsigned int )t.tv_usec + (unsigned int)ithread_get_current_thread_id() ); #elif defined(__linux__) srand( ( unsigned int )t.tv_usec + ithread_get_current_thread_id() ); diff --git a/upnp/inc/upnp.h b/upnp/inc/upnp.h index 2dd2427..db6d9f7 100644 --- a/upnp/inc/upnp.h +++ b/upnp/inc/upnp.h @@ -413,7 +413,7 @@ #define UPNP_E_SUBSCRIBE_UNACCEPTED -301 /*! @} */ -/** @name UPNP_E_UNSUBSCRIBE_UNACCAPTED [-302] +/** @name UPNP_E_UNSUBSCRIBE_UNACCEPTED [-302] * {\tt UPNP_E_UNSUBSCRIBE_UNACCEPTED} signifies that an unsubscribe * request was rejected from the remote side. */ diff --git a/upnp/src/genlib/net/http/webserver.c b/upnp/src/genlib/net/http/webserver.c index f57db13..5ac80dd 100644 --- a/upnp/src/genlib/net/http/webserver.c +++ b/upnp/src/genlib/net/http/webserver.c @@ -745,7 +745,7 @@ isFileInVirtualDir( IN char *filePath ) return TRUE; } else { if( ( strncmp( pCurVirtualDir->dirName, filePath, webDirLen ) - == 0 ) && ( filePath[webDirLen] == '/' ) ) + == 0 ) && ( filePath[webDirLen] == '/' || filePath[webDirLen] == '\0' || filePath[webDirLen] == '?' ) ) return TRUE; } diff --git a/upnp/src/genlib/net/uri/uri.c b/upnp/src/genlib/net/uri/uri.c index 0dee1ce..a11cf19 100644 --- a/upnp/src/genlib/net/uri/uri.c +++ b/upnp/src/genlib/net/uri/uri.c @@ -555,7 +555,7 @@ parse_hostport( const char *in, int begin_port; int hostport_size = 0; int host_size = 0; -#if !defined(WIN32) && !defined(__OSX__) +#if !defined(WIN32) && !(defined(__OSX__) || defined(__APPLE__)) char temp_hostbyname_buff[BUFFER_SIZE]; struct hostent h_buf; #endif @@ -642,7 +642,7 @@ parse_hostport( const char *in, if ( h == NULL ) { errCode = 1; } -#elif defined(__OSX__) +#elif defined(__OSX__) || defined(__APPLE__) h = gethostbyname(temp_host_name); if ( h == NULL ) { errCode = 1; diff --git a/upnp/src/inc/webserver.h b/upnp/src/inc/webserver.h index 774c036..38499fa 100644 --- a/upnp/src/inc/webserver.h +++ b/upnp/src/inc/webserver.h @@ -56,88 +56,88 @@ struct SendInstruction }; /************************************************************************ -* Function: web_server_init -* -* Parameters: -* none -* -* Description: Initilialize the different documents. Initialize the -* memory for root directory for web server. Call to initialize global -* XML document. Sets bWebServerState to WEB_SERVER_ENABLED -* -* Returns: -* 0 - OK -* UPNP_E_OUTOF_MEMORY: note: alias_content is not freed here +* Function: web_server_init +* +* Parameters: +* none +* +* Description: Initilialize the different documents. Initialize the +* memory for root directory for web server. Call to initialize global +* XML document. Sets bWebServerState to WEB_SERVER_ENABLED +* +* Returns: +* 0 - OK +* UPNP_E_OUTOF_MEMORY: note: alias_content is not freed here ************************************************************************/ int web_server_init( void ); /************************************************************************ -* Function: web_server_destroy -* -* Parameters: -* none -* -* Description: Release memory allocated for the global web server root -* directory and the global XML document -* Resets the flag bWebServerState to WEB_SERVER_DISABLED -* -* Returns: -* void +* Function: web_server_destroy +* +* Parameters: +* none +* +* Description: Release memory allocated for the global web server root +* directory and the global XML document +* Resets the flag bWebServerState to WEB_SERVER_DISABLED +* +* Returns: +* void ************************************************************************/ void web_server_destroy( void ); /************************************************************************ -* Function: web_server_set_alias -* -* Parameters: -* alias_name: webserver name of alias; created by caller and freed by -* caller (doesn't even have to be malloc()d .) -* alias_content: the xml doc; this is allocated by the caller; and -* freed by the web server -* alias_content_length: length of alias body in bytes -* last_modified: time when the contents of alias were last -* changed (local time) -* -* Description: Replaces current alias with the given alias. To remove -* the current alias, set alias_name to NULL. -* -* Returns: -* 0 - OK -* UPNP_E_OUTOF_MEMORY: note: alias_content is not freed here +* Function: web_server_set_alias +* +* Parameters: +* alias_name: webserver name of alias; created by caller and freed by +* caller (doesn't even have to be malloc()d .) +* alias_content: the xml doc; this is allocated by the caller; and +* freed by the web server +* alias_content_length: length of alias body in bytes +* last_modified: time when the contents of alias were last +* changed (local time) +* +* Description: Replaces current alias with the given alias. To remove +* the current alias, set alias_name to NULL. +* +* Returns: +* 0 - OK +* UPNP_E_OUTOF_MEMORY: note: alias_content is not freed here ************************************************************************/ int web_server_set_alias( IN const char* alias_name, IN const char* alias_content, IN size_t alias_content_length, IN time_t last_modified ); /************************************************************************ -* Function: web_server_set_root_dir -* -* Parameters: -* IN const char* root_dir ; String having the root directory for the -* document -* -* Description: Assign the path specfied by the IN const char* root_dir -* parameter to the global Document root directory. Also check for -* path names ending in '/' -* -* Returns: -* int +* Function: web_server_set_root_dir +* +* Parameters: +* IN const char* root_dir ; String having the root directory for the +* document +* +* Description: Assign the path specfied by the IN const char* root_dir +* parameter to the global Document root directory. Also check for +* path names ending in '/' +* +* Returns: +* int ************************************************************************/ int web_server_set_root_dir( IN const char* root_dir ); /************************************************************************ -* Function: web_server_callback * -* * -* Parameters: * -* IN http_parser_t *parser, * -* INOUT http_message_t* req, * -* IN SOCKINFO *info * -* * -* Description: main entry point into web server; * -* handles HTTP GET and HEAD requests * -* * -* Returns: * -* void * +* Function: web_server_callback +* +* Parameters: +* IN http_parser_t *parser, +* INOUT http_message_t* req, +* IN SOCKINFO *info +* +* Description: main entry point into web server; +* handles HTTP GET and HEAD requests +* +* Returns: +* void ************************************************************************/ void web_server_callback( IN http_parser_t *parser, IN http_message_t* req, INOUT SOCKINFO *info ); @@ -148,3 +148,4 @@ void web_server_callback( IN http_parser_t *parser, IN http_message_t* req, INOU #endif // GENLIB_NET_HTTP_WEBSERVER_H + diff --git a/upnp/src/ssdp/ssdp_server.c b/upnp/src/ssdp/ssdp_server.c index 081485a..52bfbfb 100644 --- a/upnp/src/ssdp/ssdp_server.c +++ b/upnp/src/ssdp/ssdp_server.c @@ -870,6 +870,7 @@ get_ssdp_sockets( MiniServerSockArray * out ) UpnpPrintf( UPNP_CRITICAL, SSDP, __FILE__, __LINE__, "Error in socket operation !!!\n" ); + return UPNP_E_OUTOF_SOCKET; } setsockopt( ssdpReqSock, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof( ttl ) ); @@ -884,6 +885,7 @@ get_ssdp_sockets( MiniServerSockArray * out ) "Error in socket operation !!!\n" ); CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ); ) CLIENTONLY( UpnpCloseSocket( ssdpReqSock ); ) + return UPNP_E_OUTOF_SOCKET; } @@ -897,10 +899,11 @@ get_ssdp_sockets( MiniServerSockArray * out ) CLIENTONLY( UpnpCloseSocket( ssdpReqSock ); ) shutdown( ssdpSock, SD_BOTH ); UpnpCloseSocket( ssdpSock ); + return UPNP_E_SOCKET_ERROR; } -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__OSX__) || defined(__APPLE__) if( setsockopt( ssdpSock, SOL_SOCKET, SO_REUSEPORT, ( char * )&onOff, sizeof( onOff ) ) != 0 ) { UpnpPrintf( UPNP_CRITICAL, @@ -910,6 +913,7 @@ get_ssdp_sockets( MiniServerSockArray * out ) CLIENTONLY( UpnpCloseSocket( ssdpReqSock ); ) shutdown( ssdpSock, SD_BOTH ); UpnpCloseSocket( ssdpSock ); + return UPNP_E_SOCKET_ERROR; } #endif /* __FreeBSD__ */ @@ -928,6 +932,7 @@ get_ssdp_sockets( MiniServerSockArray * out ) UpnpCloseSocket( ssdpSock ); CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ); ) CLIENTONLY( UpnpCloseSocket( ssdpReqSock ); ) + return UPNP_E_SOCKET_BIND; } @@ -943,6 +948,7 @@ get_ssdp_sockets( MiniServerSockArray * out ) CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ); ) UpnpCloseSocket( ssdpSock ); CLIENTONLY( UpnpCloseSocket( ssdpReqSock ); ) + return UPNP_E_SOCKET_ERROR; } @@ -968,11 +974,13 @@ get_ssdp_sockets( MiniServerSockArray * out ) CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ); ) UpnpCloseSocket( ssdpSock ); CLIENTONLY( UpnpCloseSocket( ssdpReqSock ); ) + return UPNP_E_NETWORK_ERROR; } CLIENTONLY( out->ssdpReqSock = ssdpReqSock; ) out->ssdpSock = ssdpSock; + return UPNP_E_SUCCESS; }