--- libupnp-1.6.6.orig/debian/compat +++ libupnp-1.6.6/debian/compat @@ -0,0 +1 @@ +7 --- libupnp-1.6.6.orig/debian/README.source +++ libupnp-1.6.6/debian/README.source @@ -0,0 +1,5 @@ +This package uses quilt to manage all modifications to the upstream +source. Changes are stored in the source package as diffs in +debian/patches and applied during the build. + +See /usr/share/doc/quilt/README.source for a detailed explanation. --- libupnp-1.6.6.orig/debian/libupnp3-dev.install +++ libupnp-1.6.6/debian/libupnp3-dev.install @@ -0,0 +1,4 @@ +usr/lib/*.{a,so} +usr/lib/pkgconfig/* +usr/include/* +usr/share/doc/* --- libupnp-1.6.6.orig/debian/watch +++ libupnp-1.6.6/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://sf.net/pupnp/libupnp-(\d.*)\.(?:tar.bz2|tar.gz|tar|tgz) --- libupnp-1.6.6.orig/debian/libupnp3.symbols +++ libupnp-1.6.6/debian/libupnp3.symbols @@ -0,0 +1,243 @@ +libixml.so.2 libupnp3 #MINVER# + ixmlAttr_free@Base 1.4.3 + ixmlAttr_init@Base 1.4.3 + ixmlCDATASection_free@Base 1.4.3 + ixmlCDATASection_init@Base 1.4.3 + ixmlCloneDOMString@Base 1.4.3 + ixmlDocument_createAttribute@Base 1.4.3 + ixmlDocument_createAttributeEx@Base 1.4.3 + ixmlDocument_createAttributeNS@Base 1.4.3 + ixmlDocument_createAttributeNSEx@Base 1.4.3 + ixmlDocument_createCDATASection@Base 1.4.3 + ixmlDocument_createCDATASectionEx@Base 1.4.3 + ixmlDocument_createDocument@Base 1.4.3 + ixmlDocument_createDocumentEx@Base 1.4.3 + ixmlDocument_createElement@Base 1.4.3 + ixmlDocument_createElementEx@Base 1.4.3 + ixmlDocument_createElementNS@Base 1.4.3 + ixmlDocument_createElementNSEx@Base 1.4.3 + ixmlDocument_createTextNode@Base 1.4.3 + ixmlDocument_createTextNodeEx@Base 1.4.3 + ixmlDocument_free@Base 1.4.3 + ixmlDocument_getElementById@Base 1.4.3 + ixmlDocument_getElementsByTagName@Base 1.4.3 + ixmlDocument_getElementsByTagNameNS@Base 1.4.3 + ixmlDocument_importNode@Base 1.4.3 + ixmlDocument_init@Base 1.4.3 + ixmlDocument_setOwnerDocument@Base 1.4.3 + ixmlDocumenttoString@Base 1.4.3 + ixmlDomTreetoString@Base 1.4.3 + ixmlElement_findAttributeNode@Base 1.4.3 + ixmlElement_free@Base 1.4.3 + ixmlElement_getAttribute@Base 1.4.3 + ixmlElement_getAttributeNS@Base 1.4.3 + ixmlElement_getAttributeNode@Base 1.4.3 + ixmlElement_getAttributeNodeNS@Base 1.4.3 + ixmlElement_getElementsByTagName@Base 1.4.3 + ixmlElement_getElementsByTagNameNS@Base 1.4.3 + ixmlElement_getTagName@Base 1.4.3 + ixmlElement_hasAttribute@Base 1.4.3 + ixmlElement_hasAttributeNS@Base 1.4.3 + ixmlElement_init@Base 1.4.3 + ixmlElement_removeAttribute@Base 1.4.3 + ixmlElement_removeAttributeNS@Base 1.4.3 + ixmlElement_removeAttributeNode@Base 1.4.3 + ixmlElement_setAttribute@Base 1.4.3 + ixmlElement_setAttributeNS@Base 1.4.3 + ixmlElement_setAttributeNode@Base 1.4.3 + ixmlElement_setAttributeNodeNS@Base 1.4.3 + ixmlElement_setTagName@Base 1.4.3 + ixmlFreeDOMString@Base 1.4.3 + ixmlLoadDocument@Base 1.4.3 + ixmlLoadDocumentEx@Base 1.4.3 + ixmlNamedNodeMap_addToNamedNodeMap@Base 1.4.3 + ixmlNamedNodeMap_free@Base 1.4.3 + ixmlNamedNodeMap_getItemNumber@Base 1.4.3 + ixmlNamedNodeMap_getLength@Base 1.4.3 + ixmlNamedNodeMap_getNamedItem@Base 1.4.3 + ixmlNamedNodeMap_init@Base 1.4.3 + ixmlNamedNodeMap_item@Base 1.4.3 + ixmlNodeList_addToNodeList@Base 1.4.3 + ixmlNodeList_free@Base 1.4.3 + ixmlNodeList_init@Base 1.4.3 + ixmlNodeList_item@Base 1.4.3 + ixmlNodeList_length@Base 1.4.3 + ixmlNode_allowChildren@Base 1.4.3 + ixmlNode_appendChild@Base 1.4.3 + ixmlNode_cloneAttr@Base 1.4.3 + ixmlNode_cloneAttrDirect@Base 1.4.3 + ixmlNode_cloneCDATASect@Base 1.4.3 + ixmlNode_cloneDoc@Base 1.4.3 + ixmlNode_cloneElement@Base 1.4.3 + ixmlNode_cloneNode@Base 1.4.3 + ixmlNode_cloneNodeTree@Base 1.4.3 + ixmlNode_cloneNodeTreeRecursive@Base 1.4.3 + ixmlNode_cloneTextNode@Base 1.4.3 + ixmlNode_compare@Base 1.4.3 + ixmlNode_free@Base 1.4.3 + ixmlNode_freeSingleNode@Base 1.4.3 + ixmlNode_getAttributes@Base 1.4.3 + ixmlNode_getChildNodes@Base 1.4.3 + ixmlNode_getElementsByTagName@Base 1.4.3 + ixmlNode_getElementsByTagNameNS@Base 1.4.3 + ixmlNode_getElementsByTagNameNSRecursive@Base 1.4.3 + ixmlNode_getElementsByTagNameRecursive@Base 1.4.3 + ixmlNode_getFirstChild@Base 1.4.3 + ixmlNode_getLastChild@Base 1.4.3 + ixmlNode_getLocalName@Base 1.4.3 + ixmlNode_getNamespaceURI@Base 1.4.3 + ixmlNode_getNextSibling@Base 1.4.3 + ixmlNode_getNodeName@Base 1.4.3 + ixmlNode_getNodeType@Base 1.4.3 + ixmlNode_getNodeValue@Base 1.4.3 + ixmlNode_getOwnerDocument@Base 1.4.3 + ixmlNode_getParentNode@Base 1.4.3 + ixmlNode_getPrefix@Base 1.4.3 + ixmlNode_getPreviousSibling@Base 1.4.3 + ixmlNode_hasAttributes@Base 1.4.3 + ixmlNode_hasChildNodes@Base 1.4.3 + ixmlNode_init@Base 1.4.3 + ixmlNode_insertBefore@Base 1.4.3 + ixmlNode_isAncestor@Base 1.4.3 + ixmlNode_isParent@Base 1.4.3 + ixmlNode_removeChild@Base 1.4.3 + ixmlNode_replaceChild@Base 1.4.3 + ixmlNode_setLocalName@Base 1.4.3 + ixmlNode_setNamespaceURI@Base 1.4.3 + ixmlNode_setNodeName@Base 1.4.3 + ixmlNode_setNodeProperties@Base 1.4.3 + ixmlNode_setNodeValue@Base 1.4.3 + ixmlNode_setPrefix@Base 1.4.3 + ixmlNode_setSiblingNodesParent@Base 1.4.3 + ixmlNodetoString@Base 1.4.3 + ixmlParseBuffer@Base 1.4.3 + ixmlParseBufferEx@Base 1.4.3 + ixmlPrintDocument@Base 1.4.3 + ixmlPrintDomTree@Base 1.4.3 + ixmlPrintDomTreeRecursive@Base 1.4.3 + ixmlPrintNode@Base 1.4.3 + ixmlRelaxParser@Base 1.4.3 + ixml_membuf_append@Base 1.4.3 + ixml_membuf_append_str@Base 1.4.3 + ixml_membuf_assign@Base 1.4.3 + ixml_membuf_assign_str@Base 1.4.3 + ixml_membuf_destroy@Base 1.4.3 + ixml_membuf_init@Base 1.4.3 + ixml_membuf_insert@Base 1.4.3 +libthreadutil.so.2 libupnp3 #MINVER# + FreeListAlloc@Base 1.4.3 + FreeListDestroy@Base 1.4.3 + FreeListFree@Base 1.4.3 + FreeListInit@Base 1.4.3 + ListAddAfter@Base 1.4.3 + ListAddBefore@Base 1.4.3 + ListAddHead@Base 1.4.3 + ListAddTail@Base 1.4.3 + ListDelNode@Base 1.4.3 + ListDestroy@Base 1.4.3 + ListFind@Base 1.4.3 + ListHead@Base 1.4.3 + ListInit@Base 1.4.3 + ListNext@Base 1.4.3 + ListPrev@Base 1.4.3 + ListSize@Base 1.4.3 + ListTail@Base 1.4.3 + TPAttrInit@Base 1.4.3 + TPAttrSetIdleTime@Base 1.4.3 + TPAttrSetJobsPerThread@Base 1.4.3 + TPAttrSetMaxJobsTotal@Base 1.4.3 + TPAttrSetMaxThreads@Base 1.4.3 + TPAttrSetMinThreads@Base 1.4.3 + TPAttrSetSchedPolicy@Base 1.4.3 + TPAttrSetStarvationTime@Base 1.4.3 + TPJobInit@Base 1.4.3 + TPJobSetFreeFunction@Base 1.4.3 + TPJobSetPriority@Base 1.4.3 + ThreadPoolAdd@Base 1.4.3 + ThreadPoolAddPersistent@Base 1.4.3 + ThreadPoolGetAttr@Base 1.4.3 + ThreadPoolGetStats@Base 1.4.3 + ThreadPoolInit@Base 1.4.3 + ThreadPoolPrintStats@Base 1.4.3 + ThreadPoolRemove@Base 1.4.3 + ThreadPoolSetAttr@Base 1.4.3 + ThreadPoolShutdown@Base 1.4.3 + TimerThreadInit@Base 1.4.3 + TimerThreadRemove@Base 1.4.3 + TimerThreadSchedule@Base 1.4.3 + TimerThreadShutdown@Base 1.4.3 +#MISSING: 1.6.5# iasnprintf@Base 1.4.3 +#MISSING: 1.6.5# iasnprintfFree@Base 1.4.3 +libupnp.so.3 libupnp3 #MINVER# + UpnpAcceptSubscription@Base 1.4.3 + UpnpAcceptSubscriptionExt@Base 1.4.3 + UpnpAddToAction@Base 1.4.3 + UpnpAddToActionResponse@Base 1.4.3 + UpnpAddToPropertySet@Base 1.4.3 + UpnpAddVirtualDir@Base 1.4.3 + UpnpCancelHttpGet@Base 1.4.3 + UpnpCloseHttpGet@Base 1.4.3 + UpnpCloseHttpPost@Base 1.4.3 + UpnpCloseLog@Base 1:1.6.6 + UpnpCreatePropertySet@Base 1.4.3 + UpnpDisplayFileAndLine@Base 1:1.6.6 + UpnpDownloadUrlItem@Base 1.4.3 + UpnpDownloadXmlDoc@Base 1.4.3 + UpnpEnableWebserver@Base 1.4.3 + UpnpFinish@Base 1.4.3 + UpnpFree@Base 1.4.3 +#MISSING: 1:1.6.6# UpnpFreeActionCompleteEvent@Base 1.6.5 +#MISSING: 1:1.6.6# UpnpFreeSubscribeEvent@Base 1.6.5 + UpnpGetDebugFile@Base 1:1.6.6 + UpnpGetErrorMessage@Base 1.4.3 + UpnpGetServerIpAddress@Base 1.4.3 + UpnpGetServerPort@Base 1.4.3 + UpnpGetServiceVarStatus@Base 1.4.3 + UpnpGetServiceVarStatusAsync@Base 1.4.3 + UpnpHttpGetProgress@Base 1.4.3 + UpnpInit@Base 1.4.3 + UpnpInitLog@Base 1:1.6.6 + UpnpIsWebserverEnabled@Base 1.4.3 + UpnpMakeAction@Base 1.4.3 + UpnpMakeActionResponse@Base 1.4.3 + UpnpNotify@Base 1.4.3 + UpnpNotifyExt@Base 1.4.3 + UpnpOpenHttpGet@Base 1.4.3 + UpnpOpenHttpGetEx@Base 1.4.3 + UpnpOpenHttpGetProxy@Base 1.4.3 + UpnpOpenHttpPost@Base 1.4.3 + UpnpPrintf@Base 1:1.6.6 + UpnpReadHttpGet@Base 1.4.3 + UpnpRegisterClient@Base 1.4.3 + UpnpRegisterRootDevice2@Base 1.4.3 + UpnpRegisterRootDevice@Base 1.4.3 + UpnpRemoveAllVirtualDirs@Base 1.4.3 + UpnpRemoveVirtualDir@Base 1.4.3 + UpnpRenewSubscription@Base 1.4.3 + UpnpRenewSubscriptionAsync@Base 1.4.3 + UpnpResolveURL@Base 1.4.3 + UpnpSdkClientRegistered@Base 1.4.3 + UpnpSdkDeviceRegistered@Base 1.4.3 + UpnpSdkInit@Base 1.4.3 + UpnpSearchAsync@Base 1.4.3 + UpnpSendAction@Base 1.4.3 + UpnpSendActionAsync@Base 1.4.3 + UpnpSendActionEx@Base 1.4.3 + UpnpSendActionExAsync@Base 1.4.3 + UpnpSendAdvertisement@Base 1.4.3 + UpnpSetContentLength@Base 1.4.3 + UpnpSetLogFileNames@Base 1:1.6.6 + UpnpSetLogLevel@Base 1:1.6.6 + UpnpSetMaxContentLength@Base 1.4.3 + UpnpSetMaxSubscriptionTimeOut@Base 1.4.3 + UpnpSetMaxSubscriptions@Base 1.4.3 + UpnpSetVirtualDirCallbacks@Base 1.4.3 + UpnpSetWebServerRootDir@Base 1.4.3 + UpnpSubscribe@Base 1.4.3 + UpnpSubscribeAsync@Base 1.4.3 + UpnpThreadDistribution@Base 1.4.3 + UpnpUnRegisterClient@Base 1.4.3 + UpnpUnRegisterRootDevice@Base 1.4.3 + UpnpUnSubscribe@Base 1.4.3 + UpnpUnSubscribeAsync@Base 1.4.3 + UpnpWriteHttpPost@Base 1.4.3 --- libupnp-1.6.6.orig/debian/libupnp3-dev.doc-base +++ libupnp-1.6.6/debian/libupnp3-dev.doc-base @@ -0,0 +1,14 @@ +Document: libupnp +Title: Libupnp: Portable SDK for UPnP Devices, version 1.6 +Abstract: The Portable SDK for UPnP Devices (libupnp) provides developers + with an API and open source code for building control points, devices, + and bridges that are compliant with Version 1.0 of the Universal Plug + and Play Device Architecture Specification. +Section: Programming + +Format: HTML +Index: /usr/share/doc/libupnp3-dev/html +Files: /usr/share/doc/libupnp3-dev/html/* + +Format: PDF +Files: /usr/share/doc/libupnp3-dev/*.pdf --- libupnp-1.6.6.orig/debian/control +++ libupnp-1.6.6/debian/control @@ -0,0 +1,73 @@ +Source: libupnp +Section: net +Priority: extra +Homepage: http://pupnp.sourceforge.net/ +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Nick Leverton +Build-Depends: debhelper (>= 7.0.50), quilt (>= 0.46-8~), + autotools-dev (>= 20100122.1~), autoconf, automake, libtool +Standards-Version: 3.8.4 + +Package: libupnp3 +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, ${misc:Depends} +Conflicts: libupnp0, libupnp2, libupnp4 (<< 1.8.0~svn20090313) +Replaces: libupnp0, libupnp2 +Description: Portable SDK for UPnP Devices, version 1.6 (shared libraries) + The Portable SDK for UPnP Devices (libupnp) provides developers with an + API and open source code for building control points, devices, and + bridges that are compliant with Version 1.0 of the Universal Plug and + Play Device Architecture Specification - see http://www.upnp.org/ for + specifications. + . + The libupnp3 package contains the runtime libraries for uPnP. + +Package: libupnp3-dev +Architecture: any +Section: libdevel +Depends: libupnp3 (= ${binary:Version}), ${misc:Depends} +Conflicts: libupnp4-dev +Description: Portable SDK for UPnP Devices, version 1.6 (development files) + The Portable SDK for UPnP Devices (libupnp) provides developers with an + API and open source code for building control points, devices, and + bridges that are compliant with Version 1.0 of the Universal Plug and + Play Device Architecture Specification - see http://www.upnp.org/ for + specifications. + . + The libupnp-dev package contains the header files, documentation and + debug versions of libraries needed for development of programs using + uPnP. + +Package: libupnp-dev +Architecture: any +Section: libdevel +Depends: libupnp3-dev (= ${binary:Version}), ${misc:Depends} +Description: Portable SDK for UPnP Devices (development files) + The Portable SDK for UPnP Devices (libupnp) provides developers with an + API and open source code for building control points, devices, and + bridges that are compliant with Version 1.0 of the Universal Plug and + Play Device Architecture Specification - see http://www.upnp.org/ for + specifications. + . + The libupnp-dev package is a metapackage which will depend on the + current stable development package. + +Package: libupnp3-dbg +Architecture: any +Section: debug +Depends: libupnp3 (= ${binary:Version}), ${misc:Depends} +Conflicts: libupnp4-dbg (<< 1.8.0~svn20090313) +Description: debugging symbols for libupnp3 + The Portable SDK for UPnP Devices (libupnp) provides developers with an + API and open source code for building control points, devices, and + bridges that are compliant with Version 1.0 of the Universal Plug and + Play Device Architecture Specification - see http://www.upnp.org/ for + specifications. + . + This package contains the debugging symbols associated with libupnp3. + They will automatically be used by gdb for debugging libupnp-related + issues. + . + Most people will not need this package. + --- libupnp-1.6.6.orig/debian/changelog +++ libupnp-1.6.6/debian/changelog @@ -0,0 +1,157 @@ +libupnp (1:1.6.6-5.1ubuntu0.11.10.1) oneiric-security; urgency=low + + * SECURITY UPDATE: patch from Debian + - debian/patches/0001-Security-fix-for-CERT-issue-VU-922681: fix various + stack-based buffer overflows in service_unique_name() function + - CVE-2012-5958 + - CVE-2012-5959 + - CVE-2012-5960 + - CVE-2012-5961 + - CVE-2012-5962 + - CVE-2012-5963 + - CVE-2012-5964 + + -- Jamie Strandboge Wed, 13 Feb 2013 15:05:15 -0600 + +libupnp (1:1.6.6-5.1) unstable; urgency=low + + * Non-maintainer upload. + * Don't ship .la files (Closes: #622520). + + -- Luk Claes Sat, 25 Jun 2011 20:01:57 +0200 + +libupnp (1:1.6.6-5) unstable; urgency=low + + * Fixes to BSD build issues (Closes: #573319, FTBFS on Gnu/kFreeBSD) + * We no longer Build-Depend on dbs anyway (Closes: #576068) + * More debug tidying (07-neaten-debug.patch): + - send UPNP_CRITICAL msgs to the info log as well as to the error log. + - don't print HTTP headers to stdout as they're already in logfile. + * Always compile in logging code but don't log unless requested + (12-debian-always-debug.patch) to help porting other apps. + * Cherry-pick some upstream bug fixes: + - soap_request_and_response http_request parameter error from r486 + - "reuseaddr" patch from issue 2995758 backported from r548 + - threadpool hang when busy from r515 + - memory leak in SSDP AdvertiseAndReply from issue 2392304, r518 + * Add $PTHREAD_CFLAGS to libupnp.pc as assumed by {acx,ax}_pthread.m4 + (patch 16, Closes: #555386). + + -- Nick Leverton Fri, 14 May 2010 15:47:17 +0100 + +libupnp (1:1.6.6-4) unstable; urgency=low + + * New patch 03-fix-duplicate-entries: fix FTBFS by removing duplicates + from file list; patch by Stefan Potyra (Closes: #572859) + * Update Sections (Closes: #519926) and general Policy to 3.8.4 + * Use debhelper 7 dh instead of dbs + * Generate and update symbols file + * Allow to co-exist with latest libupnp4. + * Patch 06-patch-statevar-query.patch adapted from upstream 1.8 branch + to fix format of State Variable Query response. + * Fix sending of incorrect timeout on auto renew (patch 10). + + -- Nick Leverton Mon, 08 Mar 2010 18:23:14 +0000 + +libupnp (1:1.6.6-3) unstable; urgency=high + + [ Dmitry E. Oboukhov ] + * Added libupnp-dev with depends to libupnp3-dev, + really closes: #490339, #490533. + + [ Nick Leverton ] + * Include GNU/kfreeBSD build patch (Closes: #491173) + + -- Nick Leverton Mon, 21 Jul 2008 20:57:42 +0100 + +libupnp (1:1.6.6-2) unstable; urgency=low + + * Bump epoch and add Conflicts with libupnp4, to displace incorrect + upload of libupnp4 which displaced this package. Closes: #490339 + * Fix the erroneous bug 426833 reference in old changelog, don't just + document that it was wrong. Closes: #490536 + * Standards-Version bumped to 3.8.0, compat bumped to 7. + + -- Nick Leverton Sun, 13 Jul 2008 10:39:17 +0100 + +libupnp (1.6.6-1) unstable; urgency=low + + * New upstream release + * Remove patch 03-upstream-upnp-rootdevice.patch, now in upstream. + * Remove buggy patch 02-debian-fixed-length-buffer-for-urls.patch + (Closes: #482737, reopens #353169). libupnp4 will include upstream's + wider changes for ridding the library of fixed-length static buffers. + * Update watchfile again for better uscan pattern matching + * Build -dbg symbol package anyway; allow pupnp "--enable-debug" via + DEB_BUILD_OPTIONS="debug" + * Update copyright file to reflect all contributors. + * Tidy up build to use dh_install. + + -- Nick Leverton Thu, 19 Jun 2008 18:27:11 +0100 + +libupnp (1.6.5-2) unstable; urgency=low + + * Correct New Maintainer bug number (was given as #426833, should + be #462833) (really Closes: #462833). + * Replace RSA Inc copyright MD5 functions by public domain + implementation (Closes: #459516). + * Remove Build-dep on doc++ as upstream now ships documentation in + tarball (Closes: #307562). + * Dynamically allocated buffer for uPnP Action urls (Closes: #353169). + * Update Description to match current fork of upstream. + * Fix watchfile to omit libupnp-doc tarballs. + * No longer ignore "upnp:rootdevice" advertisement, upstream svn r326 + (03-upstream-upnp-rootdevice.patch). + + -- Nick Leverton Mon, 21 Apr 2008 22:20:53 +0100 + +libupnp (1.6.5-1) unstable; urgency=low + + * New upstream release (Closes: #426388, #439373) + * New maintainer (Closes: #462833) + * Upstream soname changed, bump package to libupnp3 + * Make libupnp-dev depend on matching version of libupnp3 + + -- Nick Leverton Sun, 24 Feb 2008 10:29:48 +0000 + +libupnp (1.4.3-2) unstable; urgency=low + + * Make libupnp-dev depend on libupnp2. + + -- Steve McIntyre <93sam@debian.org> Sat, 28 Apr 2007 16:58:23 +0100 + +libupnp (1.4.3-1) unstable; urgency=low + + * New upstream release from pupnp fork (Closes: #392783, #400903, #320949). + * Do not claim libupnp-dev contains debugging symbols (Closes: #350115). + * Update to Standards-Version 3.7.2. + * Remove unnecessary ${shlibs:Depends} from libupnp-dev's Depends field. + * Thanks to Jeremy Laine for help on this release. + * Two kFreeBSD build failures reported should now be fixed. + Closes: #416254. Please open more bugs if there are any more failures. + + -- Steve McIntyre <93sam@debian.org> Sat, 31 Mar 2007 16:03:29 +0200 + +libupnp (1.2.1-3) unstable; urgency=low + + * Fix multiple compiler warnings fixes with gcc4. Thanks to Oskar + Liljeblad for a patch. Closes: #320949 + * Include debug versions of the libraries in the -dev package. + Closes: #350115 + * Updated Standards-version. + + -- Steve McIntyre <93sam@debian.org> Sun, 12 Feb 2006 20:55:35 +0000 + +libupnp (1.2.1-2) unstable; urgency=low + + * Fix FTBFS with gcc4. Thanks to Andreas Jochens for the patch. + Closes: #301775 + + -- Steve McIntyre <93sam@debian.org> Sun, 17 Jul 2005 20:23:44 +0300 + +libupnp (1.2.1-1) unstable; urgency=low + + * Initial version + + -- Steve McIntyre <93sam@debian.org> Tue, 18 Jan 2005 19:42:08 +0000 + --- libupnp-1.6.6.orig/debian/libupnp3.install +++ libupnp-1.6.6/debian/libupnp3.install @@ -0,0 +1 @@ +usr/lib/*.so.* --- libupnp-1.6.6.orig/debian/rules +++ libupnp-1.6.6/debian/rules @@ -0,0 +1,24 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh --with quilt,autotools-dev $@ + +override_dh_auto_configure: + autoreconf -f -i + dh_auto_configure -- --with-documentation=/usr/share/doc/libupnp3-dev --disable-samples --enable-debug + +override_dh_auto_clean: + dh_auto_clean + find -name "Makefile.in" -print0 | xargs -0r $(RM) + $(RM) tags # just in case + $(RM) aclocal.m4 configure autoconfig.h.in + +override_dh_strip: + dh_strip --dbg-package=libupnp3-dbg + +override_dh_compress: + dh_compress -Xhtml -X.pdf + --- libupnp-1.6.6.orig/debian/copyright +++ libupnp-1.6.6/debian/copyright @@ -0,0 +1,156 @@ +Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135 + +Name: pupnp +Source: http://pupnp.sourceforge.net/ +Maintainer: Marcelo Roberto Jimenez + +X-Copyright-History: + This is the Debian GNU/Linux packaged version of pupnp, the Portable SDK + for UPnP Devices, which is a fork of Intel's Linux SDK for UPnP Devices. + + +Copyright: 2000-2003 Intel Corporation - All Rights Reserved. + 2005-2006 Rémi Turboult + 2006 Michel Pfeiffer and others + 2006 Alexander Chemeris + 2007-2010 Marcelo Roberto Jimenez +Licence: BSD + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + - Neither name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + On Debian systems, the complete text of the BSD-license + can be found in `/usr/share/common-licenses/BSD'. + + +Files: debian/* +Copyright: 2005-2007 Steve McIntyre <93sam@debian.org> + 2008-2010 Nick Leverton +Licence: BSD + + +Files: upnp/src/*/sysdep.*, upnp/src/*/uuid.* +Copyright: 1990- 1993, 1996 Open Software Foundation, Inc. + 1989 by Hewlett-Packard Company, Palo Alto, Ca. & + Digital Equipment Corporation, Maynard, Mass. + 1998 Microsoft. +Licence: + To anyone who acknowledges that this file is provided "AS IS" + without any express or implied warranty: permission to use, copy, + modify, and distribute this file for any purpose is hereby + granted without fee, provided that the above copyright notices and + this notice appears in all source code copies, and that none of + the names of Open Software Foundation, Inc., Hewlett-Packard + Company, or Digital Equipment Corporation be used in advertising + or publicity pertaining to distribution of the software without + specific, written prior permission. Neither Open Software + Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital Equipment + Corporation makes any representations about the suitability of + this software for any purpose. + + +Files: ixml/test/testdata/xml.ascc.net/* +Copyright: 1998 Academia Sinica, http://xml.ascc.net/ +Licence: + Unless otherwise stated, permission is granted to use, copy, link to, + translate and republish in any form, including for commercial use, + providing due acknowledgement of the copyright holder and the Chinese + XML Now! website is made. + + +Files: */doc/docxx.sty +Copyright: 1996 Roland Wunderling, Malte Zoeckler + 1999-2001 Dragos Acostachioaie +Licence: GPL-2+ + +Files: m4/ax_cflags*.m4 +Copyright: 2006 Guido U. Draheim +Licence: GPL-2+ with Autoconf exception + +Files: m4/acx_pthread.m4 +Copyright: 2006 Steven G. Johnson +Licence: GPL-2+ with Autoconf exception + +Files: m4/type_socklen_t.m4 +Copyright: 2005 Lars Brinkhoff +Licence: GPL-2+ with Autoconf exception + +Licence: GPL-2+ + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + On Debian systems, the complete text of the GNU General + Public License can be found in `/usr/share/common-licenses/GPL-2'. + +Licence: Autoconf exception + As a special exception, the respective Autoconf Macro's copyright + owner gives unlimited permission to copy, distribute and modify the + configure scripts that are the output of Autoconf when processing + the Macro. You need not follow the terms of the GNU General Public + License when using or distributing such scripts, even though + portions of the text of the Macro appear in them. The GNU General + Public License (GPL) does govern all other use of the material that + constitutes the Autoconf Macro. + + This special exception to the GPL applies to versions of the + Autoconf Macro released by the Autoconf Macro Archive. When you + make and distribute a modified version of the Autoconf Macro, you + may extend this special exception to the GPL to apply to your + modified version as well. + + +Files: upnp/src/uuid/md5.c, upnp/src/inc/md5.h: +Copyright: 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. +Licence: + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD5 Message-Digest + Algorithm" in all material mentioning or referencing this software + or this function. + + +Files: upnp/src/inet_pton.c +Copyright: 1996-1999 by Internet Software Consortium. +Licence: + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. --- libupnp-1.6.6.orig/debian/libupnp3-dev.dirs +++ libupnp-1.6.6/debian/libupnp3-dev.dirs @@ -0,0 +1,2 @@ +usr/lib +usr/include/upnp --- libupnp-1.6.6.orig/debian/libupnp3.dirs +++ libupnp-1.6.6/debian/libupnp3.dirs @@ -0,0 +1 @@ +usr/lib --- libupnp-1.6.6.orig/debian/source/format +++ libupnp-1.6.6/debian/source/format @@ -0,0 +1 @@ +1.0 --- libupnp-1.6.6.orig/debian/patches/libupnp-1.6.6-r466.patch +++ libupnp-1.6.6/debian/patches/libupnp-1.6.6-r466.patch @@ -0,0 +1,93 @@ +Description: UpnpCreatePropertySet can leak memory if no additional arguments are passed. +Bug: https://sourceforge.net/support/tracker.php?aid=1942285 +Author: Bob Ciora - bobciora + +=== upnp/src/api/upnptools.c +================================================================== +Index: libupnp-1.6.6-5/upnp/src/api/upnptools.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/api/upnptools.c 2010-05-14 16:28:17.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/api/upnptools.c 2010-05-14 16:28:50.000000000 +0100 +@@ -1,36 +1,41 @@ +-/////////////////////////////////////////////////////////////////////////// +-// +-// Copyright (c) 2000-2003 Intel Corporation +-// All rights reserved. +-// +-// Redistribution and use in source and binary forms, with or without +-// modification, are permitted provided that the following conditions are met: +-// +-// * Redistributions of source code must retain the above copyright notice, +-// this list of conditions and the following disclaimer. +-// * Redistributions in binary form must reproduce the above copyright notice, +-// this list of conditions and the following disclaimer in the documentation +-// and/or other materials provided with the distribution. +-// * Neither name of Intel Corporation nor the names of its contributors +-// may be used to endorse or promote products derived from this software +-// without specific prior written permission. +-// +-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR +-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +-// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-// +-/////////////////////////////////////////////////////////////////////////// ++/******************************************************************************* ++ * ++ * Copyright (c) 2000-2003 Intel Corporation ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * ++ * * Redistributions of source code must retain the above copyright notice, ++ * this list of conditions and the following disclaimer. ++ * * Redistributions in binary form must reproduce the above copyright notice, ++ * this list of conditions and the following disclaimer in the documentation ++ * and/or other materials provided with the distribution. ++ * * Neither name of Intel Corporation nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ++ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY ++ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ * ++ ******************************************************************************/ ++ + + #include "config.h" ++ ++ + #if EXCLUDE_DOM == 0 ++ ++ + #include + #include "upnptools.h" + #include "uri.h" +@@ -550,8 +555,8 @@ + return NULL; + } + +- if( NumArg < 1 ) { +- return NULL; ++ if (NumArg < 1) { ++ return PropSet; + } + + va_start( ArgList, Arg ); --- libupnp-1.6.6.orig/debian/patches/03-fix-duplicate-entries +++ libupnp-1.6.6/debian/patches/03-fix-duplicate-entries @@ -0,0 +1,20 @@ +Description: Fix FTBFS due to duplicate files in file list +Bug-Debian: http://bugs.debian.org/572859 +Author: Stefan Potyra + +Index: libupnp-1.6.6-5/upnp/sample/Makefile.am +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/sample/Makefile.am 2010-05-14 16:28:20.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/sample/Makefile.am 2010-05-14 16:28:37.000000000 +0100 +@@ -69,8 +69,9 @@ + if WITH_DOCUMENTATION + examplesdir = $(docdir)/examples + examples_DATA = \ +- $(upnp_tv_ctrlpt_SOURCES) \ +- $(upnp_tv_device_SOURCES) ++ $(sort \ ++ $(upnp_tv_ctrlpt_SOURCES) \ ++ $(upnp_tv_device_SOURCES)) + endif + + --- libupnp-1.6.6.orig/debian/patches/01-debian-md5-licence.patch +++ libupnp-1.6.6/debian/patches/01-debian-md5-licence.patch @@ -0,0 +1,693 @@ +Description: Replace RSA Inc copyright MD5 functions by public domain implementation. +Bug-Debian: http://bugs.debian.org/459516 + +Index: libupnp-1.6.6-5/configure.ac +=================================================================== +--- libupnp-1.6.6-5.orig/configure.ac 2010-05-14 16:28:21.000000000 +0100 ++++ libupnp-1.6.6-5/configure.ac 2010-05-14 16:28:37.000000000 +0100 +@@ -355,6 +355,9 @@ + # Checks for typedefs, structures, and compiler characteristics + # + AC_C_CONST ++AC_C_BIGENDIAN ++AC_CHECK_SIZEOF(unsigned int) ++AC_CHECK_SIZEOF(unsigned long) + TYPE_SOCKLEN_T + + +Index: libupnp-1.6.6-5/upnp/src/inc/md5.h +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/inc/md5.h 2010-05-14 16:28:21.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/inc/md5.h 2010-05-14 16:28:37.000000000 +0100 +@@ -1,39 +1,47 @@ +-/* MD5.H - header file for MD5C.C */ +- +- +-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +- rights reserved. +- +- License to copy and use this software is granted provided that it +- is identified as the "RSA Data Security, Inc. MD5 Message-Digest +- Algorithm" in all material mentioning or referencing this software +- or this function. +- +- License is also granted to make and use derivative works provided +- that such works are identified as "derived from the RSA Data +- Security, Inc. MD5 Message-Digest Algorithm" in all material +- mentioning or referencing the derived work. +- +- RSA Data Security, Inc. makes no representations concerning either +- the merchantability of this software or the suitability of this +- software for any particular purpose. It is provided "as is" +- without express or implied warranty of any kind. +- +- These notices must be retained in any copies of any part of this +- documentation and/or software. ++/* ++ * This is the header file for the MD5 message-digest algorithm. ++ * The algorithm is due to Ron Rivest. This code was ++ * written by Colin Plumb in 1993, no copyright is claimed. ++ * This code is in the public domain; do with it what you wish. ++ * ++ * Equivalent code is available from RSA Data Security, Inc. ++ * This code has been tested against that, and is equivalent, ++ * except that you don't need to include two pages of legalese ++ * with every copy. ++ * ++ * To compute the message digest of a chunk of bytes, declare an ++ * MD5Context structure, pass it to MD5Init, call MD5Update as ++ * needed on buffers full of bytes, and then call MD5Final, which ++ * will fill a supplied 16-byte array with the digest. ++ * ++ * Changed so as no longer to depend on Colin Plumb's `usual.h' ++ * header definitions; now uses stuff from dpkg's config.h ++ * - Ian Jackson . ++ * Still in the public domain. + */ + ++#ifndef MD5_H ++#define MD5_H + +-/* MD5 context. */ +-typedef struct { ++#define md5byte unsigned char + +- UINT4 state[4]; /* state (ABCD) */ +- UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ +- unsigned char buffer[64]; /* input buffer */ +- +-} MD5_CTX; +- +-void MD5Init PROTO_LIST ((MD5_CTX *)); +-void MD5Update PROTO_LIST ((MD5_CTX *, unsigned char *, unsigned int)); +-void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); ++#if SIZEOF_UNSIGNED_LONG==4 ++# define UWORD32 unsigned long ++#elif SIZEOF_UNSIGNED_INT==4 ++# define UWORD32 unsigned int ++#else ++# error I do not know what to use for a UWORD32. ++#endif ++ ++struct MD5Context { ++ UWORD32 buf[4]; ++ UWORD32 bytes[2]; ++ UWORD32 in[16]; ++}; ++ ++void MD5Init(struct MD5Context *context); ++void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len); ++void MD5Final(unsigned char digest[16], struct MD5Context *context); ++void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]); + ++#endif /* !MD5_H */ +Index: libupnp-1.6.6-5/upnp/src/uuid/md5.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/uuid/md5.c 2010-05-14 16:28:21.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/uuid/md5.c 2010-05-14 16:28:37.000000000 +0100 +@@ -1,353 +1,241 @@ + /* +- MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm ++ * This code implements the MD5 message-digest algorithm. ++ * The algorithm is due to Ron Rivest. This code was ++ * written by Colin Plumb in 1993, no copyright is claimed. ++ * This code is in the public domain; do with it what you wish. ++ * ++ * Equivalent code is available from RSA Data Security, Inc. ++ * This code has been tested against that, and is equivalent, ++ * except that you don't need to include two pages of legalese ++ * with every copy. ++ * ++ * To compute the message digest of a chunk of bytes, declare an ++ * MD5Context structure, pass it to MD5Init, call MD5Update as ++ * needed on buffers full of bytes, and then call MD5Final, which ++ * will fill a supplied 16-byte array with the digest. ++ * ++ * Changed so as no longer to depend on Colin Plumb's `usual.h' header ++ * definitions; now uses stuff from dpkg's config.h. ++ * - Ian Jackson . ++ * Still in the public domain. + */ +- +-/* +- Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +- rights reserved. +- +- License to copy and use this software is granted provided that it +- is identified as the "RSA Data Security, Inc. MD5 Message-Digest +- Algorithm" in all material mentioning or referencing this software +- or this function. +- +- License is also granted to make and use derivative works provided +- that such works are identified as "derived from the RSA Data +- Security, Inc. MD5 Message-Digest Algorithm" in all material +- mentioning or referencing the derived work. +- +- RSA Data Security, Inc. makes no representations concerning either +- the merchantability of this software or the suitability of this +- software for any particular purpose. It is provided "as is" +- without express or implied warranty of any kind. +- +- These notices must be retained in any copies of any part of this +- documentation and/or software. +- +- */ +- + #include "config.h" +-#include "global.h" +-#include "md5.h" + +-/* +- Constants for MD5Transform routine. +- */ +-#define S11 7 +-#define S12 12 +-#define S13 17 +-#define S14 22 +-#define S21 5 +-#define S22 9 +-#define S23 14 +-#define S24 20 +-#define S31 4 +-#define S32 11 +-#define S33 16 +-#define S34 23 +-#define S41 6 +-#define S42 10 +-#define S43 15 +-#define S44 21 +- +-static void MD5Transform PROTO_LIST((UINT4[4], unsigned char[64])); +-static void Encode PROTO_LIST((unsigned char *, UINT4 *, unsigned int)); +-static void Decode PROTO_LIST((UINT4 *, unsigned char *, unsigned int)); +-static void MD5_memcpy PROTO_LIST((POINTER, POINTER, unsigned int)); +-static void MD5_memset PROTO_LIST((POINTER, int, unsigned int)); +- +-static unsigned char PADDING[64] = { +- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +-}; +- +-/* +- F, G, H and I are basic MD5 functions. +- */ +-#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +-#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +-#define H(x, y, z) ((x) ^ (y) ^ (z)) +-#define I(x, y, z) ((y) ^ ((x) | (~z))) +- +-/* +- ROTATE_LEFT rotates x left n bits. +- */ +-#define ROTATE_LEFT(x, n) (((x) <<(n)) | ((x) >> (32-(n)))) ++#include /* for memcpy() */ ++#include /* for stupid systems */ ++#include /* for ntohl() */ + +-/* +- FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. +- Rotation is separate from addition to prevent recomputation. +- */ +-#define FF(a, b, c, d, x, s, ac) { \ +- (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ +- (a) = ROTATE_LEFT ((a), (s)); \ +- (a) += (b); \ +- } +- +-#define GG(a, b, c, d, x, s, ac) { \ +- (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ +- (a) = ROTATE_LEFT ((a), (s)); \ +- (a) += (b); \ +- } +- +-#define HH(a, b, c, d, x, s, ac) { \ +- (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ +- (a) = ROTATE_LEFT ((a), (s)); \ +- (a) += (b); \ +- } +- +-#define II(a, b, c, d, x, s, ac) { \ +- (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ +- (a) = ROTATE_LEFT ((a), (s)); \ +- (a) += (b); \ +- } ++#include "md5.h" + +-/* +- MD5 initialization. Begins an MD5 operation, writing a new context. +- */ ++#ifdef WORDS_BIGENDIAN + void +-MD5Init(MD5_CTX * context) ++byteSwap(UWORD32 *buf, unsigned words) + { +- context->count[0] = context->count[1] = 0; +- /* Load magic initialization constants. */ +- context->state[0] = 0x67452301; +- context->state[1] = 0xefcdab89; +- context->state[2] = 0x98badcfe; +- context->state[3] = 0x10325476; ++ md5byte *p = (md5byte *)buf; ++ ++ do { ++ *buf++ = (UWORD32)((unsigned)p[3] << 8 | p[2]) << 16 | ++ ((unsigned)p[1] << 8 | p[0]); ++ p += 4; ++ } while (--words); + } ++#else ++#define byteSwap(buf,words) ++#endif + + /* +- MD5 block update operation. Continues an MD5 message-digest +- operation, processing another message block, and updating the +- context. ++ * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious ++ * initialization constants. + */ +- + void +-MD5Update(MD5_CTX *context, unsigned char *input, unsigned int inputLen) ++MD5Init(struct MD5Context *ctx) + { +- unsigned int i; +- unsigned int index; +- unsigned int partLen; +- +- /* Compute number of bytes mod 64 */ +- index = (unsigned int)((context->count[0] >> 3) & 0x3F); +- +- /* Update number of bits */ +- if ((context->count[0] += ((UINT4)inputLen << 3)) < ((UINT4)inputLen << 3)) { +- context->count[1]++; +- } +- context->count[1] += ((UINT4)inputLen >> 29); +- partLen = 64 - index; ++ ctx->buf[0] = 0x67452301; ++ ctx->buf[1] = 0xefcdab89; ++ ctx->buf[2] = 0x98badcfe; ++ ctx->buf[3] = 0x10325476; + +- /* Transform as many times as possible. */ +- if (inputLen >= partLen) { +- MD5_memcpy((POINTER)&context->buffer[index], (POINTER)input, partLen); +- MD5Transform(context->state, context->buffer); +- for (i = partLen; i + 63 < inputLen; i += 64) { +- MD5Transform(context->state, &input[i]); +- } +- index = 0; +- } else { +- i = 0; +- } +- +- /* Buffer remaining input */ +- MD5_memcpy((POINTER)&context->buffer[index], (POINTER)&input[i], inputLen - i); ++ ctx->bytes[0] = 0; ++ ctx->bytes[1] = 0; + } + + /* +- MD5 finalization. Ends an MD5 message-digest operation, writing the +- the message digest and zeroizing the context. ++ * Update context to reflect the concatenation of another buffer full ++ * of bytes. + */ + void +-MD5Final(unsigned char digest[16], MD5_CTX *context) ++MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len) + { +- unsigned char bits[8]; +- unsigned int index; +- unsigned int padLen; +- +- /* Save number of bits */ +- Encode(bits, context->count, 8); +- +- /* Pad out to 56 mod 64. */ +- index = (unsigned int)((context->count[0] >> 3) & 0x3f); +- padLen = (index < 56) ? (56 - index) : (120 - index); +- MD5Update(context, PADDING, padLen); ++ UWORD32 t; + +- /* Append length (before padding) */ +- MD5Update(context, bits, 8); ++ /* Update byte count */ + +- /* Store state in digest */ +- Encode(digest, context->state, 16); ++ t = ctx->bytes[0]; ++ if ((ctx->bytes[0] = t + len) < t) ++ ctx->bytes[1]++; /* Carry from low to high */ ++ ++ t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */ ++ if (t > len) { ++ memcpy((md5byte *)ctx->in + 64 - t, buf, len); ++ return; ++} ++ /* First chunk is an odd size */ ++ memcpy((md5byte *)ctx->in + 64 - t, buf, t); ++ byteSwap(ctx->in, 16); ++ MD5Transform(ctx->buf, ctx->in); ++ buf += t; ++ len -= t; ++ ++ /* Process data in 64-byte chunks */ ++ while (len >= 64) { ++ memcpy(ctx->in, buf, 64); ++ byteSwap(ctx->in, 16); ++ MD5Transform(ctx->buf, ctx->in); ++ buf += 64; ++ len -= 64; ++ } + +- /* Zeroize sensitive information. */ +- MD5_memset((POINTER)context, 0, sizeof(*context)); ++ /* Handle any remaining bytes of data. */ ++ memcpy(ctx->in, buf, len); + } + +-/* +- MD5 basic transformation. Transforms state based on block. +- */ +-static void +-MD5Transform(UINT4 state[4], unsigned char block[64]) +-{ +- UINT4 a = state[0], +- b = state[1], +- c = state[2], +- d = state[3], +- x[16]; +- +- Decode( x, block, 64 ); +- + /* +- Round 1 ++ * Final wrapup - pad to 64-byte boundary with the bit pattern ++ * 1 0* (64-bit count of bits processed, MSB-first) + */ +- FF( a, b, c, d, x[0], S11, 0xd76aa478 ); /* 1 */ +- FF( d, a, b, c, x[1], S12, 0xe8c7b756 ); /* 2 */ +- FF( c, d, a, b, x[2], S13, 0x242070db ); /* 3 */ +- FF( b, c, d, a, x[3], S14, 0xc1bdceee ); /* 4 */ +- FF( a, b, c, d, x[4], S11, 0xf57c0faf ); /* 5 */ +- FF( d, a, b, c, x[5], S12, 0x4787c62a ); /* 6 */ +- FF( c, d, a, b, x[6], S13, 0xa8304613 ); /* 7 */ +- FF( b, c, d, a, x[7], S14, 0xfd469501 ); /* 8 */ +- FF( a, b, c, d, x[8], S11, 0x698098d8 ); /* 9 */ +- FF( d, a, b, c, x[9], S12, 0x8b44f7af ); /* 10 */ +- FF( c, d, a, b, x[10], S13, 0xffff5bb1 ); /* 11 */ +- FF( b, c, d, a, x[11], S14, 0x895cd7be ); /* 12 */ +- FF( a, b, c, d, x[12], S11, 0x6b901122 ); /* 13 */ +- FF( d, a, b, c, x[13], S12, 0xfd987193 ); /* 14 */ +- FF( c, d, a, b, x[14], S13, 0xa679438e ); /* 15 */ +- FF( b, c, d, a, x[15], S14, 0x49b40821 ); /* 16 */ ++void ++MD5Final(md5byte digest[16], struct MD5Context *ctx) ++{ ++ int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */ ++ md5byte *p = (md5byte *)ctx->in + count; + +- /* +- Round 2 +- */ +- GG( a, b, c, d, x[1], S21, 0xf61e2562 ); /* 17 */ +- GG( d, a, b, c, x[6], S22, 0xc040b340 ); /* 18 */ +- GG( c, d, a, b, x[11], S23, 0x265e5a51 ); /* 19 */ +- GG( b, c, d, a, x[0], S24, 0xe9b6c7aa ); /* 20 */ +- GG( a, b, c, d, x[5], S21, 0xd62f105d ); /* 21 */ +- GG( d, a, b, c, x[10], S22, 0x2441453 ); /* 22 */ +- GG( c, d, a, b, x[15], S23, 0xd8a1e681 ); /* 23 */ +- GG( b, c, d, a, x[4], S24, 0xe7d3fbc8 ); /* 24 */ +- GG( a, b, c, d, x[9], S21, 0x21e1cde6 ); /* 25 */ +- GG( d, a, b, c, x[14], S22, 0xc33707d6 ); /* 26 */ +- GG( c, d, a, b, x[3], S23, 0xf4d50d87 ); /* 27 */ +- GG( b, c, d, a, x[8], S24, 0x455a14ed ); /* 28 */ +- GG( a, b, c, d, x[13], S21, 0xa9e3e905 ); /* 29 */ +- GG( d, a, b, c, x[2], S22, 0xfcefa3f8 ); /* 30 */ +- GG( c, d, a, b, x[7], S23, 0x676f02d9 ); /* 31 */ +- GG( b, c, d, a, x[12], S24, 0x8d2a4c8a ); /* 32 */ ++ /* Set the first char of padding to 0x80. There is always room. */ ++ *p++ = 0x80; + +- /* +- Round 3 +- */ +- HH( a, b, c, d, x[5], S31, 0xfffa3942 ); /* 33 */ +- HH( d, a, b, c, x[8], S32, 0x8771f681 ); /* 34 */ +- HH( c, d, a, b, x[11], S33, 0x6d9d6122 ); /* 35 */ +- HH( b, c, d, a, x[14], S34, 0xfde5380c ); /* 36 */ +- HH( a, b, c, d, x[1], S31, 0xa4beea44 ); /* 37 */ +- HH( d, a, b, c, x[4], S32, 0x4bdecfa9 ); /* 38 */ +- HH( c, d, a, b, x[7], S33, 0xf6bb4b60 ); /* 39 */ +- HH( b, c, d, a, x[10], S34, 0xbebfbc70 ); /* 40 */ +- HH( a, b, c, d, x[13], S31, 0x289b7ec6 ); /* 41 */ +- HH( d, a, b, c, x[0], S32, 0xeaa127fa ); /* 42 */ +- HH( c, d, a, b, x[3], S33, 0xd4ef3085 ); /* 43 */ +- HH( b, c, d, a, x[6], S34, 0x4881d05 ); /* 44 */ +- HH( a, b, c, d, x[9], S31, 0xd9d4d039 ); /* 45 */ +- HH( d, a, b, c, x[12], S32, 0xe6db99e5 ); /* 46 */ +- HH( c, d, a, b, x[15], S33, 0x1fa27cf8 ); /* 47 */ +- HH( b, c, d, a, x[2], S34, 0xc4ac5665 ); /* 48 */ ++ /* Bytes of padding needed to make 56 bytes (-8..55) */ ++ count = 56 - 1 - count; + +- /* +- Round 4 +- */ +- II( a, b, c, d, x[0], S41, 0xf4292244 ); /* 49 */ +- II( d, a, b, c, x[7], S42, 0x432aff97 ); /* 50 */ +- II( c, d, a, b, x[14], S43, 0xab9423a7 ); /* 51 */ +- II( b, c, d, a, x[5], S44, 0xfc93a039 ); /* 52 */ +- II( a, b, c, d, x[12], S41, 0x655b59c3 ); /* 53 */ +- II( d, a, b, c, x[3], S42, 0x8f0ccc92 ); /* 54 */ +- II( c, d, a, b, x[10], S43, 0xffeff47d ); /* 55 */ +- II( b, c, d, a, x[1], S44, 0x85845dd1 ); /* 56 */ +- II( a, b, c, d, x[8], S41, 0x6fa87e4f ); /* 57 */ +- II( d, a, b, c, x[15], S42, 0xfe2ce6e0 ); /* 58 */ +- II( c, d, a, b, x[6], S43, 0xa3014314 ); /* 59 */ +- II( b, c, d, a, x[13], S44, 0x4e0811a1 ); /* 60 */ +- II( a, b, c, d, x[4], S41, 0xf7537e82 ); /* 61 */ +- II( d, a, b, c, x[11], S42, 0xbd3af235 ); /* 62 */ +- II( c, d, a, b, x[2], S43, 0x2ad7d2bb ); /* 63 */ +- II( b, c, d, a, x[9], S44, 0xeb86d391 ); /* 64 */ +- +- state[0] += a; +- state[1] += b; +- state[2] += c; +- state[3] += d; ++ if (count < 0) { /* Padding forces an extra block */ ++ memset(p, 0, count + 8); ++ byteSwap(ctx->in, 16); ++ MD5Transform(ctx->buf, ctx->in); ++ p = (md5byte *)ctx->in; ++ count = 56; ++ } ++ memset(p, 0, count); ++ byteSwap(ctx->in, 14); + +- /* +- Zeroize sensitive information. +- */ +- MD5_memset( ( POINTER ) x, 0, sizeof( x ) ); ++ /* Append length in bits and transform */ ++ ctx->in[14] = ctx->bytes[0] << 3; ++ ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29; ++ MD5Transform(ctx->buf, ctx->in); + ++ byteSwap(ctx->buf, 4); ++ memcpy(digest, ctx->buf, 16); ++ memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + } + +-/* +- Encodes input (UINT4) into output (unsigned char). Assumes len is +- a multiple of 4. +- */ +-static void +-Encode(unsigned char *output, UINT4 *input, unsigned int len) +-{ +- unsigned int i; +- unsigned int j; +- for (i = 0, j = 0; j < len; ++i, j += 4) { +- output[j+0] = (unsigned char)((input[i] >> 0) & 0xff); +- output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); +- output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); +- output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); +- } +-} ++#ifndef ASM_MD5 + +-/* +- Decodes input (unsigned char) into output (UINT4). Assumes len is +- a multiple of 4. +- */ ++/* The four core functions - F1 is optimized somewhat */ + +-static void +-Decode(UINT4 *output, unsigned char *input, unsigned int len) +-{ +- unsigned int i; +- unsigned int j; +- for (i = 0, j = 0; j < len; ++i, j += 4) { +- output[i] = +- (((UINT4)input[j+0]) << 0) | +- (((UINT4)input[j+1]) << 8) | +- (((UINT4)input[j+2]) << 16) | +- (((UINT4)input[j+3]) << 24); +- } +-} ++/* #define F1(x, y, z) (x & y | ~x & z) */ ++#define F1(x, y, z) (z ^ (x & (y ^ z))) ++#define F2(x, y, z) F1(z, x, y) ++#define F3(x, y, z) (x ^ y ^ z) ++#define F4(x, y, z) (y ^ (x | ~z)) + +-/* +- Note: Replace for loop with standard memcpy if possible. +- */ +-static void +-MD5_memcpy(POINTER output, POINTER input, unsigned int len) +-{ +- unsigned int i; +- for (i = 0; i < len; ++i) { +- output[i] = input[i]; +- } +-} ++/* This is the central step in the MD5 algorithm. */ ++#define MD5STEP(f,w,x,y,z,in,s) \ ++ (w += f(x,y,z) + in, w = (w<>(32-s)) + x) + + /* +- Note: Replace for loop with standard memset if possible. ++ * The core of the MD5 algorithm, this alters an existing MD5 hash to ++ * reflect the addition of 16 longwords of new data. MD5Update blocks ++ * the data and converts bytes into longwords for this routine. + */ +-static void +-MD5_memset(POINTER output, int value, unsigned int len) ++void ++MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) + { +- unsigned int i; +- for (i = 0; i < len; ++i) { +- ((char *)output)[i] = (char)value; +- } ++ register UWORD32 a, b, c, d; ++ ++ a = buf[0]; ++ b = buf[1]; ++ c = buf[2]; ++ d = buf[3]; ++ ++ MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); ++ MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); ++ MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); ++ MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); ++ MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); ++ MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); ++ MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); ++ MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); ++ MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); ++ MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); ++ MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); ++ MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); ++ MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); ++ MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); ++ MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); ++ MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); ++ ++ MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); ++ MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); ++ MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); ++ MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); ++ MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); ++ MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); ++ MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); ++ MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); ++ MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); ++ MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); ++ MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); ++ MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); ++ MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); ++ MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); ++ MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); ++ MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); ++ ++ MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); ++ MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); ++ MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); ++ MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); ++ MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); ++ MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); ++ MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); ++ MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); ++ MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); ++ MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); ++ MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); ++ MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); ++ MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); ++ MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); ++ MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); ++ MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); ++ ++ MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); ++ MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); ++ MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); ++ MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); ++ MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); ++ MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); ++ MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); ++ MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); ++ MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); ++ MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); ++ MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); ++ MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); ++ MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); ++ MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); ++ MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); ++ MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); ++ ++ buf[0] += a; ++ buf[1] += b; ++ buf[2] += c; ++ buf[3] += d; + } + ++#endif +Index: libupnp-1.6.6-5/upnp/src/uuid/sysdep.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/uuid/sysdep.c 2010-05-14 16:28:21.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/uuid/sysdep.c 2010-05-14 16:28:37.000000000 +0100 +@@ -84,7 +84,7 @@ + void + get_random_info(char seed[16]) + { +- MD5_CTX c; ++ struct MD5Context c; + typedef struct { + MEMORYSTATUS m; + SYSTEM_INFO s; +@@ -142,7 +142,7 @@ + void + get_random_info(char seed[16]) + { +- MD5_CTX c; ++ struct MD5Context c; + typedef struct { + //struct sysinfo s; + struct timeval t; +Index: libupnp-1.6.6-5/upnp/src/uuid/uuid.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/uuid/uuid.c 2010-05-14 16:28:21.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/uuid/uuid.c 2010-05-14 16:28:37.000000000 +0100 +@@ -301,7 +301,7 @@ + int namelen /* the length of the name */ + ) + { +- MD5_CTX c; ++ struct MD5Context c; + unsigned char hash[16]; + uuid_upnp net_nsid; /* context UUID in network byte order */ + --- libupnp-1.6.6.orig/debian/patches/libupnp-1.6.6-r518.patch +++ libupnp-1.6.6/debian/patches/libupnp-1.6.6-r518.patch @@ -0,0 +1,577 @@ +Description: Memory leak in SSDP AdvertiseAndReply +Bug: https://sourceforge.net/support/tracker.php?aid=2392304 +Author: Ulrik ( ulsv_enea ) + +=== upnp/src/ssdp/ssdp_server.c +================================================================== +Index: libupnp-1.6.6-5/upnp/src/ssdp/ssdp_server.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/ssdp/ssdp_server.c 2010-05-14 16:28:37.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/ssdp/ssdp_server.c 2010-05-14 16:28:49.000000000 +0100 +@@ -92,309 +92,269 @@ + * Returns: int + * UPNP_E_SUCCESS if successful else appropriate error + ***************************************************************************/ +-int AdvertiseAndReply( IN int AdFlag, +- IN UpnpDevice_Handle Hnd, +- IN enum SsdpSearchType SearchType, +- IN struct sockaddr_in *DestAddr, +- IN char *DeviceType, +- IN char *DeviceUDN, +- IN char *ServiceType, +- int Exp ) ++int AdvertiseAndReply( ++ IN int AdFlag, ++ IN UpnpDevice_Handle Hnd, ++ IN enum SsdpSearchType SearchType, ++ IN struct sockaddr_in *DestAddr, ++ IN char *DeviceType, ++ IN char *DeviceUDN, ++ IN char *ServiceType, ++ int Exp) + { +- int i, +- j; +- int defaultExp = DEFAULT_MAXAGE; +- struct Handle_Info *SInfo = NULL; +- char UDNstr[100], +- devType[100], +- servType[100]; +- IXML_NodeList *nodeList = NULL; +- IXML_NodeList *tmpNodeList = NULL; +- IXML_Node *tmpNode = NULL; +- IXML_Node *tmpNode2 = NULL; +- IXML_Node *textNode = NULL; +- const DOMString tmpStr; +- char SERVER[200]; +- +- const DOMString dbgStr; +- UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, +- "Inside AdvertiseAndReply with AdFlag = %d\n", +- AdFlag ); +- +- // Use a read lock +- HandleReadLock(); +- if( GetHandleInfo( Hnd, &SInfo ) != HND_DEVICE ) { +- HandleUnlock(); +- return UPNP_E_INVALID_HANDLE; +- } +- defaultExp = SInfo->MaxAge; +- +- //get server info +- +- get_sdk_info( SERVER ); +- +- // parse the device list and send advertisements/replies +- for( i = 0;; i++ ) { +- +- UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, +- "Entering new device list with i = %d\n\n", i ); +- +- tmpNode = ixmlNodeList_item( SInfo->DeviceList, i ); +- if( tmpNode == NULL ) { +- UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, +- "Exiting new device list with i = %d\n\n", i ); +- break; +- } +- +- dbgStr = ixmlNode_getNodeName( tmpNode ); +- UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__, +- "Extracting device type once for %s\n", dbgStr ); +- // extract device type +- ixmlNodeList_free( nodeList ); +- nodeList = NULL; +- nodeList = ixmlElement_getElementsByTagName( +- ( IXML_Element * ) tmpNode, "deviceType" ); +- if( nodeList == NULL ) { +- continue; +- } +- +- dbgStr = ixmlNode_getNodeName( tmpNode ); +- UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, +- "Extracting UDN for %s\n", dbgStr ); +- UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, +- "Extracting device type\n" ); +- +- tmpNode2 = ixmlNodeList_item( nodeList, 0 ); +- if( tmpNode2 == NULL ) { +- continue; +- } +- textNode = ixmlNode_getFirstChild( tmpNode2 ); +- if( textNode == NULL ) { +- continue; +- } +- +- UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, +- "Extracting device type \n" ); +- +- tmpStr = ixmlNode_getNodeValue( textNode ); +- if( tmpStr == NULL ) { +- continue; +- } +- +- strcpy( devType, tmpStr ); +- if( devType == NULL ) { +- continue; +- } +- +- UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, +- "Extracting device type = %s\n", devType ); +- if( tmpNode == NULL ) { +- UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, +- "TempNode is NULL\n" ); ++ int retVal = UPNP_E_SUCCESS; ++ int i; ++ int j; ++ int defaultExp = DEFAULT_MAXAGE; ++ struct Handle_Info *SInfo = NULL; ++ char UDNstr[100]; ++ char devType[100]; ++ char servType[100]; ++ IXML_NodeList *nodeList = NULL; ++ IXML_NodeList *tmpNodeList = NULL; ++ IXML_Node *tmpNode = NULL; ++ IXML_Node *tmpNode2 = NULL; ++ IXML_Node *textNode = NULL; ++ const DOMString tmpStr; ++ char SERVER[200]; ++ const DOMString dbgStr; ++ ++ UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, ++ "Inside AdvertiseAndReply with AdFlag = %d\n", AdFlag); ++ ++ /* Use a read lock */ ++ HandleReadLock(); ++ if (GetHandleInfo(Hnd, &SInfo) != HND_DEVICE) { ++ retVal = UPNP_E_INVALID_HANDLE; ++ goto end_function; + } +- dbgStr = ixmlNode_getNodeName( tmpNode ); +- UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, +- "Extracting UDN for %s\n", dbgStr ); +- // extract UDN +- ixmlNodeList_free( nodeList ); +- nodeList = NULL; +- nodeList = ixmlElement_getElementsByTagName( ( IXML_Element * ) +- tmpNode, "UDN" ); +- if( nodeList == NULL ) { +- UpnpPrintf( UPNP_CRITICAL, API, __FILE__, +- __LINE__, "UDN not found!!!\n" ); +- continue; +- } +- tmpNode2 = ixmlNodeList_item( nodeList, 0 ); +- if( tmpNode2 == NULL ) { +- UpnpPrintf( UPNP_CRITICAL, API, __FILE__, +- __LINE__, "UDN not found!!!\n" ); +- continue; +- } +- textNode = ixmlNode_getFirstChild( tmpNode2 ); +- if( textNode == NULL ) { +- UpnpPrintf( UPNP_CRITICAL, API, __FILE__, +- __LINE__, "UDN not found!!!\n" ); +- continue; +- } +- tmpStr = ixmlNode_getNodeValue( textNode ); +- if( tmpStr == NULL ) { +- UpnpPrintf( UPNP_CRITICAL, API, __FILE__, __LINE__, +- "UDN not found!!!!\n" ); +- continue; +- } +- strcpy( UDNstr, tmpStr ); +- if( UDNstr == NULL ) { +- continue; +- } +- +- UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__, +- "Sending UDNStr = %s \n", UDNstr ); +- if( AdFlag ) { +- // send the device advertisement +- if( AdFlag == 1 ) { +- DeviceAdvertisement( devType, i == 0, +- UDNstr, SInfo->DescURL, Exp ); +- } else { // AdFlag == -1 +- DeviceShutdown( devType, i == 0, UDNstr, +- SERVER, SInfo->DescURL, Exp ); +- } +- } else { +- switch ( SearchType ) { +- +- case SSDP_ALL: +- DeviceReply( DestAddr, +- devType, i == 0, +- UDNstr, SInfo->DescURL, defaultExp ); +- break; +- +- case SSDP_ROOTDEVICE: +- if( i == 0 ) { +- SendReply( DestAddr, devType, 1, +- UDNstr, SInfo->DescURL, defaultExp, 0 ); +- } +- break; +- case SSDP_DEVICEUDN: +- { +- if( DeviceUDN != NULL && strlen( DeviceUDN ) != 0 ) { +- if( strcasecmp( DeviceUDN, UDNstr ) ) { +- UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__, +- "DeviceUDN=%s and search " +- "UDN=%s did not match\n", +- UDNstr, DeviceUDN ); +- break; +- } else { +- UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__, +- "DeviceUDN=%s and search " +- "UDN=%s MATCH\n", UDNstr, +- DeviceUDN ); +- SendReply( DestAddr, devType, 0, +- UDNstr, SInfo->DescURL, +- defaultExp, 0 ); +- break; +- } +- } +- } +- case SSDP_DEVICETYPE: +- { +- if( !strncasecmp +- ( DeviceType, devType, +- strlen( DeviceType ) ) ) { +- UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__, +- "DeviceType=%s and search devType=%s MATCH\n", +- devType, DeviceType ); +- SendReply( DestAddr, devType, 0, UDNstr, +- SInfo->DescURL, defaultExp, 1 ); +- } else { +- UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__, +- "DeviceType=%s and search devType=%s" +- " DID NOT MATCH\n", +- devType, DeviceType ); ++ ++ defaultExp = SInfo->MaxAge; ++ ++ /* get server info */ ++ get_sdk_info(SERVER); ++ ++ /* parse the device list and send advertisements/replies */ ++ for (i = 0;; i++) { ++ UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, ++ "Entering new device list with i = %d\n\n", i); ++ tmpNode = ixmlNodeList_item(SInfo->DeviceList, i); ++ if (!tmpNode) { ++ UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, ++ "Exiting new device list with i = %d\n\n", i); ++ break; ++ } ++ dbgStr = ixmlNode_getNodeName(tmpNode); ++ ++ UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, ++ "Extracting device type once for %s\n", dbgStr); ++ ixmlNodeList_free(nodeList); ++ nodeList = ixmlElement_getElementsByTagName( ++ (IXML_Element *)tmpNode, "deviceType"); ++ if (!nodeList) continue; ++ ++ UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, ++ "Extracting UDN for %s\n", dbgStr); ++ dbgStr = ixmlNode_getNodeName(tmpNode); ++ ++ UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, ++ "Extracting device type\n"); ++ tmpNode2 = ixmlNodeList_item(nodeList, 0); ++ if (!tmpNode2) continue; ++ ++ textNode = ixmlNode_getFirstChild(tmpNode2); ++ if (!textNode) continue; ++ ++ UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, ++ "Extracting device type \n"); ++ tmpStr = ixmlNode_getNodeValue(textNode); ++ if (!tmpStr) continue; ++ ++ strcpy(devType, tmpStr); ++ UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, ++ "Extracting device type = %s\n", devType); ++ if (!tmpNode) { ++ UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, ++ "TempNode is NULL\n"); ++ } ++ dbgStr = ixmlNode_getNodeName(tmpNode); ++ ++ UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, ++ "Extracting UDN for %s\n", dbgStr); ++ ixmlNodeList_free(nodeList); ++ nodeList = ixmlElement_getElementsByTagName( ++ (IXML_Element *)tmpNode, "UDN"); ++ if (!nodeList) { ++ UpnpPrintf(UPNP_CRITICAL, API, __FILE__, ++ __LINE__, "UDN not found!\n"); ++ continue; ++ } ++ tmpNode2 = ixmlNodeList_item(nodeList, 0); ++ if (!tmpNode2) { ++ UpnpPrintf(UPNP_CRITICAL, API, __FILE__, ++ __LINE__, "UDN not found!\n"); ++ continue; ++ } ++ textNode = ixmlNode_getFirstChild(tmpNode2); ++ if (!textNode) { ++ UpnpPrintf(UPNP_CRITICAL, API, __FILE__, ++ __LINE__, "UDN not found!\n"); ++ continue; ++ } ++ tmpStr = ixmlNode_getNodeValue(textNode); ++ if (!tmpStr) { ++ UpnpPrintf(UPNP_CRITICAL, API, __FILE__, __LINE__, ++ "UDN not found!\n"); ++ continue; ++ } ++ strcpy(UDNstr, tmpStr); ++ UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, ++ "Sending UDNStr = %s \n", UDNstr); ++ if (AdFlag) { ++ /* send the device advertisement */ ++ if (AdFlag == 1) { ++ DeviceAdvertisement(devType, i == 0, ++ UDNstr, SInfo->DescURL, Exp); ++ } else { ++ /* AdFlag == -1 */ ++ DeviceShutdown(devType, i == 0, UDNstr, ++ SERVER, SInfo->DescURL, Exp); ++ } ++ } else { ++ switch (SearchType) { ++ case SSDP_ALL: ++ DeviceReply(DestAddr, devType, i == 0, ++ UDNstr, SInfo->DescURL, defaultExp); ++ break; ++ case SSDP_ROOTDEVICE: ++ if (i == 0) { ++ SendReply(DestAddr, devType, 1, ++ UDNstr, SInfo->DescURL, defaultExp, 0); ++ } ++ break; ++ case SSDP_DEVICEUDN: { ++ if (DeviceUDN && strlen(DeviceUDN) != 0) { ++ if (strcasecmp(DeviceUDN, UDNstr)) { ++ UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, ++ "DeviceUDN=%s and search " ++ "UDN=%s did not match\n", ++ UDNstr, DeviceUDN); ++ break; ++ } else { ++ UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, ++ "DeviceUDN=%s and search " ++ "UDN=%s MATCH\n", UDNstr, ++ DeviceUDN); ++ SendReply(DestAddr, devType, 0, ++ UDNstr, SInfo->DescURL, ++ defaultExp, 0); ++ break; ++ } ++ } ++ } ++ case SSDP_DEVICETYPE: { ++ if (!strncasecmp(DeviceType, devType, strlen(DeviceType))) { ++ UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, ++ "DeviceType=%s and search devType=%s MATCH\n", ++ devType, DeviceType); ++ SendReply(DestAddr, devType, 0, UDNstr, ++ SInfo->DescURL, defaultExp, 1); ++ } else { ++ UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, ++ "DeviceType=%s and search devType=%s" ++ " DID NOT MATCH\n", ++ devType, DeviceType); ++ } ++ break; ++ } ++ default: ++ break; + } +- break; +- } +- default: +- break; +- } +- } +- // send service advertisements for services corresponding +- // to the same device +- UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__, +- "Sending service Advertisement\n" ); +- +- tmpNode = ixmlNodeList_item( SInfo->ServiceList, i ); +- if( tmpNode == NULL ) { +- continue; +- } +- ixmlNodeList_free( nodeList ); +- nodeList = NULL; +- nodeList = ixmlElement_getElementsByTagName( ( IXML_Element * ) +- tmpNode, "service" ); +- if( nodeList == NULL ) { +- UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__, +- "Service not found 3\n" ); +- continue; +- } +- for( j = 0;; j++ ) { +- tmpNode = ixmlNodeList_item( nodeList, j ); +- if( tmpNode == NULL ) { +- break; +- } +- +- ixmlNodeList_free( tmpNodeList ); +- tmpNodeList = NULL; +- tmpNodeList = ixmlElement_getElementsByTagName( +- ( IXML_Element *)tmpNode, "serviceType" ); +- if( tmpNodeList == NULL ) { +- UpnpPrintf( UPNP_CRITICAL, API, __FILE__, __LINE__, +- "ServiceType not found \n" ); +- continue; +- } +- tmpNode2 = ixmlNodeList_item( tmpNodeList, 0 ); +- if( tmpNode2 == NULL ) { +- continue; +- } +- textNode = ixmlNode_getFirstChild( tmpNode2 ); +- if( textNode == NULL ) { +- continue; +- } +- // servType is of format Servicetype:ServiceVersion +- tmpStr = ixmlNode_getNodeValue( textNode ); +- if( tmpStr == NULL ) { +- continue; +- } +- strcpy( servType, tmpStr ); +- if( servType == NULL ) { +- continue; +- } +- +- UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__, +- "ServiceType = %s\n", servType ); +- if( AdFlag ) { +- if( AdFlag == 1 ) { +- ServiceAdvertisement( UDNstr, servType, +- SInfo->DescURL, Exp ); +- } else { // AdFlag == -1 +- ServiceShutdown( UDNstr, servType, +- SInfo->DescURL, Exp ); +- } +- } else { +- switch ( SearchType ) { +- case SSDP_ALL: +- ServiceReply( DestAddr, servType, +- UDNstr, SInfo->DescURL, +- defaultExp ); +- break; +- case SSDP_SERVICE: +- if( ServiceType != NULL ) { +- if( !strncasecmp( ServiceType, +- servType, +- strlen( ServiceType ) ) ) { +- ServiceReply( DestAddr, servType, +- UDNstr, SInfo->DescURL, +- defaultExp ); +- } +- } +- break; +- default: +- break; +- } // switch(SearchType) +- +- } +- } +- ixmlNodeList_free( tmpNodeList ); +- tmpNodeList = NULL; +- ixmlNodeList_free( nodeList ); +- nodeList = NULL; +- } +- UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, +- "Exiting AdvertiseAndReply : \n" ); ++ } ++ /* send service advertisements for services corresponding ++ * to the same device */ ++ UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, ++ "Sending service Advertisement\n"); ++ ++ tmpNode = ixmlNodeList_item(SInfo->ServiceList, i); ++ if (!tmpNode) continue; ++ ixmlNodeList_free(nodeList); ++ nodeList = ixmlElement_getElementsByTagName( ++ (IXML_Element *)tmpNode, "service"); ++ if (!nodeList) { ++ UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__, ++ "Service not found 3\n" ); ++ continue; ++ } ++ for (j = 0;; j++) { ++ tmpNode = ixmlNodeList_item(nodeList, j); ++ if (!tmpNode) { ++ break; ++ } ++ ixmlNodeList_free(tmpNodeList); ++ tmpNodeList = ixmlElement_getElementsByTagName( ++ (IXML_Element *)tmpNode, "serviceType"); ++ if (!tmpNodeList) { ++ UpnpPrintf(UPNP_CRITICAL, API, __FILE__, __LINE__, ++ "ServiceType not found \n"); ++ continue; ++ } ++ tmpNode2 = ixmlNodeList_item(tmpNodeList, 0); ++ if (!tmpNode2) continue; ++ textNode = ixmlNode_getFirstChild(tmpNode2); ++ if (!textNode) continue; ++ /* servType is of format Servicetype:ServiceVersion */ ++ tmpStr = ixmlNode_getNodeValue(textNode); ++ if (!tmpStr) continue; ++ strcpy(servType, tmpStr); ++ UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, ++ "ServiceType = %s\n", servType); ++ if (AdFlag) { ++ if (AdFlag == 1) { ++ ServiceAdvertisement(UDNstr, servType, ++ SInfo->DescURL, Exp); ++ } else { ++ /* AdFlag == -1 */ ++ ServiceShutdown(UDNstr, servType, ++ SInfo->DescURL, Exp); ++ } ++ } else { ++ switch (SearchType) { ++ case SSDP_ALL: ++ ServiceReply(DestAddr, servType, ++ UDNstr, SInfo->DescURL, ++ defaultExp); ++ break; ++ case SSDP_SERVICE: ++ if (ServiceType) { ++ if (!strncasecmp(ServiceType, servType, strlen(ServiceType))) { ++ ServiceReply(DestAddr, servType, ++ UDNstr, SInfo->DescURL, defaultExp); ++ } ++ } ++ break; ++ default: ++ break; ++ } ++ } ++ } ++ ixmlNodeList_free(tmpNodeList); ++ tmpNodeList = NULL; ++ ixmlNodeList_free(nodeList); ++ nodeList = NULL; ++ } ++ ++end_function: ++ ixmlNodeList_free(tmpNodeList); ++ ixmlNodeList_free(nodeList); + +- HandleUnlock(); ++ UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, ++ "Exiting AdvertiseAndReply.\n"); + +- return UPNP_E_SUCCESS; ++ HandleUnlock(); + +-} /****************** End of AdvertiseAndReply *********************/ ++ return retVal; ++} + + #endif /* EXCLUDE_SSDP == 0 */ + #endif /* INCLUDE_DEVICE_APIS */ --- libupnp-1.6.6.orig/debian/patches/libupnp-1.6.6-r515.patch +++ libupnp-1.6.6/debian/patches/libupnp-1.6.6-r515.patch @@ -0,0 +1,102 @@ +Description: libupnp and multi-flows scenario patch + After an analysis of the problem of libupnp with a multi-flows scenario, I + noticed that the only cause of the freezed system is the ThreadPool + management. There are not mutex problems. In practise, if all threads in the + thread pool are busy executing jobs, a new worker thread should be created if + a job is scheduled (I inspired to tombupnp library). So I solved the problem + with a little patch in threadutil library that you can find attached in this + e-mail. I hope to have helped you. +Author: Carlo Parata from STMicroelectronics. + +=== threadutil/src/ThreadPool.c +================================================================== +Index: libupnp-1.6.6-5/threadutil/src/ThreadPool.c +=================================================================== +--- libupnp-1.6.6-5.orig/threadutil/src/ThreadPool.c 2010-05-14 16:28:37.000000000 +0100 ++++ libupnp-1.6.6-5/threadutil/src/ThreadPool.c 2010-05-14 16:28:37.000000000 +0100 +@@ -451,6 +451,7 @@ + while( 1 ) { + ithread_mutex_lock( &tp->mutex ); + if( job ) { ++ tp->busyThreads--; + FreeThreadPoolJob( tp, job ); + job = NULL; + } +@@ -563,6 +564,7 @@ + } + } + ++ tp->busyThreads++; + ithread_mutex_unlock( &tp->mutex ); + + if( SetPriority( job->priority ) != 0 ) { +@@ -667,7 +669,7 @@ + * ThreadPool* tp + * + *****************************************************************************/ +-static void AddWorker( ThreadPool *tp ) ++static void AddWorker(ThreadPool *tp) + { + int jobs = 0; + int threads = 0; +@@ -676,8 +678,10 @@ + + jobs = tp->highJobQ.size + tp->lowJobQ.size + tp->medJobQ.size; + threads = tp->totalThreads - tp->persistentThreads; +- while( threads == 0 || (jobs / threads) >= tp->attr.jobsPerThread ) { +- if( CreateWorker( tp ) != 0 ) { ++ while (threads == 0 || ++ (jobs / threads) >= tp->attr.jobsPerThread || ++ (tp->totalThreads == tp->busyThreads) ) { ++ if (CreateWorker(tp) != 0) { + return; + } + threads++; +@@ -783,6 +787,7 @@ + tp->lastJobId = 0; + tp->shutdown = 0; + tp->totalThreads = 0; ++ tp->busyThreads = 0; + tp->persistentThreads = 0; + for( i = 0; i < tp->attr.minThreads; ++i ) { + if( ( retCode = CreateWorker( tp ) ) != 0 ) { +Index: libupnp-1.6.6-5/threadutil/inc/ThreadPool.h +=================================================================== +--- libupnp-1.6.6-5.orig/threadutil/inc/ThreadPool.h 2010-05-14 16:28:16.000000000 +0100 ++++ libupnp-1.6.6-5/threadutil/inc/ThreadPool.h 2010-05-14 16:28:37.000000000 +0100 +@@ -214,21 +214,20 @@ + + typedef struct THREADPOOL + { +- ithread_mutex_t mutex; /* mutex to protect job qs */ +- ithread_cond_t condition; /* condition variable to signal Q */ +- ithread_cond_t start_and_shutdown; /* condition variable for start +- and stop */ +- int lastJobId; /* ids for jobs */ +- int shutdown; /* whether or not we are shutting down */ +- int totalThreads; /* total number of threads */ +- int persistentThreads; /* number of persistent threads */ +- FreeList jobFreeList; /* free list of jobs */ +- LinkedList lowJobQ; /* low priority job Q */ +- LinkedList medJobQ; /* med priority job Q */ +- LinkedList highJobQ; /* high priority job Q */ +- ThreadPoolJob *persistentJob; /* persistent job */ +- +- ThreadPoolAttr attr; /* thread pool attributes */ ++ ithread_mutex_t mutex; /* mutex to protect job qs */ ++ ithread_cond_t condition; /* condition variable to signal Q */ ++ ithread_cond_t start_and_shutdown; /* condition variable for start and stop */ ++ int lastJobId; /* ids for jobs */ ++ int shutdown; /* whether or not we are shutting down */ ++ int totalThreads; /* total number of threads */ ++ int busyThreads; /* number of threads that are currently executing jobs */ ++ int persistentThreads; /* number of persistent threads */ ++ FreeList jobFreeList; /* free list of jobs */ ++ LinkedList lowJobQ; /* low priority job Q */ ++ LinkedList medJobQ; /* med priority job Q */ ++ LinkedList highJobQ; /* high priority job Q */ ++ ThreadPoolJob *persistentJob; /* persistent job */ ++ ThreadPoolAttr attr; /* thread pool attributes */ + + /* statistics */ + ThreadPoolStats stats; --- libupnp-1.6.6.orig/debian/patches/07-neaten-debug.patch +++ libupnp-1.6.6/debian/patches/07-neaten-debug.patch @@ -0,0 +1,613 @@ +Description: Neaten debugging so it's safe to leave it compiled in: + * Don't keep pointers to passed-in filenames, they might have been temporaries. + * Replace some anonymous comparisons by the appropriate enum name. + * Replace big file+line banner by a line-based format including timestamp, + and add/remove newlines or white space where appropriate. + * Comment out the noisy "Adding a string" prints from the debug. + * Remove print_http_headers() which wrote to stdout, they are already + logged via UpnpPrintf from everywhere that called print_http_headers(). +Author: Nick Leverton + +Index: libupnp-1.6.6-5/upnp/src/genlib/net/http/httpparser.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/genlib/net/http/httpparser.c 2010-05-14 16:28:14.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/genlib/net/http/httpparser.c 2010-05-14 16:28:37.000000000 +0100 +@@ -2496,49 +2496,3 @@ + return index == -1 ? NULL : Http_Method_Table[index].name; + } + +-/************************************************************************ +-* Function: print_http_headers +-* +-* Parameters: +-* http_message_t* hmsg ; HTTP Message object +-* +-* Description: +-* +-* Returns: +-* void +-************************************************************************/ +-#ifdef DEBUG +-void +-print_http_headers( http_message_t * hmsg ) +-{ +- ListNode *node; +- // NNS: dlist_node *node; +- http_header_t *header; +- +- // print start line +- if( hmsg->is_request ) { +- printf( "method = %d, version = %d.%d, url = %.*s\n", +- hmsg->method, hmsg->major_version, hmsg->minor_version, +- (int)hmsg->uri.pathquery.size, hmsg->uri.pathquery.buff); +- } else { +- printf( "resp status = %d, version = %d.%d, status msg = %.*s\n", +- hmsg->status_code, hmsg->major_version, hmsg->minor_version, +- (int)hmsg->status_msg.length, hmsg->status_msg.buf); +- } +- +- // print headers +- node = ListHead( &hmsg->headers ); +- // NNS: node = dlist_first_node( &hmsg->headers ); +- while( node != NULL ) { +- header = ( http_header_t * ) node->item; +- // NNS: header = (http_header_t *)node->data; +- printf( "hdr name: %.*s, value: %.*s\n", +- (int)header->name.length, header->name.buf, +- (int)header->value.length, header->value.buf ); +- +- node = ListNext( &hmsg->headers, node ); +- // NNS: node = dlist_next( &hmsg->headers, node ); +- } +-} +-#endif +- +Index: libupnp-1.6.6-5/upnp/src/api/upnpdebug.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/api/upnpdebug.c 2010-05-14 16:28:14.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/api/upnpdebug.c 2010-05-14 16:28:48.000000000 +0100 +@@ -35,6 +35,7 @@ + #include + #include "ithread.h" + #include "upnp.h" ++#include + #include + #include + +@@ -53,10 +54,10 @@ + static FILE *InfoFileHnd = NULL; + + //Name of the error file +-static const char *errFileName = "IUpnpErrFile.txt"; ++static const char *errFileName = strdup("IUpnpErrFile.txt"); + + //Name of the info file +-static const char *infoFileName = "IUpnpInfoFile.txt"; ++static const char *infoFileName = strdup("IUpnpInfoFile.txt"); + + + +@@ -78,11 +79,19 @@ + UpnpSetLogFileNames ( IN const char *ErrFileName, + IN const char *InfoFileName ) + { ++ if( errFileName ) { ++ free((void*)errFileName); ++ errFileName = NULL; ++ } + if( ErrFileName ) { +- errFileName = ErrFileName; ++ errFileName = strdup(ErrFileName); ++ } ++ if( infoFileName ) { ++ free((void*)infoFileName); ++ infoFileName = NULL; + } + if( InfoFileName ) { +- infoFileName = InfoFileName; ++ infoFileName = strdup(InfoFileName); + } + } + +@@ -105,9 +114,9 @@ + ithread_mutex_init( &GlobalDebugMutex, NULL ); + + if( DEBUG_TARGET == 1 ) { +- if( ( ErrFileHnd = fopen( errFileName, "a" ) ) == NULL ) ++ if( errFileName && *errFileName && (ErrFileHnd = fopen( errFileName, "a")) == NULL) + return -1; +- if( ( InfoFileHnd = fopen( infoFileName, "a" ) ) == NULL ) ++ if( infoFileName && *infoFileName && (InfoFileHnd = fopen( infoFileName, "a")) == NULL) + return -1; + } + return UPNP_E_SUCCESS; +@@ -143,10 +152,14 @@ + UpnpCloseLog() + { + if( DEBUG_TARGET == 1 ) { +- fflush( ErrFileHnd ); +- fflush( InfoFileHnd ); +- fclose( ErrFileHnd ); +- fclose( InfoFileHnd ); ++ if( ErrFileHnd ) { ++ fflush(ErrFileHnd); ++ fclose(ErrFileHnd); ++ } ++ if( InfoFileHnd ) { ++ fflush(InfoFileHnd); ++ fclose(InfoFileHnd); ++ } + } + ithread_mutex_destroy( &GlobalDebugMutex ); + +@@ -233,18 +246,21 @@ + } + vfprintf(stdout, FmtStr, ArgList); + fflush(stdout); +- } else if (DLevel == 0) { +- if (DbgFileName) { +- UpnpDisplayFileAndLine(ErrFileHnd, DbgFileName, DbgLineNo); +- } +- vfprintf(ErrFileHnd, FmtStr, ArgList); +- fflush(ErrFileHnd); + } else { +- if (DbgFileName) { +- UpnpDisplayFileAndLine(InfoFileHnd, DbgFileName, DbgLineNo); ++ if (ErrFileHnd && DLevel == UPNP_CRITICAL) { ++ if (DbgFileName) { ++ UpnpDisplayFileAndLine(ErrFileHnd, DbgFileName, DbgLineNo); ++ } ++ vfprintf(ErrFileHnd, FmtStr, ArgList); ++ fflush(ErrFileHnd); ++ } ++ if (InfoFileHnd) { ++ if (DbgFileName) { ++ UpnpDisplayFileAndLine(InfoFileHnd, DbgFileName, DbgLineNo); ++ } ++ vfprintf(InfoFileHnd, FmtStr, ArgList); ++ fflush(InfoFileHnd); + } +- vfprintf(InfoFileHnd, FmtStr, ArgList); +- fflush(InfoFileHnd); + } + va_end(ArgList); + ithread_mutex_unlock(&GlobalDebugMutex); +@@ -269,7 +285,7 @@ + * else returns the right file descriptor + ***************************************************************************/ + #ifdef DEBUG +-FILE *GetDebugFile( Upnp_LogLevel DLevel, Dbg_Module Module ) ++FILE *UpnpGetDebugFile( Upnp_LogLevel DLevel, Dbg_Module Module ) + { + FILE *ret; + +@@ -279,7 +295,7 @@ + + if (!DEBUG_TARGET) { + ret = stdout; +- } else if (DLevel == 0) { ++ } else if (DLevel == UPNP_CRITICAL) { + ret = ErrFileHnd; + } else { + ret = InfoFileHnd; +@@ -310,101 +326,22 @@ + IN const char *DbgFileName, + IN int DbgLineNo) + { +-#define NLINES 2 +-#define MAX_LINE_SIZE 512 +-#define NUMBER_OF_STARS 80 +- const char *lines[NLINES]; +- char buf[NLINES][MAX_LINE_SIZE]; +- int i; +- +- /* Initialize the pointer array */ +- for (i = 0; i < NLINES; i++) { +- lines[i] = buf[i]; +- } +- +- /* Put the debug lines in the buffer */ +- sprintf(buf[0], "DEBUG - THREAD ID: 0x%lX", ++ time_t timenow = time(NULL); ++ struct tm localtimenow; ++ char timeprint[20]; /* "YYYY-MM-DD HH:MM:SS" */ ++ ++ localtime_r(&timenow, &localtimenow); ++ strftime(timeprint, sizeof(timeprint), "%F %T", &localtimenow); ++ fprintf(fd, "%s 0x%lX ", timeprint, + (unsigned long int)ithread_self()); + if (DbgFileName) { +- sprintf(buf[1], +- "FILE: %s, LINE: %d", +- DbgFileName, ++ char *filepath = strdup(DbgFileName); ++ fprintf(fd, "%s:%d ", ++ basename(filepath), + DbgLineNo); ++ free(filepath); + } +- +- /* Show the lines centered */ +- UpnpDisplayBanner(fd, lines, NLINES, NUMBER_OF_STARS); + fflush(fd); + } + #endif + +- +-/*************************************************************************** +- * Function : UpnpDisplayBanner +- * +- * Parameters: +- * IN FILE *fd: file descriptor where the banner will be written +- * IN char **lines: The buffer that will be written +- * IN int size: Size of the buffer +- * IN int starLength: This parameter provides the width of the banner +- * +- * Description: +- * This functions takes the buffer and writes the buffer in the file as +- * per the requested banner +- * Returns: void +- ***************************************************************************/ +-#ifdef DEBUG +-void UpnpDisplayBanner( +- IN FILE * fd, +- IN const char **lines, +- IN size_t size, +- IN int starLength) +-{ +- int leftMarginLength = starLength / 2 + 1; +- int rightMarginLength = starLength / 2 + 1; +- int i = 0; +- int LineSize = 0; +- int starLengthMinus2 = starLength - 2; +- +- char *leftMargin = ( char * )malloc( leftMarginLength ); +- char *rightMargin = ( char * )malloc( rightMarginLength ); +- char *stars = ( char * )malloc( starLength + 1 ); +- char *currentLine = ( char * )malloc( starLength + 1 ); +- const char *line = NULL; +- +- memset( stars, '*', starLength ); +- stars[starLength] = 0; +- memset( leftMargin, 0, leftMarginLength ); +- memset( rightMargin, 0, rightMarginLength ); +- fprintf( fd, "\n%s\n", stars ); +- for( i = 0; i < size; i++ ) { +- LineSize = strlen( lines[i] ); +- line = lines[i]; +- while( LineSize > starLengthMinus2 ) { +- memcpy( currentLine, line, starLengthMinus2 ); +- currentLine[starLengthMinus2] = 0; +- fprintf( fd, "*%s*\n", currentLine ); +- LineSize -= starLengthMinus2; +- line += starLengthMinus2; +- } +- leftMarginLength = (starLengthMinus2 - LineSize)/2; +- if( LineSize % 2 == 0 ) { +- rightMarginLength = leftMarginLength; +- } else { +- rightMarginLength = leftMarginLength + 1; +- } +- memset( leftMargin, ' ', leftMarginLength ); +- memset( rightMargin, ' ', rightMarginLength ); +- leftMargin[leftMarginLength] = 0; +- rightMargin[rightMarginLength] = 0; +- fprintf( fd, "*%s%s%s*\n", leftMargin, line, rightMargin ); +- } +- fprintf( fd, "%s\n\n", stars ); +- +- free( currentLine ); +- free( stars ); +- free( rightMargin ); +- free( leftMargin ); +-} +-#endif +- +Index: libupnp-1.6.6-5/upnp/src/gena/gena_ctrlpt.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/gena/gena_ctrlpt.c 2010-05-14 16:28:14.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/gena/gena_ctrlpt.c 2010-05-14 16:28:37.000000000 +0100 +@@ -73,13 +73,13 @@ + + if( AUTO_RENEW_TIME == 0 ) { + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "GENA SUB EXPIRED" ); ++ "GENA SUB EXPIRED\n" ); + sub_struct->ErrCode = UPNP_E_SUCCESS; + send_callback = 1; + eventType = UPNP_EVENT_SUBSCRIPTION_EXPIRED; + } else { + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "GENA AUTO RENEW" ); ++ "GENA AUTO RENEW\n" ); + if( ( ( sub_struct->ErrCode = genaRenewSubscription( event->handle, + sub_struct-> + Sid, +@@ -100,7 +100,7 @@ + return; + } + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "HANDLE IS VALID" ); ++ "HANDLE IS VALID\n" ); + callback_fun = handle_info->Callback; + cookie = handle_info->Cookie; + HandleUnlock(); +@@ -542,7 +542,7 @@ + char *EventURL = NULL; + + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "GENA SUBSCRIBE BEGIN" ); ++ "GENA SUBSCRIBE BEGIN\n" ); + + memset( out_sid, 0, sizeof( Upnp_SID ) ); + +@@ -668,7 +668,7 @@ + } + + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "REMOVED AUTO RENEW EVENT" ); ++ "REMOVED AUTO RENEW EVENT\n" ); + + sub->RenewEventId = -1; + return_code = copy_client_subscription( sub, &sub_copy ); +Index: libupnp-1.6.6-5/upnp/src/inc/gena.h +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/inc/gena.h 2010-05-14 16:28:14.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/inc/gena.h 2010-05-14 16:28:37.000000000 +0100 +@@ -94,18 +94,18 @@ + // Lock the subscription + #define SubscribeLock() \ + UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \ +- "Trying Subscribe Lock"); \ ++ "Trying Subscribe Lock\n"); \ + ithread_mutex_lock(&GlobalClientSubscribeMutex); \ + UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \ +- "Subscribe Lock"); ++ "Subscribe Lock\n"); + + // Unlock the subscription + #define SubscribeUnlock() \ + UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \ +- "Trying Subscribe UnLock"); \ ++ "Trying Subscribe UnLock\n"); \ + ithread_mutex_unlock(&GlobalClientSubscribeMutex); \ + UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \ +- "Subscribe UnLock"); ++ "Subscribe UnLock\n"); + + + // Structure to send NOTIFY message to all subscribed control points +Index: libupnp-1.6.6-5/upnp/src/inc/upnpapi.h +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/inc/upnpapi.h 2010-05-14 16:28:14.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/inc/upnpapi.h 2010-05-14 16:28:37.000000000 +0100 +@@ -100,19 +100,19 @@ + #define HandleLock() HandleWriteLock() + + #define HandleWriteLock() \ +- UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a write lock"); \ ++ UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a write lock\n"); \ + ithread_rwlock_wrlock(&GlobalHndRWLock); \ +- UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Write lock acquired"); ++ UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Write lock acquired\n"); + + #define HandleReadLock() \ +- UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a read lock"); \ ++ UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a read lock\n"); \ + ithread_rwlock_rdlock(&GlobalHndRWLock); \ +- UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Read lock acquired"); ++ UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Read lock acquired\n"); + + #define HandleUnlock() \ +- UpnpPrintf(UPNP_INFO, API,__FILE__, __LINE__, "Trying Unlock"); \ ++ UpnpPrintf(UPNP_INFO, API,__FILE__, __LINE__, "Trying Unlock\n"); \ + ithread_rwlock_unlock(&GlobalHndRWLock); \ +- UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Unlocked rwlock"); ++ UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Unlocked rwlock\n"); + + Upnp_Handle_Type GetClientHandleInfo(int *client_handle_out, + struct Handle_Info **HndInfo); +Index: libupnp-1.6.6-5/upnp/src/gena/gena_device.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/gena/gena_device.c 2010-05-14 16:28:37.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/gena/gena_device.c 2010-05-14 16:28:37.000000000 +0100 +@@ -478,7 +478,7 @@ + notify_thread_struct *thread_struct = NULL; + + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "GENA BEGIN INITIAL NOTIFY " ); ++ "GENA BEGIN INITIAL NOTIFY\n" ); + + reference_count = ( int * )malloc( sizeof( int ) ); + +@@ -524,7 +524,7 @@ + } + + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "FOUND SERVICE IN INIT NOTFY: UDN %s, ServID: %s ", ++ "FOUND SERVICE IN INIT NOTFY: UDN %s, ServID: %s\n", + UDN, servId ); + + if( ( ( sub = GetSubscriptionSID( sid, service ) ) == NULL ) || +@@ -537,7 +537,7 @@ + } + + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "FOUND SUBSCRIPTION IN INIT NOTIFY: SID %s ", sid ); ++ "FOUND SUBSCRIPTION IN INIT NOTIFY: SID %s\n", sid ); + + sub->active = 1; + +@@ -668,7 +668,7 @@ + notify_thread_struct *thread_struct = NULL; + + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "GENA BEGIN INITIAL NOTIFY EXT" ); ++ "GENA BEGIN INITIAL NOTIFY EXT\n" ); + reference_count = ( int * )malloc( sizeof( int ) ); + + if( reference_count == NULL ) { +@@ -724,7 +724,7 @@ + return GENA_E_BAD_SID; + } + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "FOUND SUBSCRIPTION IN INIT NOTIFY EXT: SID %s", sid ); ++ "FOUND SUBSCRIPTION IN INIT NOTIFY EXT: SID %s\n", sid ); + + sub->active = 1; + +@@ -738,7 +738,7 @@ + } + + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "GENERATED PROPERTY SET IN INIT EXT NOTIFY: %s", ++ "GENERATED PROPERTY SET IN INIT EXT NOTIFY: %s\n", + propertySet ); + + headers_size = strlen( "CONTENT-TYPE text/xml\r\n" ) + +@@ -1369,7 +1369,7 @@ + } + + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "Subscription Request: Number of Subscriptions already %d\n " ++ "Subscription Request: Number of Subscriptions already %d, " + "Max Subscriptions allowed: %d\n", + service->TotalSubscriptions, + handle_info->MaxSubscriptions ); +@@ -1546,7 +1546,7 @@ + } + + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "Renew request: Number of subscriptions already: %d\n " ++ "Renew request: Number of subscriptions already: %d, " + "Max Subscriptions allowed:%d\n", + service->TotalSubscriptions, + handle_info->MaxSubscriptions ); +Index: libupnp-1.6.6-5/upnp/src/soap/soap_device.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/soap/soap_device.c 2010-05-14 16:28:14.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/soap/soap_device.c 2010-05-14 16:28:37.000000000 +0100 +@@ -345,7 +345,7 @@ + IXML_NodeList *nl = NULL; + + UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__, +- "get_action_node(): node name =%s\n ", NodeName ); ++ "get_action_node(): node name =%s\n", NodeName ); + + *RespNode = NULL; + +Index: libupnp-1.6.6-5/upnp/src/genlib/net/http/httpreadwrite.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/genlib/net/http/httpreadwrite.c 2010-05-14 16:28:14.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/genlib/net/http/httpreadwrite.c 2010-05-14 16:28:37.000000000 +0100 +@@ -243,7 +243,6 @@ + UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__, + "<<< (RECVD) <<<\n%s\n-----------------\n", + parser->msg.msg.buf ); +- print_http_headers( &parser->msg ); + + if( parser->content_length > + ( unsigned int )g_maxContentLength ) { +@@ -267,7 +266,6 @@ + UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__, + "<<< (RECVD) <<<\n%s\n-----------------\n", + parser->msg.msg.buf ); +- print_http_headers( &parser->msg ); + + return 0; + } else { +@@ -656,7 +654,6 @@ + } + + UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__, "Response\n" ); +- print_http_headers( &response.msg ); + + // optional content-type + if( content_type ) { +@@ -1809,7 +1806,7 @@ + // C string + s = ( char * )va_arg( argp, char * ); + assert( s ); +- UpnpPrintf(UPNP_ALL,HTTP,__FILE__,__LINE__,"Adding a string : %s\n", s); ++ /* UpnpPrintf(UPNP_ALL,HTTP,__FILE__,__LINE__,"Adding a string : %s\n", s); */ + if( membuffer_append( buf, s, strlen( s ) ) != 0 ) { + goto error_handler; + } +@@ -1836,8 +1833,8 @@ + // mem buffer + s = ( char * )va_arg( argp, char * ); + +- UpnpPrintf(UPNP_ALL,HTTP,__FILE__,__LINE__, +- "Adding a char Buffer starting with: %c\n", s[0]); ++ /* UpnpPrintf(UPNP_ALL,HTTP,__FILE__,__LINE__, ++ "Adding a char Buffer starting with: %c\n", s[0]); */ + assert( s ); + length = ( size_t ) va_arg( argp, size_t ); + if( membuffer_append( buf, s, length ) != 0 ) { +Index: libupnp-1.6.6-5/upnp/src/genlib/net/http/webserver.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/genlib/net/http/webserver.c 2010-05-14 16:28:14.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/genlib/net/http/webserver.c 2010-05-14 16:28:37.000000000 +0100 +@@ -1208,8 +1208,6 @@ + size_t dummy; + struct UpnpVirtualDirCallbacks *pVirtualDirCallback; + +- print_http_headers( req ); +- + url = &req->uri; + assert( req->method == HTTPMETHOD_GET || + req->method == HTTPMETHOD_HEAD +@@ -1587,7 +1585,6 @@ + UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__, + "<<< (RECVD) <<<\n%s\n-----------------\n", + parser->msg.msg.buf ); +- print_http_headers( &parser->msg ); + parser->position = POS_COMPLETE; + } else { + // partial msg +Index: libupnp-1.6.6-5/upnp/src/inc/httpparser.h +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/inc/httpparser.h 2010-05-14 16:28:14.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/inc/httpparser.h 2010-05-14 16:28:37.000000000 +0100 +@@ -477,23 +477,6 @@ + ************************************************************************/ + const char* method_to_str( IN http_method_t method ); + +-/************************************************************************ +-* Function: print_http_headers +-* +-* Parameters: +-* http_message_t* hmsg ; HTTP Message object +-* +-* Description: +-* +-* Returns: +-* void +-************************************************************************/ +-#ifdef DEBUG +-void print_http_headers( IN http_message_t *hmsg ); +-#else +-static UPNP_INLINE void print_http_headers( IN http_message_t *hmsg ) {} +-#endif +- + #ifdef __cplusplus + } // extern "C" + #endif // __cplusplus +Index: libupnp-1.6.6-5/upnp/src/ssdp/ssdp_server.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/ssdp/ssdp_server.c 2010-05-14 16:28:37.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/ssdp/ssdp_server.c 2010-05-14 16:28:37.000000000 +0100 +@@ -137,11 +137,11 @@ + /* parse the device list and send advertisements/replies */ + for (i = 0;; i++) { + UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, +- "Entering new device list with i = %d\n\n", i); ++ "Entering new device list with i = %d\n", i); + tmpNode = ixmlNodeList_item(SInfo->DeviceList, i); + if (!tmpNode) { + UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, +- "Exiting new device list with i = %d\n\n", i); ++ "Exiting new device list with i = %d\n", i); + break; + } + dbgStr = ixmlNode_getNodeName(tmpNode); --- libupnp-1.6.6.orig/debian/patches/0001-Security-fix-for-CERT-issue-VU-922681.patch +++ libupnp-1.6.6/debian/patches/0001-Security-fix-for-CERT-issue-VU-922681.patch @@ -0,0 +1,105 @@ +Fix for VU#922681 + +This includes fix for various CVEs by more or less backporting the whole unique_service_name() function from 1.6.18. + +CVE-2012-5961 Issue #1: Stack buffer overflow of Evt->UDN +CVE-2012-5958 Issue #2: Stack buffer overflow of Tempbuf +CVE-2012-5962 Issue #3: Stack buffer overflow of Evt->DeviceType +CVE-2012-5959 Issue #4: Stack buffer overflow of Event->UDN +CVE-2012-5960 Issue #8: Stack buffer overflow of Event->UDN +CVE-2012-5963 Issue #5: Stack buffer overflow of Event->UDN +CVE-2012-5964 Issue #6: Stack buffer overflow of Event->DeviceType +CVE-2012-5965 Issue #7: Stack buffer overflow of Event->DeviceType + +--- a/upnp/src/ssdp/ssdp_server.c ++++ b/upnp/src/ssdp/ssdp_server.c +@@ -412,7 +412,7 @@ int unique_service_name(IN char *cmd, IN + char *ptr2 = NULL; + char *ptr3 = NULL; + int CommandFound = 0; +- int length = 0; ++ size_t n = (size_t)0; + + if( ( TempPtr = strstr( cmd, "uuid:schemas" ) ) != NULL ) { + ptr1 = strstr( cmd, ":device" ); +@@ -429,16 +429,23 @@ int unique_service_name(IN char *cmd, IN + } + + if( ptr3 != NULL ) { +- sprintf( Evt->UDN, "uuid:%s", ptr3 + 1 ); ++ if (strlen("uuid:") + strlen(ptr3 + 1) >= sizeof Evt->UDN) ++ return -1; ++ snprintf(Evt->UDN, sizeof Evt->UDN, "uuid:%s", ptr3 + 1); + } else { + return -1; + } + + ptr1 = strstr( cmd, ":" ); + if( ptr1 != NULL ) { +- strncpy( TempBuf, ptr1, ptr3 - ptr1 ); +- TempBuf[ptr3 - ptr1] = '\0'; +- sprintf( Evt->DeviceType, "urn%s", TempBuf ); ++ n = (size_t)ptr3 - (size_t)ptr1; ++ n = n >= sizeof TempBuf ? sizeof TempBuf - 1 : n; ++ strncpy(TempBuf, ptr1, n); ++ TempBuf[n] = '\0'; ++ if (strlen("urn") + strlen(TempBuf) >= sizeof(Evt->DeviceType)) ++ return -1; ++ snprintf(Evt->DeviceType, sizeof(Evt->DeviceType), ++ "urn%s", TempBuf); + } else { + return -1; + } +@@ -447,10 +454,13 @@ int unique_service_name(IN char *cmd, IN + + if( ( TempPtr = strstr( cmd, "uuid" ) ) != NULL ) { + if( ( Ptr = strstr( cmd, "::" ) ) != NULL ) { +- strncpy( Evt->UDN, TempPtr, Ptr - TempPtr ); +- Evt->UDN[Ptr - TempPtr] = '\0'; ++ n = (size_t)Ptr - (size_t)TempPtr; ++ n = n >= sizeof Evt->UDN ? sizeof Evt->UDN - 1 : n; ++ strncpy(Evt->UDN, TempPtr, n); ++ Evt->UDN[n] = '\0'; + } else { +- strcpy( Evt->UDN, TempPtr ); ++ memset(Evt->UDN, 0, sizeof(Evt->UDN)); ++ strncpy(Evt->UDN, TempPtr, sizeof Evt->UDN - 1); + } + CommandFound = 1; + } +@@ -458,7 +468,9 @@ int unique_service_name(IN char *cmd, IN + if( strstr( cmd, "urn:" ) != NULL + && strstr( cmd, ":service:" ) != NULL ) { + if( ( TempPtr = strstr( cmd, "urn" ) ) != NULL ) { +- strcpy( Evt->ServiceType, TempPtr ); ++ memset(Evt->ServiceType, 0, sizeof Evt->ServiceType); ++ strncpy(Evt->ServiceType, TempPtr, ++ sizeof Evt->ServiceType - 1); + CommandFound = 1; + } + } +@@ -466,7 +478,9 @@ int unique_service_name(IN char *cmd, IN + if( strstr( cmd, "urn:" ) != NULL + && strstr( cmd, ":device:" ) != NULL ) { + if( ( TempPtr = strstr( cmd, "urn" ) ) != NULL ) { +- strcpy( Evt->DeviceType, TempPtr ); ++ memset(Evt->DeviceType, 0, sizeof Evt->DeviceType); ++ strncpy(Evt->DeviceType, TempPtr, ++ sizeof Evt->DeviceType - 1); + CommandFound = 1; + } + } +@@ -474,9 +488,10 @@ int unique_service_name(IN char *cmd, IN + if( ( TempPtr = strstr( cmd, "::upnp:rootdevice" ) ) != NULL ) { + /* Everything before "::upnp::rootdevice" is the UDN. */ + if( TempPtr != cmd ) { +- length = TempPtr - cmd; +- strncpy(Evt->UDN, cmd, length); +- Evt->UDN[length] = 0; ++ n = (size_t)TempPtr - (size_t)cmd; ++ n = n >= sizeof Evt->UDN ? sizeof Evt->UDN - 1 : n; ++ strncpy(Evt->UDN, cmd, n); ++ Evt->UDN[n] = 0; + CommandFound = 1; + } + } --- libupnp-1.6.6.orig/debian/patches/07-spelling.patch +++ libupnp-1.6.6/debian/patches/07-spelling.patch @@ -0,0 +1,25 @@ +Description: Shut up lintian about trivial spelling error +Author: Nick Leverton + +Index: libupnp-1.6.6-5/upnp/src/gena/gena_device.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/gena/gena_device.c 2010-05-14 16:28:19.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/gena/gena_device.c 2010-05-14 16:28:49.000000000 +0100 +@@ -553,7 +553,7 @@ + } + + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "GENERATED PROPERY SET IN INIT NOTIFY: \n'%s'\n", ++ "GENERATED PROPERTY SET IN INIT NOTIFY: \n'%s'\n", + propertySet ); + + headers_size = strlen( "CONTENT-TYPE text/xml\r\n" ) + +@@ -738,7 +738,7 @@ + } + + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, +- "GENERATED PROPERY SET IN INIT EXT NOTIFY: %s", ++ "GENERATED PROPERTY SET IN INIT EXT NOTIFY: %s", + propertySet ); + + headers_size = strlen( "CONTENT-TYPE text/xml\r\n" ) + --- libupnp-1.6.6.orig/debian/patches/libupnp-1.6.6-r496.patch +++ libupnp-1.6.6/debian/patches/libupnp-1.6.6-r496.patch @@ -0,0 +1,51 @@ +Description: Update ErrorMessages for latest return code list +Bug: https://sourceforge.net/support/tracker.php?aid=2970872 + +Index: libupnp-1.6.6-5/upnp/src/api/upnptools.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/api/upnptools.c 2010-05-14 16:28:37.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/api/upnptools.c 2010-05-14 16:28:37.000000000 +0100 +@@ -55,7 +55,7 @@ + {UPNP_E_INVALID_PARAM, "UPNP_E_INVALID_PARAM"}, + {UPNP_E_OUTOF_HANDLE, "UPNP_E_OUTOF_HANDLE"}, + {UPNP_E_OUTOF_CONTEXT, "UPNP_E_OUTOF_CONTEXT"}, +-{UPNP_E_OUTOF_MEMORY, "UPNP_E_OUTOF_MEMOR"}, ++{UPNP_E_OUTOF_MEMORY, "UPNP_E_OUTOF_MEMORY"}, + {UPNP_E_INIT, "UPNP_E_INIT"}, + {UPNP_E_BUFFER_TOO_SMALL, "UPNP_E_BUFFER_TOO_SMALL"}, + {UPNP_E_INVALID_DESC, "UPNP_E_INVALID_DESC"}, +@@ -68,7 +68,9 @@ + {UPNP_E_INVALID_ACTION, "UPNP_E_INVALID_ACTION"}, + {UPNP_E_FINISH, "UPNP_E_FINISH"}, + {UPNP_E_INIT_FAILED, "UPNP_E_INIT_FAILED"}, ++{UPNP_E_URL_TOO_BIG, "UPNP_E_URL_TOO_BIG"}, + {UPNP_E_BAD_HTTPMSG, "UPNP_E_BAD_HTTPMSG"}, ++{UPNP_E_ALREADY_REGISTERED, "UPNP_E_ALREADY_REGISTERED"}, + {UPNP_E_NETWORK_ERROR, "UPNP_E_NETWORK_ERROR"}, + {UPNP_E_SOCKET_WRITE, "UPNP_E_SOCKET_WRITE"}, + {UPNP_E_SOCKET_READ, "UPNP_E_SOCKET_READ"}, +@@ -76,13 +78,22 @@ + {UPNP_E_SOCKET_CONNECT, "UPNP_E_SOCKET_CONNECT"}, + {UPNP_E_OUTOF_SOCKET, "UPNP_E_OUTOF_SOCKET"}, + {UPNP_E_LISTEN, "UPNP_E_LISTEN"}, ++{UPNP_E_TIMEDOUT, "UPNP_E_TIMEDOUT"}, ++{UPNP_E_SOCKET_ERROR, "UPNP_E_SOCKET_ERROR"}, ++{UPNP_E_FILE_WRITE_ERROR, "UPNP_E_FILE_WRITE_ERROR"}, ++{UPNP_E_CANCELED, "UPNP_E_CANCELED"}, + {UPNP_E_EVENT_PROTOCOL, "UPNP_E_EVENT_PROTOCOL"}, + {UPNP_E_SUBSCRIBE_UNACCEPTED, "UPNP_E_SUBSCRIBE_UNACCEPTED"}, + {UPNP_E_UNSUBSCRIBE_UNACCEPTED, "UPNP_E_UNSUBSCRIBE_UNACCEPTED"}, + {UPNP_E_NOTIFY_UNACCEPTED, "UPNP_E_NOTIFY_UNACCEPTED"}, +-{UPNP_E_INTERNAL_ERROR, "UPNP_E_INTERNAL_ERROR"}, + {UPNP_E_INVALID_ARGUMENT, "UPNP_E_INVALID_ARGUMENT"}, +-{UPNP_E_OUTOF_BOUNDS, "UPNP_E_OUTOF_BOUNDS"} ++{UPNP_E_FILE_NOT_FOUND, "UPNP_E_FILE_NOT_FOUND"}, ++{UPNP_E_FILE_READ_ERROR, "UPNP_E_FILE_READ_ERROR"}, ++{UPNP_E_EXT_NOT_XML, "UPNP_E_EXT_NOT_XML"}, ++{UPNP_E_NO_WEB_SERVER, "UPNP_E_NO_WEB_SERVER"}, ++{UPNP_E_OUTOF_BOUNDS, "UPNP_E_OUTOF_BOUNDS"}, ++{UPNP_E_NOT_FOUND, "UPNP_E_NOT_FOUND"}, ++{UPNP_E_INTERNAL_ERROR, "UPNP_E_INTERNAL_ERROR"}, + }; + + /************************************************************************ --- libupnp-1.6.6.orig/debian/patches/libupnp-1.6.6-r533.patch +++ libupnp-1.6.6/debian/patches/libupnp-1.6.6-r533.patch @@ -0,0 +1,26 @@ +=== upnp/src/gena/gena_ctrlpt.c +================================================================== +--- upnp/src/gena/gena_ctrlpt.c (revision 3391) ++++ upnp/src/gena/gena_ctrlpt.c (revision 3392) +@@ -80,6 +80,7 @@ + eventType = UPNP_EVENT_SUBSCRIPTION_EXPIRED; + } else { + UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, "GENA AUTO RENEW"); ++ timeout = sub_struct->TimeOut; + errCode = genaRenewSubscription( + event->handle, + sub_struct->Sid, +=== ChangeLog +================================================================== +--- ChangeLog (revision 3391) ++++ ChangeLog (revision 3392) +@@ -2,6 +2,9 @@ + Version 1.6.7 + ******************************************************************************* + ++2010-03-27 Nick Leverton ++ Subscription auto-renewals copy the renewal time from old subscription. ++ + 2010-03-27 Marcelo Jimenez + Backport of svn revision 527: + * Added API to ithread, created the following functions: --- libupnp-1.6.6.orig/debian/patches/06-patch-statevar-query.patch +++ libupnp-1.6.6/debian/patches/06-patch-statevar-query.patch @@ -0,0 +1,17 @@ +Description: Fix missing CRNL in "Deprecated Get Variable Request" response. +Bug: https://sourceforge.net/support/tracker.php?aid=2546532 +Origin: other, https://sourceforge.net/tracker/download.php?group_id=166957&atid=841028&file_id=311177&aid=2546532 + +Index: libupnp-1.6.6-5/upnp/src/soap/soap_ctrlpt.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/soap/soap_ctrlpt.c 2010-05-14 16:28:20.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/soap/soap_ctrlpt.c 2010-05-14 16:28:50.000000000 +0100 +@@ -931,7 +931,7 @@ + content_length = strlen( xml_start ) + strlen( var_name ) + strlen( xml_end ); + if (http_MakeMessage( + &request, 1, 1, +- "Q" "sbc" "N" "s" "s" "Ucc" "sss", ++ "Q" "sbc" "N" "s" "sc" "Ucc" "sss", + SOAPMETHOD_POST, path.buf, path.length, + "HOST: ", host.buf, host.length, + content_length, --- libupnp-1.6.6.orig/debian/patches/10-renewals-sid.patch +++ libupnp-1.6.6/debian/patches/10-renewals-sid.patch @@ -0,0 +1,15 @@ +Description: Fix auto-renewals to send the correct timeout +Author: Nick Leverton + +Index: libupnp-1.6.6-5/upnp/src/gena/gena_ctrlpt.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/gena/gena_ctrlpt.c 2008-02-10 01:55:34.000000000 +0000 ++++ libupnp-1.6.6-5/upnp/src/gena/gena_ctrlpt.c 2010-04-25 22:25:51.000000000 +0100 +@@ -80,6 +80,7 @@ + } else { + UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, + "GENA AUTO RENEW" ); ++ timeout = sub_struct->TimeOut; + if( ( ( sub_struct->ErrCode = genaRenewSubscription( event->handle, + sub_struct-> + Sid, --- libupnp-1.6.6.orig/debian/patches/libupnp-1.6.6-bsd-like-kernel.patch +++ libupnp-1.6.6/debian/patches/libupnp-1.6.6-bsd-like-kernel.patch @@ -0,0 +1,29 @@ +Description: Debian Gnu/kFreeBSD doesn't #define BSD, so we need to + explicitly test for __FreeBSD_kernel__ when deciding what sort of + interface structures we have. +From: Nick Leverton +Bug-Debian: http://bugs.debian.org/573321 +Bug-Debian: http://bugs.debian.org/573319 + +Index: libupnp-1.6.6-5/upnp/src/api/upnpapi.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/api/upnpapi.c 2010-05-14 16:28:18.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/api/upnpapi.c 2010-05-14 16:28:37.000000000 +0100 +@@ -59,7 +59,7 @@ + #if defined(_sun) + #include + #include +- #elif defined(BSD) && BSD >= 199306 ++ #elif defined(BSD) && BSD >= 199306 || defined(__FreeBSD_kernel__) + #include + #endif + #endif /* WIN32 */ +@@ -3738,7 +3738,7 @@ + strcpy( out, inet_ntoa(LocalAddr.sin_addr)); + } + return UPNP_E_SUCCESS; +-#elif (defined(BSD) && BSD >= 199306) ++#elif (defined(BSD) && BSD >= 199306) || defined(__FreeBSD_kernel__) + struct ifaddrs *ifap, *ifa; + + if (getifaddrs(&ifap) != 0) { --- libupnp-1.6.6.orig/debian/patches/14-upstream-reuseaddr-bind-port.patch +++ libupnp-1.6.6/debian/patches/14-upstream-reuseaddr-bind-port.patch @@ -0,0 +1,15 @@ +Description: reuseaddr option fails as the listen port is not set. +Bug: https://sourceforge.net/support/tracker.php?aid=2995758 + +Index: libupnp-1.6.6-5/upnp/src/genlib/miniserver/miniserver.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/genlib/miniserver/miniserver.c 2010-05-14 16:28:37.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/genlib/miniserver/miniserver.c 2010-05-14 16:28:37.000000000 +0100 +@@ -593,6 +593,7 @@ + return UPNP_E_SOCKET_BIND; + } + ++ serverAddr.sin_port = htons( listen_port ); + sockError = bind( listenfd, (struct sockaddr *)&serverAddr, + sizeof (struct sockaddr) ); + } else { --- libupnp-1.6.6.orig/debian/patches/12-debian-always-debug.patch +++ libupnp-1.6.6/debian/patches/12-debian-always-debug.patch @@ -0,0 +1,20 @@ +Description: Don't write debug files by default if debug is compiled in. +Author: Nick Leverton + +Index: libupnp-1.6.6-5/upnp/src/api/upnpdebug.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/api/upnpdebug.c 2010-05-14 16:28:37.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/api/upnpdebug.c 2010-05-14 16:28:37.000000000 +0100 +@@ -54,10 +54,10 @@ + static FILE *InfoFileHnd = NULL; + + //Name of the error file +-static const char *errFileName = strdup("IUpnpErrFile.txt"); ++static const char *errFileName = NULL; + + //Name of the info file +-static const char *infoFileName = strdup("IUpnpInfoFile.txt"); ++static const char *infoFileName = NULL; + + + --- libupnp-1.6.6.orig/debian/patches/series +++ libupnp-1.6.6/debian/patches/series @@ -0,0 +1,18 @@ +01-debian-md5-licence.patch +03-fix-duplicate-entries +06-debian-kfreebsd.patch +06-patch-statevar-query.patch +07-spelling.patch +libupnp-1.6.6-scheduling-eperm.patch +libupnp-1.6.6-bsd-bind-ports.patch +libupnp-1.6.6-bsd-like-kernel.patch +libupnp-1.6.6-r466.patch +libupnp-1.6.6-r486.patch +libupnp-1.6.6-r496.patch +libupnp-1.6.6-r515.patch +libupnp-1.6.6-r518.patch +14-upstream-reuseaddr-bind-port.patch +07-neaten-debug.patch +12-debian-always-debug.patch +16-pkgconfig-link-with-pthreads.patch +0001-Security-fix-for-CERT-issue-VU-922681.patch --- libupnp-1.6.6.orig/debian/patches/libupnp-1.6.6-scheduling-eperm.patch +++ libupnp-1.6.6/debian/patches/libupnp-1.6.6-scheduling-eperm.patch @@ -0,0 +1,49 @@ +Description: Fix FTBFS on GNU/kfreeBSD (scheduling permissions) +Bug-Debian: http://bugs.debian.org/573319 +Author: Nick Leverton + +Index: libupnp-1.6.6-5/threadutil/src/ThreadPool.c +=================================================================== +--- libupnp-1.6.6-5.orig/threadutil/src/ThreadPool.c 2010-05-14 16:28:37.000000000 +0100 ++++ libupnp-1.6.6-5/threadutil/src/ThreadPool.c 2010-05-14 16:28:50.000000000 +0100 +@@ -218,7 +218,7 @@ + * Sets the scheduling policy of the current process. + * Internal only. + * Parameters: +- * PolocyType in ++ * PolicyType in + * Returns: + * 0 on success, nonzero on failure + * Returns result of GetLastError() on failure. +@@ -236,10 +236,12 @@ + return sched_setscheduler( 0, in ); + #elif defined(_POSIX_PRIORITY_SCHEDULING) && _POSIX_PRIORITY_SCHEDULING > 0 + struct sched_param current; ++ int sched_result; + + sched_getparam( 0, ¤t ); + current.sched_priority = DEFAULT_SCHED_PARAM; +- return sched_setscheduler( 0, in, ¤t ); ++ sched_result = sched_setscheduler( 0, in, ¤t ); ++ return (0 == sched_result || EPERM == errno) ? 0 : errno; + #else + return 0; + #endif +@@ -268,6 +270,7 @@ + int actPriority = 0; + int midPriority = 0; + struct sched_param newPriority; ++ int sched_result; + + pthread_getschedparam( ithread_self(), ¤tPolicy, &newPriority ); + minPriority = sched_get_priority_min( currentPolicy ); +@@ -289,7 +292,8 @@ + + newPriority.sched_priority = actPriority; + +- return pthread_setschedparam(ithread_self(), currentPolicy, &newPriority ); ++ sched_result = pthread_setschedparam(ithread_self(), currentPolicy, &newPriority ); ++ return (0 == sched_result || EPERM == errno) ? 0 : errno; + #else + return 0; + #endif --- libupnp-1.6.6.orig/debian/patches/06-debian-kfreebsd.patch +++ libupnp-1.6.6/debian/patches/06-debian-kfreebsd.patch @@ -0,0 +1,16 @@ +Description: Fix FTBFS on GNU/kfreeBSD +Bug-Debian: http://bugs.debian.org/543068 + +Index: libupnp-1.6.6-5/threadutil/src/ThreadPool.c +=================================================================== +--- libupnp-1.6.6-5.orig/threadutil/src/ThreadPool.c 2010-05-14 16:28:20.000000000 +0100 ++++ libupnp-1.6.6-5/threadutil/src/ThreadPool.c 2010-05-14 16:28:51.000000000 +0100 +@@ -391,7 +391,7 @@ + srand( ( unsigned int )t.tv_usec + (unsigned int)ithread_get_current_thread_id().p ); + #elif defined(__FreeBSD__) || defined(__OSX__) || defined(__APPLE__) + srand( ( unsigned int )t.tv_usec + (unsigned int)ithread_get_current_thread_id() ); +-#elif defined(__linux__) || defined(__sun) ++#elif defined(__linux__) || defined(__sun) || defined(__GLIBC__) + srand( ( unsigned int )t.tv_usec + ithread_get_current_thread_id() ); + #else + { --- libupnp-1.6.6.orig/debian/patches/libupnp-1.6.6-bsd-bind-ports.patch +++ libupnp-1.6.6/debian/patches/libupnp-1.6.6-bsd-bind-ports.patch @@ -0,0 +1,46 @@ +Description: Fix FTBFS on GNU/kfreeBSD (bind ports pickiness) +Bug-Debian: http://bugs.debian.org/573319 +Author: Nick Leverton + +Index: libupnp-1.6.6-5/upnp/src/genlib/miniserver/miniserver.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/genlib/miniserver/miniserver.c 2010-05-14 16:28:19.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/genlib/miniserver/miniserver.c 2010-05-14 16:28:49.000000000 +0100 +@@ -594,12 +594,13 @@ + } + + sockError = bind( listenfd, (struct sockaddr *)&serverAddr, +- sizeof (struct sockaddr_in) ); ++ sizeof (struct sockaddr) ); + } else { ++ unsigned short orig_listen_port = listen_port; + do { + serverAddr.sin_port = htons( listen_port++ ); + sockError = bind( listenfd, (struct sockaddr *)&serverAddr, +- sizeof (struct sockaddr_in) ); ++ sizeof (struct sockaddr) ); + if ( sockError == -1 ) { + #ifdef WIN32 + errCode = WSAGetLastError(); +@@ -612,7 +613,7 @@ + } else + errCode = 0; + +- } while ( errCode != 0 ); ++ } while ( errCode != 0 && (listen_port >= orig_listen_port) ); + } + + if ( sockError == -1 ) { +Index: libupnp-1.6.6-5/upnp/src/ssdp/ssdp_server.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/ssdp/ssdp_server.c 2010-05-14 16:28:18.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/ssdp/ssdp_server.c 2010-05-14 16:28:49.000000000 +0100 +@@ -936,7 +936,7 @@ + // ssdpAddr.sin_addr.s_addr = inet_addr(LOCAL_HOST); + ssdpAddr.sin_addr.s_addr = htonl( INADDR_ANY ); + ssdpAddr.sin_port = htons( SSDP_PORT ); +- ret = bind( ssdpSock, (struct sockaddr *)&ssdpAddr, sizeof (ssdpAddr) ); ++ ret = bind( ssdpSock, (struct sockaddr *)&ssdpAddr, sizeof (struct sockaddr) ); + if ( ret == -1 ) { + strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN); + UpnpPrintf( UPNP_CRITICAL, SSDP, __FILE__, __LINE__, --- libupnp-1.6.6.orig/debian/patches/libupnp-1.6.6-r486.patch +++ libupnp-1.6.6/debian/patches/libupnp-1.6.6-r486.patch @@ -0,0 +1,258 @@ +Description: parameter problem fixed in soap_request_and_response(), + 2nd call to http_RequestAndResponse() was wrong (thanks to Kim Kyungsan) +Author: Oxygenic + +=== upnp/src/soap/soap_ctrlpt.c +================================================================== +Index: libupnp-1.6.6-5/upnp/src/soap/soap_ctrlpt.c +=================================================================== +--- libupnp-1.6.6-5.orig/upnp/src/soap/soap_ctrlpt.c 2010-05-14 16:28:37.000000000 +0100 ++++ libupnp-1.6.6-5/upnp/src/soap/soap_ctrlpt.c 2010-05-14 16:28:37.000000000 +0100 +@@ -368,8 +368,9 @@ + + // try again + ret_code = http_RequestAndResponse( destination_url, request->buf, ++ request->length, + HTTPMETHOD_MPOST, +- request->length, UPNP_TIMEOUT, ++ UPNP_TIMEOUT, + response ); + if( ret_code != 0 ) { + httpmsg_destroy( &response->msg ); +Index: libupnp-1.6.6-5/ChangeLog +=================================================================== +--- libupnp-1.6.6-5.orig/ChangeLog 2010-05-14 16:28:17.000000000 +0100 ++++ libupnp-1.6.6-5/ChangeLog 2010-05-14 16:28:37.000000000 +0100 +@@ -219,7 +219,7 @@ + handle accordingly. + + 2007-08-05 Marcelo Jimenez +- * Merge of Mac OS X patch from Stéphane Corthésy (davelopper), ++ * Merge of Mac OS X patch from Stéphane Corthésy (davelopper), + SF Bug Tracker [ 1686420 ] Modifications for MacOSX. + Some of the proposed changes were already done by Rene Hexel's patch. + +@@ -643,14 +643,14 @@ + FORK FROM DEAD libupnp + ******************************************************************************* + +-2006-04-29 Rémi Turboult ++2006-04-29 Rémi Turboult + + * THANKS: new file with list of contributors + + * upnp/src/gena/gena_device.c (respond_ok): add 'Content-Length: 0' + in subscription response. Patch by Chaos (Bug # 1455367). + +-2006-04-08 Rémi Turboult ++2006-04-08 Rémi Turboult + + * upnp/doc/UPnP_Programming_Guide.pdf: replace this document with + the one in libupnp-doc-1.2.1 because current CVS version +@@ -661,20 +661,20 @@ + * changes applied to several files to work under Sparc Solaris, temporarily + requiring a define SPARC_SOLARIS + +-2006-04-03 Rémi Turboult ++2006-04-03 Rémi Turboult + + * upnp/Makefile.am: install upnp samples in $(docdir)/examples + +-2006-03-28 Rémi Turboult ++2006-03-28 Rémi Turboult + + * configure.ac: add --with-docdir option to choose where documentation + is installed (or -without-docdir to not install the documentation) + +-2006-03-27 Rémi Turboult ++2006-03-27 Rémi Turboult + + * ixml/test: add simple test suite for xml parser + +-2006-03-26 Rémi Turboult ++2006-03-26 Rémi Turboult + + * ixml/src/ixmlparser.c (Parser_processCDSect): fix bug which prevents + CDATA sections which contain a 0 (zero) to be parsed (instead the +@@ -685,18 +685,18 @@ + option, and move samples compilation from check_PROGRAMS to + noinst_PROGRAMS + +-2006-03-25 Rémi Turboult ++2006-03-25 Rémi Turboult + + * upnp/src/genlib/miniserver/miniserver.c (get_miniserver_sockets): + fix bug if new socket created has fd 0 (can only occur when stdin + has been closed). Patch by Oskar Liljeblad 2004-07-02 : + http://sourceforge.net/mailarchive/message.php?msg_id=8870528 + +-2006-03-21 Rémi Turboult ++2006-03-21 Rémi Turboult + + * upnp/test/test_init.c: add some version checks and exit if failure + +-2006-03-05 Rémi Turboult ++2006-03-05 Rémi Turboult + + * libupnp version 1.3.1 + +@@ -711,11 +711,11 @@ + dependencies between upnp and ixml / threadutil, so that programs + linking against upnp only still work. + +-2006-03-04 Rémi Turboult ++2006-03-04 Rémi Turboult + + * libupnp version 1.3.0 + +-2006-03-03 Rémi Turboult ++2006-03-03 Rémi Turboult + + * upnp/src/genlib/net/http/httpreadwrite.c (get_sdk_info): use + package version string from configure to set sdk info +@@ -723,7 +723,7 @@ + * upnp/Makefile.am: add sample/tvdevice/web/ files in EXTRA_DIST + + do not distribute generated upnpconfig.h file. + +-2006-02-28 Rémi Turboult ++2006-02-28 Rémi Turboult + + * upnp/src/inc/config.h, configure.ac: use only new defines + UPNP_HAVE_xx instead of INCLUDE_yyy_APIS and INTERNAL_WEB_SERVER +@@ -732,7 +732,7 @@ + the librarie LDFLAGS in order to export only the symbols defined + in the API + +-2006-02-27 Rémi Turboult ++2006-02-27 Rémi Turboult + + * configure.ac: add libtool versions for the 3 libraries + +@@ -740,7 +740,7 @@ + + * threadutil/src/ThreadPool.c (SetSeed): add missing 'static' + +-2006-02-26 Rémi Turboult ++2006-02-26 Rémi Turboult + + * threadutil/inc/iasnprintf.h: add gcc __printf__ format attribute + to "iasnprintf" +@@ -761,11 +761,11 @@ + the configuration of the installed libraries (generates installed + file ) + +-2006-02-22 Rémi Turboult ++2006-02-22 Rémi Turboult + + * upnp/ : add missing include of config.h in some .c files + +-2006-02-21 Rémi Turboult ++2006-02-21 Rémi Turboult + + * upnp/inc/upnp.h: move some definitions which should not be + exported into "upnp/src/inc/util.h" +@@ -773,12 +773,12 @@ + * import all modifications below from libupnp in djmount 0.51 + into official libupnp + +-2006-01-17 Rémi Turboult ++2006-01-17 Rémi Turboult + + * threadutil/Makefile.am (libthreadutil_la_SOURCES): remove extraneous + file + +-2006-01-15 Rémi Turboult ++2006-01-15 Rémi Turboult + + * configure.ac: add checks for large-file support + +@@ -798,53 +798,53 @@ + * ixml/src/node.c (ixmlNode_getNodeType): fix compilation warning + on const return type + +-2006-01-12 Rémi Turboult ++2006-01-12 Rémi Turboult + + * upnp/src/inc/readwrite.h : suppress unused C++ header file + +-2006-01-11 Rémi Turboult ++2006-01-11 Rémi Turboult + + * upnp/inc/config.h, upnp/src/inc/upnpapi.h, + upnp/src/inc/httpreadwrite.h: remove internal configuration variable + MINIMUM_DELAY (no clear purpose) + +-2005-12-05 Rémi Turboult ++2005-12-05 Rémi Turboult + + * upnp/inc/upnp.h: re-declare obsolete method UpnpSetContentLength, + for binary compatibility with previous libupnp version. + + * upnp/src/api/upnpapi.c: correct type of g_maxContentLength to size_t + +-2005-11-01 Rémi Turboult ++2005-11-01 Rémi Turboult + + * autoconfiscate library : replace all makefiles by Makefile.am + for automake support, + preliminary autoconf support + (generated config.h not yet used in source files) + +-2005-10-18 Rémi Turboult ++2005-10-18 Rémi Turboult + + * upnp/src/makefile: fix location of DEBUG STATIC libupnp library + + * upnp/sample/tvctrlpt/linux/Makefile, + upnp/sample/tvdevice/linux/Makefile: fix STATIC library support + +-2005-10-16 Rémi Turboult ++2005-10-16 Rémi Turboult + + * threadutil/src/Makefile (clean): remove built library + +-2005-08-28 Rémi Turboult ++2005-08-28 Rémi Turboult + + * ixml/src/ixml.h, ixml/src/ixml.c (ixmlRelaxParser) : new function + + * ixml/src/ixmlparser.h, ixml/src/ixmlparser.c (Parser_setErrorChar) : + new function + +-2005-08-02 Rémi Turboult ++2005-08-02 Rémi Turboult + + * ixml/src/Makefile: correct bug for static library being incorrectly + stripped when building non-debug + +-2005-06-09 Rémi Turboult ++2005-06-09 Rémi Turboult + + * ixml/src/element.c (ixmlElement_removeAttributeNode): + remove some compilation warning +@@ -855,7 +855,7 @@ + * upnp/inc/upnptools.h, upnp/src/api/upnptools.c : + add missing const's in public API + +-2005-05-28 Rémi Turboult ++2005-05-28 Rémi Turboult + + * upnp/inc/config.h: suppress HTTP_READ_BYTES (unused) + and replace by DEFAULT_SOAP_CONTENT_LENGTH (previously in upnpapi.h) +@@ -876,7 +876,7 @@ + * upnp/src/genlib/net/http/httpreadwrite.c : corrected an incorrect + sprintf format + +-2005-05-27 Rémi Turboult ++2005-05-27 Rémi Turboult + + * upnp/makefile, upnp/src/makefile, + ixml/Makefile, ixml/src/Makefile, +@@ -884,7 +884,7 @@ + implement STATIC library support (from patch at + http://sourceforge.net/tracker/?group_id=7189&atid=307189 ) + +-2005-05-26 Rémi Turboult ++2005-05-26 Rémi Turboult + + * upnp/src/api/upnpapi.c, upnp/src/soap/soap_device.c, + upnp/src/soap/makefile : --- libupnp-1.6.6.orig/debian/patches/16-pkgconfig-link-with-pthreads.patch +++ libupnp-1.6.6/debian/patches/16-pkgconfig-link-with-pthreads.patch @@ -0,0 +1,20 @@ +Description: Add $PTHREAD_CFLAGS to libupnp.pc as assumed by {acx,ax}_pthread.m4 + /usr/share/doc/autoconf-archive/html/acx_pthread.html says: + "NOTE: You are assumed to not only compile your program with these flags, + but also link it with them as well. e.g. you should link with $PTHREAD_CC + $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS" +Author: Nick Leverton +Bug-Debian: http://bugs.debian.org/555386 + +Index: libupnp-1.6.6-5/libupnp.pc.in +=================================================================== +--- libupnp-1.6.6-5.orig/libupnp.pc.in 2008-02-10 01:55:39.000000000 +0000 ++++ libupnp-1.6.6-5/libupnp.pc.in 2010-05-14 13:42:36.000000000 +0100 +@@ -6,6 +6,6 @@ + Name: libupnp + Description: Linux SDK for UPnP Devices + Version: @VERSION@ +-Libs: @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml ++Libs: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml + Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp +