Commit Graph

540 Commits

Author SHA1 Message Date
Marcelo Roberto Jimenez
cf79479b2b Introducing template object methods. 2010-09-12 00:28:22 -03:00
Marcelo Roberto Jimenez
81b28fbb90 Added UpnpString_cmp() and UpnpString_casecmp() methods to UpnpString.
UpnpString_set_String() and UpnpString_set_StringN now return error values.
String lenghts are size_t.
2010-09-11 17:53:49 -03:00
David Hoeung
c55eeccb67 Timeout for TCP connect
Hi,

I've made some modification to the libupnp v1.6.5
I've add a timeout for each TCP connect.

It is very useful when an UPnP device stop working and do not accept
connection for an UPnP action.

Modifications are only located in
upnp/src/genlib/net/http/httpreadwrite.c

For every TCP connection, I set the socket to non-blocking, perform
connect,
check result and wait during a timeout if necessary, then reset the
socket to blocking.

Please see this patch in attached file.

I hope it helps.

Regards,

David Hoeung
Consultant Extia
Orange Labs R&D

----
(cherry picked from commit 67009170d1)
2010-09-11 00:20:11 -03:00
Warwick Harvey
e0806a2116 Take notice of UPNP_USE_RWLOCK flag.
Updated threadutil to use mutexes instead of read-write locks if
UPNP_USE_RWLOCK is false (0).
(cherry picked from commit 2b399b1791)
2010-09-10 22:46:26 -03:00
Marcelo Roberto Jimenez
fdfcf75690 Remove some unused code plus some coding style in httpparser.c
(cherry picked from commit 0bec9ec1ae)
2010-09-10 19:51:54 -03:00
Marcelo Roberto Jimenez
e6d7eb7767 2010-09-10 Jean Sigwald <jean.sigwald(at)orange-ftgroup.com>
I discovered a reliable denial-of-service issue on the last stable
release of libupnp (1.6.6) remotely triggerable by any
unauthenticated user. The issue is related with a bad parsing of
malformed XML.
(cherry picked from commit 25a4bd6d25)
2010-09-10 19:51:54 -03:00
Marcelo Roberto Jimenez
6604d0a974 SF Patch Tracker [ 2854711 ] Patch for Solaris10 compilation and usage
Submitted By: zephyrus ( zephyrus00jp )

Patch for Solaris10 compilation and usage.
(cherry picked from commit 5755ac022f)
2010-09-10 19:04:35 -03:00
Marcelo Roberto Jimenez
30ee3c0cbb One setp further to stop the CLIENTONLY() mess.
(cherry picked from commit 0158f52ee2)
2010-09-10 19:04:35 -03:00
Marcelo Roberto Jimenez
159d2b1b1f Fix an UTF-8 issue in README.
(cherry picked from commit 0db4a6beac)
2010-09-10 00:48:44 -03:00
Chandra Penke
7f1e164a5a SUMMARY: Minor change in comment for SetMaxContentLenght in upnp.h
This is a follow up from issue 6 in tracker id 3056713: calling UpnpSetMaxContentLength() by passing '0' disables the content length checking. This is useful for developing some prototype applications that deal with a lot of XML/SOAP data, and for debugging.

The corresponding c file change is already in the pupnp tree. Copy/pasting the relevant block of code here for clarity:

In upnp/src/genlib/net/http/httpreadwrite.c:

if (g_maxContentLength > 0 && parser->content_length > (unsigned int)g_maxContentLength) {
	*http_error_code = HTTP_REQ_ENTITY_TOO_LARGE;
	line = __LINE__;
	ret = UPNP_E_OUTOF_BOUNDS;
	goto ExitFunction;
}

This block of code checks only does the bounds check if g_maxContentLength > 0, and it's only place g_maxContentLength is checked.

Attached is a patch against the latest sources.
2010-09-10 00:41:17 -03:00
Marcelo Roberto Jimenez
82a6e9f0cc Fix for coding style and compiler warning message:
src/genlib/miniserver/miniserver.c: In function ‘get_miniserver_sockets’:
src/genlib/miniserver/miniserver.c:592: warning: unused variable ‘actual_port6’
src/genlib/miniserver/miniserver.c:582: warning: unused variable ‘__ss_v6’
2010-09-10 00:18:24 -03:00
Chandra Penke
6b0d84fc95 Add support for conditionally enabling ipv6 2010-09-10 00:08:16 -03:00
Chandra Penke
15fb28c622 Fix for compilation in debug builds.
Ensure internal methods are declared as static since debug builds don't inline.
2010-09-10 00:00:00 -03:00
Marcelo Roberto Jimenez
0833b880d4 Fix for UpnpPrintf() in Chandra Penke's last commit.
src/ssdp/ssdp_ctrlpt.c: In function ‘SearchByTarget’:
src/ssdp/ssdp_ctrlpt.c:634: warning: format ‘%s’ expects type ‘char *’, but argument 6 has type ‘int’
(cherry picked from commit 92b241b560)
2010-09-09 23:01:09 -03:00
Chandra Penke
019c57eee0 Fix for regression in SSDP code to send/receive messages over UDP
Sending messages over UDP is broken in some Apple OSes
such as OS X and iOS. This might be broken in other OSes to but didn't
verify.

The fix is to modify the socket lenght argument of sendto to use the correct
sockaddr lenght dependng on whether the socket is IPV4 or IPV6.

Also added some error checks and debugging related to the issue
(cherry picked from commit 2b3ab1799b)
2010-09-09 23:01:09 -03:00
Marcelo Roberto Jimenez
64dedf72a8 Using UpnpReadHttpGet to download large files causes the application to
crash. This happens when the file being downloaded exceeds the device
memory - entirely possible when transferring video files.
The programmatic cause is that the logic implemented in the function
http_ReadHttpGet (which UpnpReadHttpGet calls) reads the entire file
into memory. The fix modifies the existing logic to discard data after
it's been read; there's no reason to keep it around since the caller
of UpnpReadHttpGet already has a copy of it.

This issue exists in 1.6.6 as well as the latest sources.

Patch submitted by Chandra (inactiveneurons).
(cherry picked from commit 4657e57766)
2010-09-07 22:49:34 -03:00
Marcelo Roberto Jimenez
a3efd63c5f In the latest sources, http_RequestAndResponse and other methods that
use connect() are broken. More specifically, connect() in these methods
is returning with an EINVAL. The programatic cause is that the address_len
argument passed to connect() is different in IPV4 vs IPV6 (as described in:
http://www.opengroup.org/onlinepubs/009695399/functions/connect.html).
The current code always uses the IPV6 size. The fix modifies each use of
connect() to use the correct size based on the address family being used.

Patch submitted by Chandra (inactiveneurons).
(cherry picked from commit 21660334e4)
2010-09-07 22:49:34 -03:00
Marcelo Roberto Jimenez
cf40abd922 Fix compilation error in upnp/src/gena/gena_ctrlpt.c (this is most
likely an error on all platforms).

Patch submitted by Chandra (inactiveneurons).
(cherry picked from commit 97af8b6fdb)
2010-09-07 22:49:34 -03:00
Marcelo Roberto Jimenez
4661334870 Fix compilation error in upnp/src/inc/ssdplib.h when compiling in OS X
(the netinet/* headers are not available).

Patch submitted by Chandra (inactiveneurons).
(cherry picked from commit 934bd2682f)
2010-09-07 22:49:34 -03:00
Marcelo Roberto Jimenez
4ebf890e92 Fix compilation error in ixml/inc/ixml.h when compiling with an
Objective-C compiler (when cross-compiling for iPhone devices).

Patch submitted by Chandra (inactiveneurons).
(cherry picked from commit b8e9628140)
2010-09-07 22:49:34 -03:00
Marcelo Roberto Jimenez
f97315f778 White spaces.
(cherry picked from commit b3b7a91a64)
2010-09-07 11:45:59 -03:00
Marcelo Roberto Jimenez
947599710d Issue regarding the GENA notifications. A string termination indicator was added
at the end of the notification ("\r\n") in notify_send_and_recv() in
upnp/src/gena/gena_device.c.

Patch by Fabrice Fontaine.
(cherry picked from commit ebc941f265)
2010-09-07 11:45:59 -03:00
Marcelo Roberto Jimenez
36a6887834 Adding .gitignore.
(cherry picked from commit 842a6ce5c8)
2010-09-07 11:45:59 -03:00
Marcelo Roberto Jimenez
a15e0c99d7 * upnp/src/api/Discovery.c: Fix a serious bug and memory leak in
UpnpDiscovery_strcpy_DeviceType(). Thanks to David Blanchet for the
patch.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@584 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-22 11:32:09 +00:00
Marcelo Roberto Jimenez
93a3016df1 Forward port of svn rev. 581: White spaces.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@583 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-22 02:13:34 +00:00
Marcelo Roberto Jimenez
36d6a34f5d Forward port of svn rev. 580:
The last part of Ronan Menard's patch.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@582 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-22 02:11:44 +00:00
Marcelo Roberto Jimenez
9763158d69 Forward port of svn rev. 578:
* upnp/src/ssdp/ssdp_device.c: Fix for IPV6 ULA/GUA issues.
* upnp/src/ssdp/ssdp_ctrlpt.c: Fix for IPV6 ULA/GUA issues.
* upnp/src/ssdp/ssdp_server.c: Fix for IPV6 ULA/GUA issues.

Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@579 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-22 01:44:25 +00:00
Marcelo Roberto Jimenez
2963919081 Forward port of svn rev. 576:
* upnp/src/genlib/miniserver/miniserver.c: Fix for IPV6 ULA/GUA issues.

Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@577 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 22:16:24 +00:00
Marcelo Roberto Jimenez
9f7936781e Forward port of svn rev. 574:
* gena_subscribe(): Fix for IPV6 ULA/GUA issues.

Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@575 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:57:40 +00:00
Marcelo Roberto Jimenez
bc724a8073 Forward port of svn rev. 572:
* SOCKET ssdpSock6UlaGua: created variable for later use.

Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@573 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:43:54 +00:00
Marcelo Roberto Jimenez
7ff1d56906 Forward port of svn rev. 569:
* SSDP_IPV6_SITELOCAL: new macro.

Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@571 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:36:22 +00:00
Marcelo Roberto Jimenez
2150bdc5b6 Forward port of svn rev. 568:
The scope of the macro NUM_HANDLE is now restricted to upnpapi.c.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@570 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:34:17 +00:00
Marcelo Roberto Jimenez
5bb3621626 Forward port of svn rev. 566:
* InitHandleList() has never been implemented, I guess no one has ever
called it, so remove it.
* GetFreeHandle() and FreeHandle() are now static as they should.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@567 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:15:39 +00:00
Marcelo Roberto Jimenez
b895fce678 Forward port of svn rev. 564:
* New internal buffer added to store global/ula IPV6 address.
* Macros to test whether an IPV6 address is global or ula.
* UpnpGetServerUlaGuaIp6Address(): added interface.
* IN6_IS_ADDR_GLOBAL, IN6_IS_ADDR_ULA: new macros.
* gIF_IPV6_ULA_GUA: new buffer.
* UpnpRegisterRootDevice3(): Change to the test of already registered
devices for IPV6.
* UpnpGetIfInfo(): gua/ula issues.

Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@565 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 20:51:29 +00:00
Marcelo Roberto Jimenez
bc551a1ab3 Forward port of svn rev. 562: English mispelling.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@563 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-19 13:56:00 +00:00
Marcelo Roberto Jimenez
a13d09176f Forward port of svn rev. 560: libUPnP does support IPV6 now.
Patch submitted by Ronan Menard.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@561 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-19 13:50:21 +00:00
Marcelo Roberto Jimenez
03c858af51 Backport of svn rev. 558: HTTP version equal to 1.0 should failed as required
by the UPnP certification tool.

Patch submitted by Ronan Menard.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@559 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-19 13:39:44 +00:00
Marcelo Roberto Jimenez
b2e38b2fca SF Bug Tracker [ 3022490 ] String declaration fix for patch applied in 3007407
Hello,

	When my patch for tracker ID 3007407 was accepted, the definition of the
	serviceList string was changed from

	#define SERVICELIST_STR "serviceList"

	to

	static const char *SERVICELIST_STR = "serviceList";

	During internal code review of the final patch, it was pointed out that 
	sizeof(SERVICELIST_STR) == 4 since SERVICELIST_STR is now declared as
	a pointer instead of an array.

	If you wish to use a variable instead of a define, I suggest the
	following instead:

	static const char SERVICELIST_STR[] = "serviceList";

	Thanks,
	Chuck Thomason



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@556 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-06-28 20:36:30 +00:00
Marcelo Roberto Jimenez
fab22807c0 Remove excessive 'dnl's from libupnp.m4.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@554 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-06-26 11:09:06 +00:00
Marcelo Roberto Jimenez
338b22b754 SF Bug Tracker [ 3007407 ] Service traversal issue in AdvertiseAndReply()
Submitted: Chuck Thomason ( cyt4 ) - 2010-05-26 15:07:39 UTC

	When the UPnP server is started, one alive message is broadcast for each
	service in each device. It appears that libupnp's implementation of the
	alive message generation does not correctly navigate the XML description
	document when locating the services. This can result in the wrong UDN
	being used in the alive message sent for a service.

	In my specific case (see attached XML), the root EchoSTB device contains
	no services, but its embedded MediaServer device contains 2 services.
	When the existing libupnp code traverses the EchoSTB device in the XML,
	it searches the global list of serviceLists within the document instead
	of searching for a serviceList that is its direct child node. The
	ContentDirectory and ConnectionManager services are then announced with
	the UDN of EchoSTB1 (the root device) instead of with the UDN of
	MediaServer, which is actually their parent device.

	I discovered this behavior using libupnp-1.6.6. I have generated a patch
	against branch-1.6.x that corrects the XML navigation such that all
	services are traversed from their parent device, which results in the
	correct UDN being sent in the alive message for each service. I built
	from branch-1.6.x without this patch, tested, and confirmed that the
	issue still exists as I observed it in libupnp-1.6.6. I then built
	from branch-1.6.x with this patch, tested, and confirmed that the
	issue was resolved.

	Thanks,
	Chuck Thomason



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@552 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-06-17 17:02:03 +00:00
Nick Leverton
11524cc218 Add PTHREAD_CFLAGS to Libs: in libupnp.pc, as assumed by acx_pthread.m4
(fixes binutils-gold link failure)


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@550 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-05-14 13:09:22 +00:00
Marcelo Roberto Jimenez
54727b2a9e Forward port of svn revision 548:
[svn] SF Bug Tracker [ 2995758 ] libupnp 1.6.6, wrong bind when reuseaddr is 1.
Submitted: viallard anthony ( homer242 )
When trying to use reuseaddr option in miniserver/miniserver.c, there
isn't a affectation of the port chosen (serverAddr.sin_port isn't
receive listen_port variable value).


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@549 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-05-07 11:20:00 +00:00
Marcelo Roberto Jimenez
71ec18a3a9 Remove ifdef's code from upnp.h.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@547 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-05-01 02:25:06 +00:00
Marcelo Roberto Jimenez
99758f2dff Changelog update.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@545 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 14:57:48 +00:00
Marcelo Roberto Jimenez
3772ad4595 Define PROTOTYPES to be one by default in global.h. This affects the
RSA MD5 code.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@544 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 14:51:57 +00:00
Marcelo Roberto Jimenez
d33ad5c03e Separation of the ClientSubscription object.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@543 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 13:57:25 +00:00
Marcelo Roberto Jimenez
ad9bcc9100 Comment.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@542 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 12:07:36 +00:00
Marcelo Roberto Jimenez
da5cf568e6 Recasting away constness.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@540 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 11:42:32 +00:00
Marcelo Roberto Jimenez
7f1be91e76 Mostly whitespaces and code convergence.
client_table has been totaly rewritten, so remove the old license.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@536 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 00:29:52 +00:00
Marcelo Roberto Jimenez
01039a1d9a Protect the object destructors agains null pointers on deletion, which
should be something valid. Missed this one.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@535 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 00:25:41 +00:00