diff -Nru rtmpdump-2.4+20121230.gitdf6c518/debian/changelog rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/changelog --- rtmpdump-2.4+20121230.gitdf6c518/debian/changelog 2013-05-01 10:36:05.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/changelog 2015-02-01 09:51:50.000000000 +0000 @@ -1,3 +1,48 @@ +rtmpdump (2.4+20150114.gita107cef9b~trusty) trusty; urgency=medium + + * new version from git://git.ffmpeg.org/rtmpdump + + -- wsnipex Sun, 01 Feb 2015 09:51:37 +0100 + +rtmpdump (2.4+20131018.git79459a2-4) unstable; urgency=medium + + * librtmp-dev: Depend on nettle-dev (Closes: #755314) + + -- Reinhard Tartler Sat, 19 Jul 2014 20:27:37 -0400 + +rtmpdump (2.4+20131018.git79459a2-3) unstable; urgency=medium + + [ Andreas Metzler ] + * 02_gnutls_requires.private.diff: In pkg-config file move gnutls, hogweed, + and nettle from Requires to Requires.private. librtmp's headers do not + expose these libraries. + * Drop librtmp-dev dependency on libgnutls-dev and nettle-dev. + Closes: #745216 + + [ Reinhard Tartler ] + * Rebuild against libgnutls28-dev (Closes: #752297) + * debian/control: Update VCS fields + + -- Reinhard Tartler Sun, 22 Jun 2014 18:02:21 -0400 + +rtmpdump (2.4+20131018.git79459a2-2) unstable; urgency=low + + * Depends on libgmp-dev and nettle-dev to librtmpdev (Closes: #744242) + + -- Reinhard Tartler Fri, 11 Apr 2014 22:08:17 -0400 + +rtmpdump (2.4+20131018.git79459a2-1) unstable; urgency=low + + * Merge new upstream version (Closes: #731094, #743830) + - New upstream is claimed to fix segfault: Closes: #656693, #655038 + * Drop suggests on obsolete packages (Closes: #722584) + * Follow upstream's SONAME bump librtmp0->librtmp1. No API has been changed, + but is necessary because the layout of the RTMP struct was changed. + * Compile with hardening enabled + * Build depend on nettle-dev + + -- Reinhard Tartler Mon, 07 Apr 2014 21:15:22 -0400 + rtmpdump (2.4+20121230.gitdf6c518-1) unstable; urgency=low [ Reinhard Tartler ] diff -Nru rtmpdump-2.4+20121230.gitdf6c518/debian/control rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/control --- rtmpdump-2.4+20121230.gitdf6c518/debian/control 2013-05-01 10:36:05.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/control 2015-02-01 08:57:18.000000000 +0000 @@ -1,28 +1,24 @@ Source: rtmpdump Priority: extra Maintainer: Debian Multimedia Maintainers -Uploaders: - Reinhard Tartler , - Sebastian Dröge -Build-Depends: - debhelper (>= 8.1.3), - libgnutls-dev (>= 2.4.1) -Standards-Version: 3.9.2 +Uploaders: Reinhard Tartler , + Sebastian Dröge +Build-Depends: debhelper (>= 9~), libgnutls-dev (>= 2.12), nettle-dev +Standards-Version: 3.9.5 Section: web -Vcs-Git: git://git.debian.org/git/pkg-multimedia/rtmpdump.git -Vcs-Browser: http://git.debian.org/?p=pkg-multimedia/rtmpdump.git;a=summary +Vcs-Git: git://anonscm.debian.org/pkg-multimedia/rtmpdump.git +Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-multimedia/rtmpdump.git;a=summary Homepage: http://rtmpdump.mplayerhq.hu/ Package: rtmpdump Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} -Suggests: ffmpeg, mplayer Description: small dumper for media content streamed over the RTMP protocol A small dumper for media content streamed over the RTMP protocol (like BBC's iPlayer high quality streams). Supplying an RTMP URL will result in a dumped flv file, which can be played/transcoded with standard tools. -Package: librtmp0 +Package: librtmp1 Section: libs Depends: ${misc:Depends}, ${shlibs:Depends} Pre-Depends: ${misc:Pre-Depends} @@ -38,8 +34,9 @@ Package: librtmp-dev Section: libdevel -Depends: libgnutls-dev, librtmp0 (= ${binary:Version}), ${misc:Depends} +Depends: librtmp1 (= ${binary:Version}), ${misc:Depends}, libgmp-dev, nettle-dev Architecture: any +Multi-Arch: same Description: toolkit for RTMP streams (development files) A small dumper for media content streamed over the RTMP protocol (like BBC's iPlayer high quality streams). Supplying an RTMP URL will result in a dumped diff -Nru rtmpdump-2.4+20121230.gitdf6c518/debian/librtmp0.install rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/librtmp0.install --- rtmpdump-2.4+20121230.gitdf6c518/debian/librtmp0.install 2013-05-01 10:36:05.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/librtmp0.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/lib/*/lib*.so.* diff -Nru rtmpdump-2.4+20121230.gitdf6c518/debian/librtmp0.symbols rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/librtmp0.symbols --- rtmpdump-2.4+20121230.gitdf6c518/debian/librtmp0.symbols 2013-05-01 10:36:05.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/librtmp0.symbols 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -librtmp.so.0 librtmp0 #MINVER# -* Build-Depends-Package: librtmp-dev - AMF3CD_AddProp@Base 2.3 - AMF3CD_GetProp@Base 2.3 - AMF3Prop_Decode@Base 2.3 - AMF3ReadInteger@Base 2.3 - AMF3ReadString@Base 2.3 - AMF3_Decode@Base 2.3 - AMFProp_Decode@Base 2.3 - AMFProp_Dump@Base 2.3 - AMFProp_Encode@Base 2.3 - AMFProp_GetBoolean@Base 2.3 - AMFProp_GetName@Base 2.3 - AMFProp_GetNumber@Base 2.3 - AMFProp_GetObject@Base 2.3 - AMFProp_GetString@Base 2.3 - AMFProp_GetType@Base 2.3 - AMFProp_IsValid@Base 2.3 - AMFProp_Reset@Base 2.3 - AMFProp_SetName@Base 2.3 - AMF_AddProp@Base 2.3 - AMF_CountProp@Base 2.3 - AMF_Decode@Base 2.3 - AMF_DecodeArray@Base 2.3 - AMF_DecodeBoolean@Base 2.3 - AMF_DecodeInt16@Base 2.3 - AMF_DecodeInt24@Base 2.3 - AMF_DecodeInt32@Base 2.3 - AMF_DecodeLongString@Base 2.3 - AMF_DecodeNumber@Base 2.3 - AMF_DecodeString@Base 2.3 - AMF_Dump@Base 2.3 - AMF_Encode@Base 2.3 - AMF_EncodeBoolean@Base 2.3 - AMF_EncodeInt16@Base 2.3 - AMF_EncodeInt24@Base 2.3 - AMF_EncodeInt32@Base 2.3 - AMF_EncodeNamedBoolean@Base 2.3 - AMF_EncodeNamedNumber@Base 2.3 - AMF_EncodeNamedString@Base 2.3 - AMF_EncodeNumber@Base 2.3 - AMF_EncodeString@Base 2.3 - AMF_GetProp@Base 2.3 - AMF_Reset@Base 2.3 - HTTP_get@Base 2.3 - RTMPPacket_Alloc@Base 2.3 - RTMPPacket_Dump@Base 2.3 - RTMPPacket_Free@Base 2.3 - RTMPPacket_Reset@Base 2.3 - RTMPProtocolStrings@Base 2.3 - RTMPProtocolStringsLower@Base 2.3 - RTMPSockBuf_Close@Base 2.3 - RTMPSockBuf_Fill@Base 2.3 - RTMPSockBuf_Send@Base 2.3 - RTMP_Alloc@Base 2.3 - RTMP_ClientPacket@Base 2.3 - RTMP_Close@Base 2.3 - RTMP_Connect0@Base 2.3 - RTMP_Connect1@Base 2.3 - RTMP_Connect@Base 2.3 - RTMP_ConnectStream@Base 2.3 - RTMP_DefaultFlashVer@Base 2.3 - RTMP_DeleteStream@Base 2.3 - RTMP_DropRequest@Base 2.3 - RTMP_EnableWrite@Base 2.3 - RTMP_FindFirstMatchingProperty@Base 2.3 - RTMP_FindPrefixProperty@Base 2.3 - RTMP_Free@Base 2.3 - RTMP_GetDuration@Base 2.3 - RTMP_GetNextMediaPacket@Base 2.3 - RTMP_GetTime@Base 2.3 - RTMP_HashSWF@Base 2.3 - RTMP_Init@Base 2.3 - RTMP_IsConnected@Base 2.3 - RTMP_IsTimedout@Base 2.3 - RTMP_LibVersion@Base 2.3 - RTMP_Log@Base 2.3 - RTMP_LogGetLevel@Base 2.3 - RTMP_LogHex@Base 2.3 - RTMP_LogHexString@Base 2.3 - RTMP_LogPrintf@Base 2.3 - RTMP_LogSetCallback@Base 2.3 - RTMP_LogSetLevel@Base 2.3 - RTMP_LogSetOutput@Base 2.3 - RTMP_LogStatus@Base 2.3 - RTMP_ParsePlaypath@Base 2.3 - RTMP_ParseURL@Base 2.3 - RTMP_Pause@Base 2.3 - RTMP_Read@Base 2.3 - RTMP_ReadPacket@Base 2.3 - RTMP_ReconnectStream@Base 2.3 - RTMP_SendChunk@Base 2.3 - RTMP_SendClientBW@Base 2.3 - RTMP_SendCreateStream@Base 2.3 - RTMP_SendCtrl@Base 2.3 - RTMP_SendPacket@Base 2.3 - RTMP_SendPause@Base 2.3 - RTMP_SendSeek@Base 2.3 - RTMP_SendServerBW@Base 2.3 - RTMP_Serve@Base 2.3 - RTMP_SetBufferMS@Base 2.3 - RTMP_SetOpt@Base 2.3 - RTMP_SetupStream@Base 2.3 - RTMP_SetupURL@Base 2.3 - RTMP_Socket@Base 2.3 - RTMP_TLS_Init@Base 2.3 - RTMP_TLS_ctx@Base 2.3 - RTMP_ToggleStream@Base 2.3 - RTMP_UpdateBufferMS@Base 2.3 - RTMP_UserInterrupt@Base 2.3 - RTMP_Write@Base 2.3 - RTMP_ctrlC@Base 2.3 - RTMP_debuglevel@Base 2.3 diff -Nru rtmpdump-2.4+20121230.gitdf6c518/debian/librtmp1.install rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/librtmp1.install --- rtmpdump-2.4+20121230.gitdf6c518/debian/librtmp1.install 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/librtmp1.install 2014-07-20 00:19:51.000000000 +0000 @@ -0,0 +1 @@ +usr/lib/*/lib*.so.* diff -Nru rtmpdump-2.4+20121230.gitdf6c518/debian/librtmp1.symbols rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/librtmp1.symbols --- rtmpdump-2.4+20121230.gitdf6c518/debian/librtmp1.symbols 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/librtmp1.symbols 2014-07-20 00:19:51.000000000 +0000 @@ -0,0 +1,118 @@ +librtmp.so.1 librtmp1 #MINVER# +* Build-Depends-Package: librtmp-dev + AMF3CD_AddProp@Base 2.3 + AMF3CD_GetProp@Base 2.3 + AMF3Prop_Decode@Base 2.3 + AMF3ReadInteger@Base 2.3 + AMF3ReadString@Base 2.3 + AMF3_Decode@Base 2.3 + AMFProp_Decode@Base 2.3 + AMFProp_Dump@Base 2.3 + AMFProp_Encode@Base 2.3 + AMFProp_GetBoolean@Base 2.3 + AMFProp_GetName@Base 2.3 + AMFProp_GetNumber@Base 2.3 + AMFProp_GetObject@Base 2.3 + AMFProp_GetString@Base 2.3 + AMFProp_GetType@Base 2.3 + AMFProp_IsValid@Base 2.3 + AMFProp_Reset@Base 2.3 + AMFProp_SetName@Base 2.3 + AMF_AddProp@Base 2.3 + AMF_CountProp@Base 2.3 + AMF_Decode@Base 2.3 + AMF_DecodeArray@Base 2.3 + AMF_DecodeBoolean@Base 2.3 + AMF_DecodeInt16@Base 2.3 + AMF_DecodeInt24@Base 2.3 + AMF_DecodeInt32@Base 2.3 + AMF_DecodeLongString@Base 2.3 + AMF_DecodeNumber@Base 2.3 + AMF_DecodeString@Base 2.3 + AMF_Dump@Base 2.3 + AMF_Encode@Base 2.3 + AMF_EncodeBoolean@Base 2.3 + AMF_EncodeInt16@Base 2.3 + AMF_EncodeInt24@Base 2.3 + AMF_EncodeInt32@Base 2.3 + AMF_EncodeNamedBoolean@Base 2.3 + AMF_EncodeNamedNumber@Base 2.3 + AMF_EncodeNamedString@Base 2.3 + AMF_EncodeNumber@Base 2.3 + AMF_EncodeString@Base 2.3 + AMF_GetProp@Base 2.3 + AMF_Reset@Base 2.3 + HTTP_get@Base 2.3 + RTMPPacket_Alloc@Base 2.3 + RTMPPacket_Dump@Base 2.3 + RTMPPacket_Free@Base 2.3 + RTMPPacket_Reset@Base 2.3 + RTMPProtocolStrings@Base 2.3 + RTMPProtocolStringsLower@Base 2.3 + RTMPSockBuf_Close@Base 2.3 + RTMPSockBuf_Fill@Base 2.3 + RTMPSockBuf_Send@Base 2.3 + RTMP_Alloc@Base 2.3 + RTMP_ClientPacket@Base 2.3 + RTMP_Close@Base 2.3 + RTMP_Connect0@Base 2.3 + RTMP_Connect1@Base 2.3 + RTMP_Connect@Base 2.3 + RTMP_ConnectStream@Base 2.3 + RTMP_DefaultFlashVer@Base 2.3 + RTMP_DeleteStream@Base 2.3 + RTMP_DropRequest@Base 2.3 + RTMP_EnableWrite@Base 2.3 + RTMP_FindFirstMatchingProperty@Base 2.3 + RTMP_FindPrefixProperty@Base 2.3 + RTMP_Free@Base 2.3 + RTMP_GetDuration@Base 2.3 + RTMP_GetNextMediaPacket@Base 2.3 + RTMP_GetTime@Base 2.3 + RTMP_HashSWF@Base 2.3 + RTMP_Init@Base 2.3 + RTMP_IsConnected@Base 2.3 + RTMP_IsTimedout@Base 2.3 + RTMP_LibVersion@Base 2.3 + RTMP_Log@Base 2.3 + RTMP_LogGetLevel@Base 2.3 + RTMP_LogHex@Base 2.3 + RTMP_LogHexString@Base 2.3 + RTMP_LogPrintf@Base 2.3 + RTMP_LogSetCallback@Base 2.3 + RTMP_LogSetLevel@Base 2.3 + RTMP_LogSetOutput@Base 2.3 + RTMP_LogStatus@Base 2.3 + RTMP_ParsePlaypath@Base 2.3 + RTMP_ParseURL@Base 2.3 + RTMP_Pause@Base 2.3 + RTMP_Read@Base 2.3 + RTMP_ReadPacket@Base 2.3 + RTMP_ReconnectStream@Base 2.3 + RTMP_SendChunk@Base 2.3 + RTMP_SendClientBW@Base 2.3 + RTMP_SendCreateStream@Base 2.3 + RTMP_SendCtrl@Base 2.3 + RTMP_SendPacket@Base 2.3 + RTMP_SendPause@Base 2.3 + RTMP_SendSeek@Base 2.3 + RTMP_SendServerBW@Base 2.3 + RTMP_Serve@Base 2.3 + RTMP_SetBufferMS@Base 2.3 + RTMP_SetOpt@Base 2.3 + RTMP_SetupStream@Base 2.3 + RTMP_SetupURL@Base 2.3 + RTMP_Socket@Base 2.3 + RTMP_TLS_Init@Base 2.3 + RTMP_TLS_ctx@Base 2.3 + RTMP_ToggleStream@Base 2.3 + RTMP_UpdateBufferMS@Base 2.3 + RTMP_UserInterrupt@Base 2.3 + RTMP_Write@Base 2.3 + RTMP_ctrlC@Base 2.3 + RTMP_debuglevel@Base 2.3 + AMF_EncodeArray@Base 2.4+20131018.git79459a2 + AMF_EncodeEcmaArray@Base 2.4+20131018.git79459a2 + RTMP_TLS_Accept@Base 2.4+20131018.git79459a2 + RTMP_TLS_AllocServerContext@Base 2.4+20131018.git79459a2 + RTMP_TLS_FreeServerContext@Base 2.4+20131018.git79459a2 diff -Nru rtmpdump-2.4+20121230.gitdf6c518/debian/patches/02_gnutls_requires.private.diff rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/patches/02_gnutls_requires.private.diff --- rtmpdump-2.4+20121230.gitdf6c518/debian/patches/02_gnutls_requires.private.diff 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/patches/02_gnutls_requires.private.diff 2014-07-20 00:19:51.000000000 +0000 @@ -0,0 +1,30 @@ +Description: Move gnutls/nettle/hogweed to .private + librtmp'headers do not expose gnutls' headers (or its dependencies), move + them from Requires to Requires.private. + . + Upstream agrees that this is correct but wants to support for broken + archs and static-lib-only installations: + * 0d44da9f5f5a4aa7cd64566c64d89d2fb392e3ef + "Include the nettle/hogweed crypto libraries in the pkg-config file + . + These libraries are linked and used as directly as we use gnutls + itself. This fixes linking for callers if librtmp is built + statically or if the linker doesn't support transitive linking." + . +Author: Andreas Metzler +Origin: vendor +Bug-Debian: http://bugs.debian.org/745216 +Forwarded: not-needed +Last-Update: 2014-04-26 + +--- rtmpdump-2.4+20131018.git79459a2.orig/librtmp/librtmp.pc.in ++++ rtmpdump-2.4+20131018.git79459a2/librtmp/librtmp.pc.in +@@ -6,7 +6,7 @@ incdir=${prefix}/include + Name: librtmp + Description: RTMP implementation + Version: @VERSION@ +-Requires: @CRYPTO_REQ@ ++Requires.private: @CRYPTO_REQ@ + URL: http://rtmpdump.mplayerhq.hu + Libs: -L${libdir} -lrtmp -lz @PUBLIC_LIBS@ + Libs.private: @PRIVATE_LIBS@ diff -Nru rtmpdump-2.4+20121230.gitdf6c518/debian/patches/series rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/patches/series --- rtmpdump-2.4+20121230.gitdf6c518/debian/patches/series 2013-05-01 10:36:05.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/patches/series 2015-02-01 08:54:52.000000000 +0000 @@ -1 +1,2 @@ 01_unbreak_makefile.diff +02_gnutls_requires.private.diff diff -Nru rtmpdump-2.4+20121230.gitdf6c518/debian/rules rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/rules --- rtmpdump-2.4+20121230.gitdf6c518/debian/rules 2013-05-01 10:36:05.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/rules 2014-07-20 00:19:51.000000000 +0000 @@ -5,7 +5,11 @@ #export DH_VERBOSE=1 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) -MAKEVARS=prefix=/usr CRYPTO=GNUTLS libdir=/usr/lib/$(DEB_HOST_MULTIARCH) +CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) +CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) +LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS) +MAKEVARS=prefix=/usr CRYPTO=GNUTLS libdir=/usr/lib/$(DEB_HOST_MULTIARCH) XCFLAGS="$(CFLAGS) $(CPPFLAGS)" XLDFLAGS="$(LDFLAGS)" + DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) diff -Nru rtmpdump-2.4+20121230.gitdf6c518/debian/source/format rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/source/format --- rtmpdump-2.4+20121230.gitdf6c518/debian/source/format 2013-05-01 10:36:05.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/debian/source/format 2015-02-01 08:58:20.000000000 +0000 @@ -1 +1 @@ -3.0 (quilt) +1.0 diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/config rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/config --- rtmpdump-2.4+20121230.gitdf6c518/.git/config 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/config 2015-01-27 19:17:52.000000000 +0000 @@ -0,0 +1,11 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true +[remote "origin"] + url = git://git.ffmpeg.org/rtmpdump + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/description rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/description --- rtmpdump-2.4+20121230.gitdf6c518/.git/description 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/description 2015-01-27 19:17:50.000000000 +0000 @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/HEAD rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/HEAD --- rtmpdump-2.4+20121230.gitdf6c518/.git/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/HEAD 2015-01-27 19:17:52.000000000 +0000 @@ -0,0 +1 @@ +ref: refs/heads/master diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/applypatch-msg.sample rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/applypatch-msg.sample --- rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/applypatch-msg.sample 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/applypatch-msg.sample 2015-01-27 19:17:50.000000000 +0000 @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +test -x "$GIT_DIR/hooks/commit-msg" && + exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} +: diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/commit-msg.sample rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/commit-msg.sample --- rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/commit-msg.sample 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/commit-msg.sample 2015-01-27 19:17:50.000000000 +0000 @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/post-update.sample rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/post-update.sample --- rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/post-update.sample 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/post-update.sample 2015-01-27 19:17:50.000000000 +0000 @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/pre-applypatch.sample rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/pre-applypatch.sample --- rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/pre-applypatch.sample 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/pre-applypatch.sample 2015-01-27 19:17:50.000000000 +0000 @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"} +: diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/pre-commit.sample rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/pre-commit.sample --- rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/pre-commit.sample 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/pre-commit.sample 2015-01-27 19:17:50.000000000 +0000 @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/prepare-commit-msg.sample rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/prepare-commit-msg.sample --- rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/prepare-commit-msg.sample 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/prepare-commit-msg.sample 2015-01-27 19:17:50.000000000 +0000 @@ -0,0 +1,36 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first comments out the +# "Conflicts:" part of a merge commit. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +case "$2,$3" in + merge,) + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; + +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$1" ;; + + *) ;; +esac + +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/pre-push.sample rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/pre-push.sample --- rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/pre-push.sample 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/pre-push.sample 2015-01-27 19:17:50.000000000 +0000 @@ -0,0 +1,54 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +IFS=' ' +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/pre-rebase.sample rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/pre-rebase.sample --- rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/pre-rebase.sample 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/pre-rebase.sample 2015-01-27 19:17:50.000000000 +0000 @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up-to-date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/update.sample rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/update.sample --- rtmpdump-2.4+20121230.gitdf6c518/.git/hooks/update.sample 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/hooks/update.sample 2015-01-27 19:17:50.000000000 +0000 @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to blocks unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 Binary files /tmp/xY3ECnAri6/rtmpdump-2.4+20121230.gitdf6c518/.git/index and /tmp/1hR05ETNQZ/rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/index differ diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/info/exclude rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/info/exclude --- rtmpdump-2.4+20121230.gitdf6c518/.git/info/exclude 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/info/exclude 2015-01-27 19:17:50.000000000 +0000 @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/logs/HEAD rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/logs/HEAD --- rtmpdump-2.4+20121230.gitdf6c518/.git/logs/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/logs/HEAD 2015-01-27 19:17:52.000000000 +0000 @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 a107cef9b392616dff54fabfd37f985ee2190a6f Rainer Hochecker 1422386272 +0100 clone: from git://git.ffmpeg.org/rtmpdump diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/logs/refs/heads/master rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/logs/refs/heads/master --- rtmpdump-2.4+20121230.gitdf6c518/.git/logs/refs/heads/master 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/logs/refs/heads/master 2015-01-27 19:17:52.000000000 +0000 @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 a107cef9b392616dff54fabfd37f985ee2190a6f Rainer Hochecker 1422386272 +0100 clone: from git://git.ffmpeg.org/rtmpdump diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/logs/refs/remotes/origin/HEAD rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/logs/refs/remotes/origin/HEAD --- rtmpdump-2.4+20121230.gitdf6c518/.git/logs/refs/remotes/origin/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/logs/refs/remotes/origin/HEAD 2015-01-27 19:17:52.000000000 +0000 @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 a107cef9b392616dff54fabfd37f985ee2190a6f Rainer Hochecker 1422386272 +0100 clone: from git://git.ffmpeg.org/rtmpdump Binary files /tmp/xY3ECnAri6/rtmpdump-2.4+20121230.gitdf6c518/.git/objects/pack/pack-b45e5f9f096e4e1b030df0d15b7c63df896e660f.idx and /tmp/1hR05ETNQZ/rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/objects/pack/pack-b45e5f9f096e4e1b030df0d15b7c63df896e660f.idx differ Binary files /tmp/xY3ECnAri6/rtmpdump-2.4+20121230.gitdf6c518/.git/objects/pack/pack-b45e5f9f096e4e1b030df0d15b7c63df896e660f.pack and /tmp/1hR05ETNQZ/rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/objects/pack/pack-b45e5f9f096e4e1b030df0d15b7c63df896e660f.pack differ diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/packed-refs rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/packed-refs --- rtmpdump-2.4+20121230.gitdf6c518/.git/packed-refs 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/packed-refs 2015-01-27 19:17:52.000000000 +0000 @@ -0,0 +1,5 @@ +# pack-refs with: peeled fully-peeled +1e4531d80506eddaede706f1625ca020254d0b84 refs/remotes/origin/1.x +e2d22da410b9ca9a723d46cbf1ea3f22f7116f21 refs/remotes/origin/1.x@60 +d044c11fd1194a9e8a039a18dedfc5a266aa4711 refs/remotes/origin/1.x@63 +a107cef9b392616dff54fabfd37f985ee2190a6f refs/remotes/origin/master diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/refs/heads/master rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/refs/heads/master --- rtmpdump-2.4+20121230.gitdf6c518/.git/refs/heads/master 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/refs/heads/master 2015-01-27 19:17:52.000000000 +0000 @@ -0,0 +1 @@ +a107cef9b392616dff54fabfd37f985ee2190a6f diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.git/refs/remotes/origin/HEAD rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/refs/remotes/origin/HEAD --- rtmpdump-2.4+20121230.gitdf6c518/.git/refs/remotes/origin/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.git/refs/remotes/origin/HEAD 2015-01-27 19:17:52.000000000 +0000 @@ -0,0 +1 @@ +ref: refs/remotes/origin/master diff -Nru rtmpdump-2.4+20121230.gitdf6c518/.gitignore rtmpdump-2.4+20150114.gita107cef9b~trusty/.gitignore --- rtmpdump-2.4+20121230.gitdf6c518/.gitignore 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/.gitignore 2015-01-27 19:17:52.000000000 +0000 @@ -1,14 +1,8 @@ -.pc -*~ -*.o -*.a -debian/*.log -debian/*.substvars -debian/files -debian/librtmp-dev -debian/rtmpdump -debian/tmp -librtmp/librtmp.pc +*.[oa] +*.exe +*.so +*.so.[0-9] +*.dylib rtmpdump rtmpgw rtmpsrv diff -Nru rtmpdump-2.4+20121230.gitdf6c518/librtmp/amf.c rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/amf.c --- rtmpdump-2.4+20121230.gitdf6c518/librtmp/amf.c 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/amf.c 2015-01-27 19:17:52.000000000 +0000 @@ -396,6 +396,14 @@ pBuffer = AMF_Encode(&prop->p_vu.p_object, pBuffer, pBufEnd); break; + case AMF_ECMA_ARRAY: + pBuffer = AMF_EncodeEcmaArray(&prop->p_vu.p_object, pBuffer, pBufEnd); + break; + + case AMF_STRICT_ARRAY: + pBuffer = AMF_EncodeArray(&prop->p_vu.p_object, pBuffer, pBufEnd); + break; + default: RTMP_Log(RTMP_LOGERROR, "%s, invalid type. %d", __FUNCTION__, prop->p_type); pBuffer = NULL; @@ -700,7 +708,6 @@ if (nRes == -1) return -1; nSize -= nRes; - prop->p_type = AMF_OBJECT; break; } case AMF_OBJECT_END: @@ -718,7 +725,6 @@ if (nRes == -1) return -1; nSize -= nRes; - prop->p_type = AMF_OBJECT; break; } case AMF_DATE: @@ -815,6 +821,18 @@ AMF_Dump(&prop->p_vu.p_object); return; } + else if (prop->p_type == AMF_ECMA_ARRAY) + { + RTMP_Log(RTMP_LOGDEBUG, "Property: <%sECMA_ARRAY>", strRes); + AMF_Dump(&prop->p_vu.p_object); + return; + } + else if (prop->p_type == AMF_STRICT_ARRAY) + { + RTMP_Log(RTMP_LOGDEBUG, "Property: <%sSTRICT_ARRAY>", strRes); + AMF_Dump(&prop->p_vu.p_object); + return; + } switch (prop->p_type) { @@ -843,7 +861,8 @@ void AMFProp_Reset(AMFObjectProperty *prop) { - if (prop->p_type == AMF_OBJECT) + if (prop->p_type == AMF_OBJECT || prop->p_type == AMF_ECMA_ARRAY || + prop->p_type == AMF_STRICT_ARRAY) AMF_Reset(&prop->p_vu.p_object); else { @@ -888,6 +907,76 @@ return pBuffer; } +char * +AMF_EncodeEcmaArray(AMFObject *obj, char *pBuffer, char *pBufEnd) +{ + int i; + + if (pBuffer+4 >= pBufEnd) + return NULL; + + *pBuffer++ = AMF_ECMA_ARRAY; + + pBuffer = AMF_EncodeInt32(pBuffer, pBufEnd, obj->o_num); + + for (i = 0; i < obj->o_num; i++) + { + char *res = AMFProp_Encode(&obj->o_props[i], pBuffer, pBufEnd); + if (res == NULL) + { + RTMP_Log(RTMP_LOGERROR, "AMF_Encode - failed to encode property in index %d", + i); + break; + } + else + { + pBuffer = res; + } + } + + if (pBuffer + 3 >= pBufEnd) + return NULL; /* no room for the end marker */ + + pBuffer = AMF_EncodeInt24(pBuffer, pBufEnd, AMF_OBJECT_END); + + return pBuffer; +} + +char * +AMF_EncodeArray(AMFObject *obj, char *pBuffer, char *pBufEnd) +{ + int i; + + if (pBuffer+4 >= pBufEnd) + return NULL; + + *pBuffer++ = AMF_STRICT_ARRAY; + + pBuffer = AMF_EncodeInt32(pBuffer, pBufEnd, obj->o_num); + + for (i = 0; i < obj->o_num; i++) + { + char *res = AMFProp_Encode(&obj->o_props[i], pBuffer, pBufEnd); + if (res == NULL) + { + RTMP_Log(RTMP_LOGERROR, "AMF_Encode - failed to encode property in index %d", + i); + break; + } + else + { + pBuffer = res; + } + } + + //if (pBuffer + 3 >= pBufEnd) + // return NULL; /* no room for the end marker */ + + //pBuffer = AMF_EncodeInt24(pBuffer, pBufEnd, AMF_OBJECT_END); + + return pBuffer; +} + int AMF_DecodeArray(AMFObject *obj, const char *pBuffer, int nSize, int nArrayLen, int bDecodeName) @@ -1121,7 +1210,7 @@ { if (nIndex >= 0) { - if (nIndex <= obj->o_num) + if (nIndex < obj->o_num) return &obj->o_props[nIndex]; } else diff -Nru rtmpdump-2.4+20121230.gitdf6c518/librtmp/amf.h rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/amf.h --- rtmpdump-2.4+20121230.gitdf6c518/librtmp/amf.h 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/amf.h 2015-01-27 19:17:52.000000000 +0000 @@ -104,6 +104,9 @@ double AMF_DecodeNumber(const char *data); char *AMF_Encode(AMFObject * obj, char *pBuffer, char *pBufEnd); + char *AMF_EncodeEcmaArray(AMFObject *obj, char *pBuffer, char *pBufEnd); + char *AMF_EncodeArray(AMFObject *obj, char *pBuffer, char *pBufEnd); + int AMF_Decode(AMFObject * obj, const char *pBuffer, int nSize, int bDecodeName); int AMF_DecodeArray(AMFObject * obj, const char *pBuffer, int nSize, diff -Nru rtmpdump-2.4+20121230.gitdf6c518/librtmp/dh.h rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/dh.h --- rtmpdump-2.4+20121230.gitdf6c518/librtmp/dh.h 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/dh.h 2015-01-27 19:17:52.000000000 +0000 @@ -61,7 +61,7 @@ MP_set(&dh->ctx.P, dh->p); MP_set(&dh->ctx.G, dh->g); dh->ctx.len = 128; - dhm_make_public(&dh->ctx, 1024, out, 1, havege_rand, &RTMP_TLS_ctx->hs); + dhm_make_public(&dh->ctx, 1024, out, 1, havege_random, &RTMP_TLS_ctx->hs); MP_new(dh->pub_key); MP_new(dh->priv_key); MP_set(dh->pub_key, &dh->ctx.GX); @@ -77,20 +77,22 @@ } #elif defined(USE_GNUTLS) -#include -typedef gcry_mpi_t MP_t; -#define MP_new(m) m = gcry_mpi_new(1) -#define MP_set_w(mpi, w) gcry_mpi_set_ui(mpi, w) -#define MP_cmp(u, v) gcry_mpi_cmp(u, v) -#define MP_set(u, v) gcry_mpi_set(u, v) -#define MP_sub_w(mpi, w) gcry_mpi_sub_ui(mpi, mpi, w) -#define MP_cmp_1(mpi) gcry_mpi_cmp_ui(mpi, 1) -#define MP_modexp(r, y, q, p) gcry_mpi_powm(r, y, q, p) -#define MP_free(mpi) gcry_mpi_release(mpi) -#define MP_gethex(u, hex, res) res = (gcry_mpi_scan(&u, GCRYMPI_FMT_HEX, hex, 0, 0) == 0) -#define MP_bytes(u) (gcry_mpi_get_nbits(u) + 7) / 8 -#define MP_setbin(u,buf,len) gcry_mpi_print(GCRYMPI_FMT_USG,buf,len,NULL,u) -#define MP_getbin(u,buf,len) gcry_mpi_scan(&u,GCRYMPI_FMT_USG,buf,len,NULL) +#include +#include +#include +typedef mpz_ptr MP_t; +#define MP_new(m) m = malloc(sizeof(*m)); mpz_init2(m, 1) +#define MP_set_w(mpi, w) mpz_set_ui(mpi, w) +#define MP_cmp(u, v) mpz_cmp(u, v) +#define MP_set(u, v) mpz_set(u, v) +#define MP_sub_w(mpi, w) mpz_sub_ui(mpi, mpi, w) +#define MP_cmp_1(mpi) mpz_cmp_ui(mpi, 1) +#define MP_modexp(r, y, q, p) mpz_powm(r, y, q, p) +#define MP_free(mpi) mpz_clear(mpi); free(mpi) +#define MP_gethex(u, hex, res) u = malloc(sizeof(*u)); mpz_init2(u, 1); res = (mpz_set_str(u, hex, 16) == 0) +#define MP_bytes(u) (mpz_sizeinbase(u, 2) + 7) / 8 +#define MP_setbin(u,buf,len) nettle_mpz_get_str_256(len,buf,u) +#define MP_getbin(u,buf,len) u = malloc(sizeof(*u)); mpz_init2(u, 1); nettle_mpz_set_str_256_u(u,len,buf) typedef struct MDH { MP_t p; @@ -103,21 +105,62 @@ #define MDH_new() calloc(1,sizeof(MDH)) #define MDH_free(dh) do {MP_free(((MDH*)(dh))->p); MP_free(((MDH*)(dh))->g); MP_free(((MDH*)(dh))->pub_key); MP_free(((MDH*)(dh))->priv_key); free(dh);} while(0) -extern MP_t gnutls_calc_dh_secret(MP_t *priv, MP_t g, MP_t p); -extern MP_t gnutls_calc_dh_key(MP_t y, MP_t x, MP_t p); +static int MDH_generate_key(MDH *dh) +{ + int num_bytes; + uint32_t seed; + gmp_randstate_t rs; + + num_bytes = (mpz_sizeinbase(dh->p, 2) + 7) / 8 - 1; + if (num_bytes <= 0 || num_bytes > 18000) + return 0; + + dh->priv_key = calloc(1, sizeof(*dh->priv_key)); + if (!dh->priv_key) + return 0; + mpz_init2(dh->priv_key, 1); + gnutls_rnd(GNUTLS_RND_RANDOM, &seed, sizeof(seed)); + gmp_randinit_mt(rs); + gmp_randseed_ui(rs, seed); + mpz_urandomb(dh->priv_key, rs, num_bytes); + gmp_randclear(rs); + + dh->pub_key = calloc(1, sizeof(*dh->pub_key)); + if (!dh->pub_key) + return 0; + mpz_init2(dh->pub_key, 1); + if (!dh->pub_key) { + mpz_clear(dh->priv_key); + free(dh->priv_key); + return 0; + } + + mpz_powm(dh->pub_key, dh->g, dh->priv_key, dh->p); + + return 1; +} -#define MDH_generate_key(dh) (dh->pub_key = gnutls_calc_dh_secret(&dh->priv_key, dh->g, dh->p)) static int MDH_compute_key(uint8_t *secret, size_t len, MP_t pub, MDH *dh) { - MP_t sec = gnutls_calc_dh_key(pub, dh->priv_key, dh->p); - if (sec) - { - MP_setbin(sec, secret, len); - MP_free(sec); - return 0; - } - else + mpz_ptr k; + int num_bytes; + + num_bytes = (mpz_sizeinbase(dh->p, 2) + 7) / 8; + if (num_bytes <= 0 || num_bytes > 18000) + return -1; + + k = calloc(1, sizeof(*k)); + if (!k) return -1; + mpz_init2(k, 1); + + mpz_powm(k, pub, dh->priv_key, dh->p); + nettle_mpz_get_str_256(len, secret, k); + mpz_clear(k); + free(k); + + /* return the length of the shared secret key like DH_compute_key */ + return len; } #else /* USE_OPENSSL */ diff -Nru rtmpdump-2.4+20121230.gitdf6c518/librtmp/handshake.h rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/handshake.h --- rtmpdump-2.4+20121230.gitdf6c518/librtmp/handshake.h 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/handshake.h 2015-01-27 19:17:52.000000000 +0000 @@ -43,21 +43,24 @@ #define RC4_free(h) free(h) #elif defined(USE_GNUTLS) -#include +#include +#include #ifndef SHA256_DIGEST_LENGTH #define SHA256_DIGEST_LENGTH 32 #endif -#define HMAC_CTX gcry_md_hd_t -#define HMAC_setup(ctx, key, len) gcry_md_open(&ctx, GCRY_MD_SHA256, GCRY_MD_FLAG_HMAC); gcry_md_setkey(ctx, key, len) -#define HMAC_crunch(ctx, buf, len) gcry_md_write(ctx, buf, len) -#define HMAC_finish(ctx, dig, dlen) dlen = SHA256_DIGEST_LENGTH; memcpy(dig, gcry_md_read(ctx, 0), dlen); gcry_md_close(ctx) +#undef HMAC_CTX +#define HMAC_CTX struct hmac_sha256_ctx +#define HMAC_setup(ctx, key, len) hmac_sha256_set_key(&ctx, len, key) +#define HMAC_crunch(ctx, buf, len) hmac_sha256_update(&ctx, len, buf) +#define HMAC_finish(ctx, dig, dlen) dlen = SHA256_DIGEST_LENGTH; hmac_sha256_digest(&ctx, SHA256_DIGEST_LENGTH, dig) +#define HMAC_close(ctx) -typedef gcry_cipher_hd_t RC4_handle; -#define RC4_alloc(h) gcry_cipher_open(h, GCRY_CIPHER_ARCFOUR, GCRY_CIPHER_MODE_STREAM, 0) -#define RC4_setkey(h,l,k) gcry_cipher_setkey(h,k,l) -#define RC4_encrypt(h,l,d) gcry_cipher_encrypt(h,(void *)d,l,NULL,0) -#define RC4_encrypt2(h,l,s,d) gcry_cipher_encrypt(h,(void *)d,l,(void *)s,l) -#define RC4_free(h) gcry_cipher_close(h) +typedef struct arcfour_ctx* RC4_handle; +#define RC4_alloc(h) *h = malloc(sizeof(struct arcfour_ctx)) +#define RC4_setkey(h,l,k) arcfour_set_key(h, l, k) +#define RC4_encrypt(h,l,d) arcfour_crypt(h,l,(uint8_t *)d,(uint8_t *)d) +#define RC4_encrypt2(h,l,s,d) arcfour_crypt(h,l,(uint8_t *)d,(uint8_t *)s) +#define RC4_free(h) free(h) #else /* USE_OPENSSL */ #include diff -Nru rtmpdump-2.4+20121230.gitdf6c518/librtmp/hashswf.c rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/hashswf.c --- rtmpdump-2.4+20121230.gitdf6c518/librtmp/hashswf.c 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/hashswf.c 2015-01-27 19:17:52.000000000 +0000 @@ -42,16 +42,16 @@ #define HMAC_finish(ctx, dig, dlen) dlen = SHA256_DIGEST_LENGTH; sha2_hmac_finish(&ctx, dig) #define HMAC_close(ctx) #elif defined(USE_GNUTLS) -#include -#include +#include #ifndef SHA256_DIGEST_LENGTH #define SHA256_DIGEST_LENGTH 32 #endif -#define HMAC_CTX gcry_md_hd_t -#define HMAC_setup(ctx, key, len) gcry_md_open(&ctx, GCRY_MD_SHA256, GCRY_MD_FLAG_HMAC); gcry_md_setkey(ctx, key, len) -#define HMAC_crunch(ctx, buf, len) gcry_md_write(ctx, buf, len) -#define HMAC_finish(ctx, dig, dlen) dlen = SHA256_DIGEST_LENGTH; memcpy(dig, gcry_md_read(ctx, 0), dlen) -#define HMAC_close(ctx) gcry_md_close(ctx) +#undef HMAC_CTX +#define HMAC_CTX struct hmac_sha256_ctx +#define HMAC_setup(ctx, key, len) hmac_sha256_set_key(&ctx, len, key) +#define HMAC_crunch(ctx, buf, len) hmac_sha256_update(&ctx, len, buf) +#define HMAC_finish(ctx, dig, dlen) dlen = SHA256_DIGEST_LENGTH; hmac_sha256_digest(&ctx, SHA256_DIGEST_LENGTH, dig) +#define HMAC_close(ctx) #else /* USE_OPENSSL */ #include #include diff -Nru rtmpdump-2.4+20121230.gitdf6c518/librtmp/librtmp.pc.in rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/librtmp.pc.in --- rtmpdump-2.4+20121230.gitdf6c518/librtmp/librtmp.pc.in 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/librtmp.pc.in 2015-01-27 19:17:52.000000000 +0000 @@ -8,6 +8,6 @@ Version: @VERSION@ Requires: @CRYPTO_REQ@ URL: http://rtmpdump.mplayerhq.hu -Libs: -L${libdir} -lrtmp -lz +Libs: -L${libdir} -lrtmp -lz @PUBLIC_LIBS@ Libs.private: @PRIVATE_LIBS@ Cflags: -I${incdir} diff -Nru rtmpdump-2.4+20121230.gitdf6c518/librtmp/Makefile rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/Makefile --- rtmpdump-2.4+20121230.gitdf6c518/librtmp/Makefile 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/Makefile 2015-01-27 19:17:52.000000000 +0000 @@ -22,28 +22,30 @@ DEF_OPENSSL=-DUSE_OPENSSL DEF_GNUTLS=-DUSE_GNUTLS DEF_=-DNO_CRYPTO -REQ_GNUTLS=gnutls +REQ_GNUTLS=gnutls,hogweed,nettle REQ_OPENSSL=libssl,libcrypto +PUB_GNUTLS=-lgmp LIBZ=-lz LIBS_posix= LIBS_darwin= LIBS_mingw=-lws2_32 -lwinmm -lgdi32 -LIB_GNUTLS=-lgnutls -lgcrypt $(LIBZ) +LIB_GNUTLS=-lgnutls -lhogweed -lnettle -lgmp $(LIBZ) LIB_OPENSSL=-lssl -lcrypto $(LIBZ) LIB_POLARSSL=-lpolarssl $(LIBZ) PRIVATE_LIBS=$(LIBS_$(SYS)) CRYPTO_LIB=$(LIB_$(CRYPTO)) $(PRIVATE_LIBS) CRYPTO_REQ=$(REQ_$(CRYPTO)) CRYPTO_DEF=$(DEF_$(CRYPTO)) +PUBLIC_LIBS=$(PUB_$(CRYPTO)) -SO_VERSION=0 +SO_VERSION=1 SOX_posix=so SOX_darwin=dylib -SOX_mingw=so # useless +SOX_mingw=dll SOX=$(SOX_$(SYS)) -SO_posix=$(SOX).$(SO_VERSION) -SO_darwin=$(SO_VERSION).$(SOX) -SO_mingw=dll +SO_posix=.$(SOX).$(SO_VERSION) +SO_darwin=.$(SO_VERSION).$(SOX) +SO_mingw=-$(SO_VERSION).$(SOX) SO_EXT=$(SO_$(SYS)) SODIR_posix=$(LIBDIR) @@ -64,7 +66,7 @@ SHARED=yes SODEF_yes=-fPIC -SOLIB_yes=librtmp.$(SO_EXT) +SOLIB_yes=librtmp$(SO_EXT) SOINST_yes=install_so SO_DEF=$(SODEF_$(SHARED)) SO_LIB=$(SOLIB_$(SHARED)) @@ -81,12 +83,12 @@ all: librtmp.a $(SO_LIB) clean: - rm -f *.o *.a *.$(SOX) *.$(SO_EXT) librtmp.pc + rm -f *.o *.a *.$(SOX) *$(SO_EXT) librtmp.pc librtmp.a: $(OBJS) $(AR) rs $@ $? -librtmp.$(SO_EXT): $(OBJS) +librtmp$(SO_EXT): $(OBJS) $(CC) $(SO_LDFLAGS) $(LDFLAGS) -o $@ $^ $> $(CRYPTO_LIB) ln -sf $@ librtmp.$(SOX) @@ -100,6 +102,7 @@ sed -e "s;@prefix@;$(prefix);" -e "s;@libdir@;$(libdir);" \ -e "s;@VERSION@;$(VERSION);" \ -e "s;@CRYPTO_REQ@;$(CRYPTO_REQ);" \ + -e "s;@PUBLIC_LIBS@;$(PUBLIC_LIBS);" \ -e "s;@PRIVATE_LIBS@;$(PRIVATE_LIBS);" librtmp.pc.in > $@ install: install_base $(SO_INST) @@ -111,8 +114,8 @@ cp librtmp.pc $(LIBDIR)/pkgconfig cp librtmp.3 $(MANDIR)/man3 -install_so: librtmp.$(SO_EXT) - cp librtmp.$(SO_EXT) $(SODIR) +install_so: librtmp$(SO_EXT) + cp librtmp$(SO_EXT) $(SODIR) $(INSTALL_IMPLIB) - cd $(SODIR); ln -sf librtmp.$(SO_EXT) librtmp.$(SOX) + cd $(SODIR); ln -sf librtmp$(SO_EXT) librtmp.$(SOX) diff -Nru rtmpdump-2.4+20121230.gitdf6c518/librtmp/parseurl.c rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/parseurl.c --- rtmpdump-2.4+20121230.gitdf6c518/librtmp/parseurl.c 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/parseurl.c 2015-01-27 19:17:52.000000000 +0000 @@ -137,12 +137,14 @@ * application = app[/appinstance] */ - char *slash2, *slash3 = NULL; + char *slash2, *slash3 = NULL, *slash4 = NULL; int applen, appnamelen; slash2 = strchr(p, '/'); if(slash2) slash3 = strchr(slash2+1, '/'); + if(slash3) + slash4 = strchr(slash3+1, '/'); applen = end-p; /* ondemand, pass all parameters as app */ appnamelen = applen; /* ondemand length */ @@ -156,7 +158,9 @@ appnamelen = 8; } else { /* app!=ondemand, so app is app[/appinstance] */ - if(slash3) + if(slash4) + appnamelen = slash4-p; + else if(slash3) appnamelen = slash3-p; else if(slash2) appnamelen = slash2-p; diff -Nru rtmpdump-2.4+20121230.gitdf6c518/librtmp/rtmp.c rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/rtmp.c --- rtmpdump-2.4+20121230.gitdf6c518/librtmp/rtmp.c 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/rtmp.c 2015-01-27 19:17:52.000000000 +0000 @@ -27,6 +27,7 @@ #include #include #include +#include #include "rtmp_sys.h" #include "log.h" @@ -34,11 +35,33 @@ #ifdef CRYPTO #ifdef USE_POLARSSL #include +#include +#include +#define MD5_DIGEST_LENGTH 16 + +static const char *my_dhm_P = + "E4004C1F94182000103D883A448B3F80" \ + "2CE4B44A83301270002C20D0321CFD00" \ + "11CCEF784C26A400F43DFB901BCA7538" \ + "F2C6B176001CF5A0FD16D2C48B1D0C1C" \ + "F6AC8E1DA6BCC3B4E1F96B0564965300" \ + "FFA1D0B601EB2800F489AA512C4B248C" \ + "01F76949A60BB7F00A40B1EAB64BDD48" \ + "E8A700D60B7F1200FA8E77B0A979DABF"; + +static const char *my_dhm_G = "4"; + #elif defined(USE_GNUTLS) #include +#define MD5_DIGEST_LENGTH 16 +#include +#include #else /* USE_OPENSSL */ #include #include +#include +#include +#include #endif TLS_CTX RTMP_TLS_ctx; #endif @@ -119,6 +142,8 @@ static int HTTP_Post(RTMP *r, RTMPTCmd cmd, const char *buf, int len); static int HTTP_read(RTMP *r, int fill); +static void CloseInternal(RTMP *r, int reconnect); + #ifndef _WIN32 static int clk_tck; #endif @@ -227,6 +252,64 @@ #endif } +void * +RTMP_TLS_AllocServerContext(const char* cert, const char* key) +{ + void *ctx = NULL; +#ifdef CRYPTO + if (!RTMP_TLS_ctx) + RTMP_TLS_Init(); +#ifdef USE_POLARSSL + tls_server_ctx *tc = ctx = calloc(1, sizeof(struct tls_server_ctx)); + tc->dhm_P = my_dhm_P; + tc->dhm_G = my_dhm_G; + tc->hs = &RTMP_TLS_ctx->hs; + if (x509parse_crtfile(&tc->cert, cert)) { + free(tc); + return NULL; + } + if (x509parse_keyfile(&tc->key, key, NULL)) { + x509_free(&tc->cert); + free(tc); + return NULL; + } +#elif defined(USE_GNUTLS) && !defined(NO_SSL) + gnutls_certificate_allocate_credentials((gnutls_certificate_credentials*) &ctx); + if (gnutls_certificate_set_x509_key_file(ctx, cert, key, GNUTLS_X509_FMT_PEM) != 0) { + gnutls_certificate_free_credentials(ctx); + return NULL; + } +#elif !defined(NO_SSL) /* USE_OPENSSL */ + ctx = SSL_CTX_new(SSLv23_server_method()); + if (!SSL_CTX_use_certificate_chain_file(ctx, cert)) { + SSL_CTX_free(ctx); + return NULL; + } + if (!SSL_CTX_use_PrivateKey_file(ctx, key, SSL_FILETYPE_PEM)) { + SSL_CTX_free(ctx); + return NULL; + } +#endif +#endif + return ctx; +} + +void +RTMP_TLS_FreeServerContext(void *ctx) +{ +#ifdef CRYPTO +#ifdef USE_POLARSSL + x509_free(&((tls_server_ctx*)ctx)->cert); + rsa_free(&((tls_server_ctx*)ctx)->key); + free(ctx); +#elif defined(USE_GNUTLS) && !defined(NO_SSL) + gnutls_certificate_free_credentials(ctx); +#elif !defined(NO_SSL) /* USE_OPENSSL */ + SSL_CTX_free(ctx); +#endif +#endif +} + RTMP * RTMP_Alloc() { @@ -320,6 +403,31 @@ const AVal RTMP_DefaultFlashVer = { (char *)DEFAULT_FLASH_VER, sizeof(DEFAULT_FLASH_VER) - 1 }; +static void +SocksSetup(RTMP *r, AVal *sockshost) +{ + if (sockshost->av_len) + { + const char *socksport = strchr(sockshost->av_val, ':'); + char *hostname = strdup(sockshost->av_val); + + if (socksport) + hostname[socksport - sockshost->av_val] = '\0'; + r->Link.sockshost.av_val = hostname; + r->Link.sockshost.av_len = strlen(hostname); + + r->Link.socksport = socksport ? atoi(socksport + 1) : 1080; + RTMP_Log(RTMP_LOGDEBUG, "Connecting via SOCKS proxy: %s:%d", r->Link.sockshost.av_val, + r->Link.socksport); + } + else + { + r->Link.sockshost.av_val = NULL; + r->Link.sockshost.av_len = 0; + r->Link.socksport = 0; + } +} + void RTMP_SetupStream(RTMP *r, int protocol, @@ -384,26 +492,7 @@ } #endif - if (sockshost->av_len) - { - const char *socksport = strchr(sockshost->av_val, ':'); - char *hostname = strdup(sockshost->av_val); - - if (socksport) - hostname[socksport - sockshost->av_val] = '\0'; - r->Link.sockshost.av_val = hostname; - r->Link.sockshost.av_len = strlen(hostname); - - r->Link.socksport = socksport ? atoi(socksport + 1) : 1080; - RTMP_Log(RTMP_LOGDEBUG, "Connecting via SOCKS proxy: %s:%d", r->Link.sockshost.av_val, - r->Link.socksport); - } - else - { - r->Link.sockshost.av_val = NULL; - r->Link.sockshost.av_len = 0; - r->Link.socksport = 0; - } + SocksSetup(r, sockshost); if (tcUrl && tcUrl->av_len) r->Link.tcUrl = *tcUrl; @@ -499,6 +588,10 @@ "Buffer time in milliseconds" }, { AVC("timeout"), OFF(Link.timeout), OPT_INT, 0, "Session timeout in seconds" }, + { AVC("pubUser"), OFF(Link.pubUser), OPT_STR, 0, + "Publisher username" }, + { AVC("pubPasswd"), OFF(Link.pubPasswd), OPT_STR, 0, + "Publisher password" }, { {NULL,0}, 0, 0} }; @@ -756,6 +849,8 @@ (unsigned char *)r->Link.SWFHash, r->Link.swfAge); #endif + SocksSetup(r, &r->Link.sockshost); + if (r->Link.port == 0) { if (r->Link.protocol & RTMP_FEATURE_SSL) @@ -859,6 +954,23 @@ } int +RTMP_TLS_Accept(RTMP *r, void *ctx) +{ +#if defined(CRYPTO) && !defined(NO_SSL) + TLS_server(ctx, r->m_sb.sb_ssl); + TLS_setfd(r->m_sb.sb_ssl, r->m_sb.sb_socket); + if (TLS_accept(r->m_sb.sb_ssl) < 0) + { + RTMP_Log(RTMP_LOGERROR, "%s, TLS_Connect failed", __FUNCTION__); + return FALSE; + } + return TRUE; +#else + return FALSE; +#endif +} + +int RTMP_Connect1(RTMP *r, RTMPPacket *cp) { if (r->Link.protocol & RTMP_FEATURE_SSL) @@ -1091,6 +1203,7 @@ packet->m_nTimeStamp, packet->m_hasAbsTimestamp, r->m_mediaStamp); #endif + RTMPPacket_Free(packet); continue; } r->m_pausing = 0; @@ -1100,7 +1213,8 @@ if (bHasMediaPacket) r->m_bPlaying = TRUE; else if (r->m_sb.sb_timedout && !r->m_pausing) - r->m_pauseStamp = r->m_channelTimestamp[r->m_mediaChannel]; + r->m_pauseStamp = r->m_mediaChannel < r->m_channelsAllocatedIn ? + r->m_channelTimestamp[r->m_mediaChannel] : 0; return bHasMediaPacket; } @@ -1288,9 +1402,11 @@ int nBytes = 0, nRead; if (r->Link.protocol & RTMP_FEATURE_HTTP) { + int refill = 0; while (!r->m_resplen) { - if (r->m_sb.sb_size < 144) + int ret; + if (r->m_sb.sb_size < 13 || refill) { if (!r->m_unackd) HTTP_Post(r, RTMPT_IDLE, "", 1); @@ -1301,12 +1417,20 @@ return 0; } } - if (HTTP_read(r, 0) == -1) + if ((ret = HTTP_read(r, 0)) == -1) { RTMP_Log(RTMP_LOGDEBUG, "%s, No valid HTTP response found", __FUNCTION__); RTMP_Close(r); return 0; } + else if (ret == -2) + { + refill = 1; + } + else + { + refill = 0; + } } if (r->m_resplen && !r->m_sb.sb_size) RTMPSockBuf_Fill(&r->m_sb); @@ -1872,7 +1996,8 @@ int RTMP_Pause(RTMP *r, int DoPause) { if (DoPause) - r->m_pauseStamp = r->m_channelTimestamp[r->m_mediaChannel]; + r->m_pauseStamp = r->m_mediaChannel < r->m_channelsAllocatedIn ? + r->m_channelTimestamp[r->m_mediaChannel] : 0; return RTMP_SendPause(r, DoPause, r->m_pauseStamp); } @@ -2305,6 +2430,449 @@ free(vals); } + +#ifdef CRYPTO +static int +b64enc(const unsigned char *input, int length, char *output, int maxsize) +{ +#ifdef USE_POLARSSL + size_t buf_size = maxsize; + if(base64_encode((unsigned char *) output, &buf_size, input, length) == 0) + { + output[buf_size] = '\0'; + return 1; + } + else + { + RTMP_Log(RTMP_LOGDEBUG, "%s, error", __FUNCTION__); + return 0; + } +#elif defined(USE_GNUTLS) + if (BASE64_ENCODE_RAW_LENGTH(length) <= maxsize) + base64_encode_raw((uint8_t*) output, length, input); + else + { + RTMP_Log(RTMP_LOGDEBUG, "%s, error", __FUNCTION__); + return 0; + } +#else /* USE_OPENSSL */ + BIO *bmem, *b64; + BUF_MEM *bptr; + + b64 = BIO_new(BIO_f_base64()); + bmem = BIO_new(BIO_s_mem()); + b64 = BIO_push(b64, bmem); + BIO_write(b64, input, length); + if (BIO_flush(b64) == 1) + { + BIO_get_mem_ptr(b64, &bptr); + memcpy(output, bptr->data, bptr->length-1); + output[bptr->length-1] = '\0'; + } + else + { + RTMP_Log(RTMP_LOGDEBUG, "%s, error", __FUNCTION__); + return 0; + } + BIO_free_all(b64); +#endif + return 1; +} + +#ifdef USE_POLARSSL +#define MD5_CTX md5_context +#define MD5_Init(ctx) md5_starts(ctx) +#define MD5_Update(ctx,data,len) md5_update(ctx,(unsigned char *)data,len) +#define MD5_Final(dig,ctx) md5_finish(ctx,dig) +#elif defined(USE_GNUTLS) +typedef struct md5_ctx MD5_CTX; +#define MD5_Init(ctx) md5_init(ctx) +#define MD5_Update(ctx,data,len) md5_update(ctx,len,data) +#define MD5_Final(dig,ctx) md5_digest(ctx,MD5_DIGEST_LENGTH,dig) +#else +#endif + +static const AVal av_authmod_adobe = AVC("authmod=adobe"); +static const AVal av_authmod_llnw = AVC("authmod=llnw"); + +static void hexenc(unsigned char *inbuf, int len, char *dst) +{ + char *ptr = dst; + while(len--) { + sprintf(ptr, "%02x", *inbuf++); + ptr += 2; + } + *ptr = '\0'; +} + +static char * +AValChr(AVal *av, char c) +{ + int i; + for (i = 0; i < av->av_len; i++) + if (av->av_val[i] == c) + return &av->av_val[i]; + return NULL; +} + +static int +PublisherAuth(RTMP *r, AVal *description) +{ + char *token_in = NULL; + char *ptr; + unsigned char md5sum_val[MD5_DIGEST_LENGTH+1]; + MD5_CTX md5ctx; + int challenge2_data; +#define RESPONSE_LEN 32 +#define CHALLENGE2_LEN 16 +#define SALTED2_LEN (32+8+8+8) +#define B64DIGEST_LEN 24 /* 16 byte digest => 22 b64 chars + 2 chars padding */ +#define B64INT_LEN 8 /* 4 byte int => 6 b64 chars + 2 chars padding */ +#define HEXHASH_LEN (2*MD5_DIGEST_LENGTH) + char response[RESPONSE_LEN]; + char challenge2[CHALLENGE2_LEN]; + char salted2[SALTED2_LEN]; + AVal pubToken; + + if (strstr(description->av_val, av_authmod_adobe.av_val) != NULL) + { + if(strstr(description->av_val, "code=403 need auth") != NULL) + { + if (strstr(r->Link.app.av_val, av_authmod_adobe.av_val) != NULL) { + RTMP_Log(RTMP_LOGERROR, "%s, wrong pubUser & pubPasswd for publisher auth", __FUNCTION__); + return 0; + } else if(r->Link.pubUser.av_len && r->Link.pubPasswd.av_len) { + pubToken.av_val = malloc(r->Link.pubUser.av_len + av_authmod_adobe.av_len + 8); + pubToken.av_len = sprintf(pubToken.av_val, "?%s&user=%s", + av_authmod_adobe.av_val, + r->Link.pubUser.av_val); + RTMP_Log(RTMP_LOGDEBUG, "%s, pubToken1: %s", __FUNCTION__, pubToken.av_val); + } else { + RTMP_Log(RTMP_LOGERROR, "%s, need to set pubUser & pubPasswd for publisher auth", __FUNCTION__); + return 0; + } + } + else if((token_in = strstr(description->av_val, "?reason=needauth")) != NULL) + { + char *par, *val = NULL, *orig_ptr; + AVal user, salt, opaque, challenge, *aptr = NULL; + opaque.av_len = 0; + challenge.av_len = 0; + + ptr = orig_ptr = strdup(token_in); + while (ptr) + { + par = ptr; + ptr = strchr(par, '&'); + if(ptr) + *ptr++ = '\0'; + + val = strchr(par, '='); + if(val) + *val++ = '\0'; + + if (aptr) { + aptr->av_len = par - aptr->av_val - 1; + aptr = NULL; + } + if (strcmp(par, "user") == 0){ + user.av_val = val; + aptr = &user; + } else if (strcmp(par, "salt") == 0){ + salt.av_val = val; + aptr = &salt; + } else if (strcmp(par, "opaque") == 0){ + opaque.av_val = val; + aptr = &opaque; + } else if (strcmp(par, "challenge") == 0){ + challenge.av_val = val; + aptr = &challenge; + } + + RTMP_Log(RTMP_LOGDEBUG, "%s, par:\"%s\" = val:\"%s\"", __FUNCTION__, par, val); + } + if (aptr) + aptr->av_len = strlen(aptr->av_val); + + /* hash1 = base64enc(md5(user + _aodbeAuthSalt + password)) */ + MD5_Init(&md5ctx); + MD5_Update(&md5ctx, user.av_val, user.av_len); + MD5_Update(&md5ctx, salt.av_val, salt.av_len); + MD5_Update(&md5ctx, r->Link.pubPasswd.av_val, r->Link.pubPasswd.av_len); + MD5_Final(md5sum_val, &md5ctx); + RTMP_Log(RTMP_LOGDEBUG, "%s, md5(%s%s%s) =>", __FUNCTION__, + user.av_val, salt.av_val, r->Link.pubPasswd.av_val); + RTMP_LogHexString(RTMP_LOGDEBUG, md5sum_val, MD5_DIGEST_LENGTH); + + b64enc(md5sum_val, MD5_DIGEST_LENGTH, salted2, SALTED2_LEN); + RTMP_Log(RTMP_LOGDEBUG, "%s, b64(md5_1) = %s", __FUNCTION__, salted2); + + challenge2_data = rand(); + + b64enc((unsigned char *) &challenge2_data, sizeof(int), challenge2, CHALLENGE2_LEN); + RTMP_Log(RTMP_LOGDEBUG, "%s, b64(%d) = %s", __FUNCTION__, challenge2_data, challenge2); + + MD5_Init(&md5ctx); + MD5_Update(&md5ctx, salted2, B64DIGEST_LEN); + /* response = base64enc(md5(hash1 + opaque + challenge2)) */ + if (opaque.av_len) + MD5_Update(&md5ctx, opaque.av_val, opaque.av_len); + else if (challenge.av_len) + MD5_Update(&md5ctx, challenge.av_val, challenge.av_len); + MD5_Update(&md5ctx, challenge2, B64INT_LEN); + MD5_Final(md5sum_val, &md5ctx); + + RTMP_Log(RTMP_LOGDEBUG, "%s, md5(%s%s%s) =>", __FUNCTION__, + salted2, opaque.av_len ? opaque.av_val : "", challenge2); + RTMP_LogHexString(RTMP_LOGDEBUG, md5sum_val, MD5_DIGEST_LENGTH); + + b64enc(md5sum_val, MD5_DIGEST_LENGTH, response, RESPONSE_LEN); + RTMP_Log(RTMP_LOGDEBUG, "%s, b64(md5_2) = %s", __FUNCTION__, response); + + /* have all hashes, create auth token for the end of app */ + pubToken.av_val = malloc(32 + B64INT_LEN + B64DIGEST_LEN + opaque.av_len); + pubToken.av_len = sprintf(pubToken.av_val, + "&challenge=%s&response=%s&opaque=%s", + challenge2, + response, + opaque.av_len ? opaque.av_val : ""); + RTMP_Log(RTMP_LOGDEBUG, "%s, pubToken2: %s", __FUNCTION__, pubToken.av_val); + free(orig_ptr); + } + else if(strstr(description->av_val, "?reason=authfailed") != NULL) + { + RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: wrong password", __FUNCTION__); + return 0; + } + else if(strstr(description->av_val, "?reason=nosuchuser") != NULL) + { + RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: no such user", __FUNCTION__); + return 0; + } + else + { + RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: unknown auth mode: %s", + __FUNCTION__, description->av_val); + return 0; + } + + ptr = malloc(r->Link.app.av_len + pubToken.av_len); + strncpy(ptr, r->Link.app.av_val, r->Link.app.av_len); + strncpy(ptr + r->Link.app.av_len, pubToken.av_val, pubToken.av_len); + r->Link.app.av_len += pubToken.av_len; + if(r->Link.lFlags & RTMP_LF_FAPU) + free(r->Link.app.av_val); + r->Link.app.av_val = ptr; + + ptr = malloc(r->Link.tcUrl.av_len + pubToken.av_len); + strncpy(ptr, r->Link.tcUrl.av_val, r->Link.tcUrl.av_len); + strncpy(ptr + r->Link.tcUrl.av_len, pubToken.av_val, pubToken.av_len); + r->Link.tcUrl.av_len += pubToken.av_len; + if(r->Link.lFlags & RTMP_LF_FTCU) + free(r->Link.tcUrl.av_val); + r->Link.tcUrl.av_val = ptr; + + free(pubToken.av_val); + r->Link.lFlags |= RTMP_LF_FTCU | RTMP_LF_FAPU; + + RTMP_Log(RTMP_LOGDEBUG, "%s, new app: %.*s tcUrl: %.*s playpath: %s", __FUNCTION__, + r->Link.app.av_len, r->Link.app.av_val, + r->Link.tcUrl.av_len, r->Link.tcUrl.av_val, + r->Link.playpath.av_val); + } + else if (strstr(description->av_val, av_authmod_llnw.av_val) != NULL) + { + if(strstr(description->av_val, "code=403 need auth") != NULL) + { + /* This part seems to be the same for llnw and adobe */ + + if (strstr(r->Link.app.av_val, av_authmod_llnw.av_val) != NULL) { + RTMP_Log(RTMP_LOGERROR, "%s, wrong pubUser & pubPasswd for publisher auth", __FUNCTION__); + return 0; + } else if(r->Link.pubUser.av_len && r->Link.pubPasswd.av_len) { + pubToken.av_val = malloc(r->Link.pubUser.av_len + av_authmod_llnw.av_len + 8); + pubToken.av_len = sprintf(pubToken.av_val, "?%s&user=%s", + av_authmod_llnw.av_val, + r->Link.pubUser.av_val); + RTMP_Log(RTMP_LOGDEBUG, "%s, pubToken1: %s", __FUNCTION__, pubToken.av_val); + } else { + RTMP_Log(RTMP_LOGERROR, "%s, need to set pubUser & pubPasswd for publisher auth", __FUNCTION__); + return 0; + } + } + else if((token_in = strstr(description->av_val, "?reason=needauth")) != NULL) + { + char *orig_ptr; + char *par, *val = NULL; + char hash1[HEXHASH_LEN+1], hash2[HEXHASH_LEN+1], hash3[HEXHASH_LEN+1]; + AVal user, nonce, *aptr = NULL; + AVal apptmp; + + /* llnw auth method + * Seems to be closely based on HTTP Digest Auth: + * http://tools.ietf.org/html/rfc2617 + * http://en.wikipedia.org/wiki/Digest_access_authentication + */ + + const char authmod[] = "llnw"; + const char realm[] = "live"; + const char method[] = "publish"; + const char qop[] = "auth"; + /* nc = 1..connection count (or rather, number of times cnonce has been reused) */ + int nc = 1; + /* nchex = hexenc(nc) (8 hex digits according to RFC 2617) */ + char nchex[9]; + /* cnonce = hexenc(4 random bytes) (initialized on first connection) */ + char cnonce[9]; + + ptr = orig_ptr = strdup(token_in); + /* Extract parameters (we need user and nonce) */ + while (ptr) + { + par = ptr; + ptr = strchr(par, '&'); + if(ptr) + *ptr++ = '\0'; + + val = strchr(par, '='); + if(val) + *val++ = '\0'; + + if (aptr) { + aptr->av_len = par - aptr->av_val - 1; + aptr = NULL; + } + if (strcmp(par, "user") == 0){ + user.av_val = val; + aptr = &user; + } else if (strcmp(par, "nonce") == 0){ + nonce.av_val = val; + aptr = &nonce; + } + + RTMP_Log(RTMP_LOGDEBUG, "%s, par:\"%s\" = val:\"%s\"", __FUNCTION__, par, val); + } + if (aptr) + aptr->av_len = strlen(aptr->av_val); + + /* FIXME: handle case where user==NULL or nonce==NULL */ + + sprintf(nchex, "%08x", nc); + sprintf(cnonce, "%08x", rand()); + + /* hash1 = hexenc(md5(user + ":" + realm + ":" + password)) */ + MD5_Init(&md5ctx); + MD5_Update(&md5ctx, user.av_val, user.av_len); + MD5_Update(&md5ctx, ":", 1); + MD5_Update(&md5ctx, realm, sizeof(realm)-1); + MD5_Update(&md5ctx, ":", 1); + MD5_Update(&md5ctx, r->Link.pubPasswd.av_val, r->Link.pubPasswd.av_len); + MD5_Final(md5sum_val, &md5ctx); + RTMP_Log(RTMP_LOGDEBUG, "%s, md5(%s:%s:%s) =>", __FUNCTION__, + user.av_val, realm, r->Link.pubPasswd.av_val); + RTMP_LogHexString(RTMP_LOGDEBUG, md5sum_val, MD5_DIGEST_LENGTH); + hexenc(md5sum_val, MD5_DIGEST_LENGTH, hash1); + + /* hash2 = hexenc(md5(method + ":/" + app + "/" + appInstance)) */ + /* Extract appname + appinstance without query parameters */ + apptmp = r->Link.app; + ptr = AValChr(&apptmp, '?'); + if (ptr) + apptmp.av_len = ptr - apptmp.av_val; + + MD5_Init(&md5ctx); + MD5_Update(&md5ctx, method, sizeof(method)-1); + MD5_Update(&md5ctx, ":/", 2); + MD5_Update(&md5ctx, apptmp.av_val, apptmp.av_len); + if (!AValChr(&apptmp, '/')) + MD5_Update(&md5ctx, "/_definst_", sizeof("/_definst_") - 1); + MD5_Final(md5sum_val, &md5ctx); + RTMP_Log(RTMP_LOGDEBUG, "%s, md5(%s:/%.*s) =>", __FUNCTION__, + method, apptmp.av_len, apptmp.av_val); + RTMP_LogHexString(RTMP_LOGDEBUG, md5sum_val, MD5_DIGEST_LENGTH); + hexenc(md5sum_val, MD5_DIGEST_LENGTH, hash2); + + /* hash3 = hexenc(md5(hash1 + ":" + nonce + ":" + nchex + ":" + cnonce + ":" + qop + ":" + hash2)) */ + MD5_Init(&md5ctx); + MD5_Update(&md5ctx, hash1, HEXHASH_LEN); + MD5_Update(&md5ctx, ":", 1); + MD5_Update(&md5ctx, nonce.av_val, nonce.av_len); + MD5_Update(&md5ctx, ":", 1); + MD5_Update(&md5ctx, nchex, sizeof(nchex)-1); + MD5_Update(&md5ctx, ":", 1); + MD5_Update(&md5ctx, cnonce, sizeof(cnonce)-1); + MD5_Update(&md5ctx, ":", 1); + MD5_Update(&md5ctx, qop, sizeof(qop)-1); + MD5_Update(&md5ctx, ":", 1); + MD5_Update(&md5ctx, hash2, HEXHASH_LEN); + MD5_Final(md5sum_val, &md5ctx); + RTMP_Log(RTMP_LOGDEBUG, "%s, md5(%s:%s:%s:%s:%s:%s) =>", __FUNCTION__, + hash1, nonce.av_val, nchex, cnonce, qop, hash2); + RTMP_LogHexString(RTMP_LOGDEBUG, md5sum_val, MD5_DIGEST_LENGTH); + hexenc(md5sum_val, MD5_DIGEST_LENGTH, hash3); + + /* pubToken = &authmod=&user=&nonce=&cnonce=&nc=&response= */ + /* Append nonces and response to query string which already contains + * user + authmod */ + pubToken.av_val = malloc(64 + sizeof(authmod)-1 + user.av_len + nonce.av_len + sizeof(cnonce)-1 + sizeof(nchex)-1 + HEXHASH_LEN); + sprintf(pubToken.av_val, + "&nonce=%s&cnonce=%s&nc=%s&response=%s", + nonce.av_val, cnonce, nchex, hash3); + pubToken.av_len = strlen(pubToken.av_val); + RTMP_Log(RTMP_LOGDEBUG, "%s, pubToken2: %s", __FUNCTION__, pubToken.av_val); + + free(orig_ptr); + } + else if(strstr(description->av_val, "?reason=authfail") != NULL) + { + RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed", __FUNCTION__); + return 0; + } + else if(strstr(description->av_val, "?reason=nosuchuser") != NULL) + { + RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: no such user", __FUNCTION__); + return 0; + } + else + { + RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: unknown auth mode: %s", + __FUNCTION__, description->av_val); + return 0; + } + + ptr = malloc(r->Link.app.av_len + pubToken.av_len); + strncpy(ptr, r->Link.app.av_val, r->Link.app.av_len); + strncpy(ptr + r->Link.app.av_len, pubToken.av_val, pubToken.av_len); + r->Link.app.av_len += pubToken.av_len; + if(r->Link.lFlags & RTMP_LF_FAPU) + free(r->Link.app.av_val); + r->Link.app.av_val = ptr; + + ptr = malloc(r->Link.tcUrl.av_len + pubToken.av_len); + strncpy(ptr, r->Link.tcUrl.av_val, r->Link.tcUrl.av_len); + strncpy(ptr + r->Link.tcUrl.av_len, pubToken.av_val, pubToken.av_len); + r->Link.tcUrl.av_len += pubToken.av_len; + if(r->Link.lFlags & RTMP_LF_FTCU) + free(r->Link.tcUrl.av_val); + r->Link.tcUrl.av_val = ptr; + + free(pubToken.av_val); + r->Link.lFlags |= RTMP_LF_FTCU | RTMP_LF_FAPU; + + RTMP_Log(RTMP_LOGDEBUG, "%s, new app: %.*s tcUrl: %.*s playpath: %s", __FUNCTION__, + r->Link.app.av_len, r->Link.app.av_val, + r->Link.tcUrl.av_len, r->Link.tcUrl.av_val, + r->Link.playpath.av_val); + } + else + { + return 0; + } + return 1; +} +#endif + + SAVC(onBWDone); SAVC(onFCSubscribe); SAVC(onFCUnsubscribe); @@ -2314,6 +2882,7 @@ SAVC(close); SAVC(code); SAVC(level); +SAVC(description); SAVC(onStatus); SAVC(playlist_ready); static const AVal av_NetStream_Failed = AVC("NetStream.Failed"); @@ -2332,6 +2901,8 @@ static const AVal av_NetStream_Play_UnpublishNotify = AVC("NetStream.Play.UnpublishNotify"); static const AVal av_NetStream_Publish_Start = AVC("NetStream.Publish.Start"); +static const AVal av_NetConnection_Connect_Rejected = +AVC("NetConnection.Connect.Rejected"); /* Returns 0 for OK/Failed/error, 1 for 'Stop or Complete' */ static int @@ -2473,7 +3044,57 @@ } else if (AVMATCH(&method, &av__error)) { +#ifdef CRYPTO + AVal methodInvoked = {0}; + int i; + + if (r->Link.protocol & RTMP_FEATURE_WRITE) + { + for (i=0; im_numCalls; i++) + { + if (r->m_methodCalls[i].num == txn) + { + methodInvoked = r->m_methodCalls[i].name; + AV_erase(r->m_methodCalls, &r->m_numCalls, i, FALSE); + break; + } + } + if (!methodInvoked.av_val) + { + RTMP_Log(RTMP_LOGDEBUG, "%s, received result id %f without matching request", + __FUNCTION__, txn); + goto leave; + } + + RTMP_Log(RTMP_LOGDEBUG, "%s, received error for method call <%s>", __FUNCTION__, + methodInvoked.av_val); + + if (AVMATCH(&methodInvoked, &av_connect)) + { + AMFObject obj2; + AVal code, level, description; + AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &obj2); + AMFProp_GetString(AMF_GetProp(&obj2, &av_code, -1), &code); + AMFProp_GetString(AMF_GetProp(&obj2, &av_level, -1), &level); + AMFProp_GetString(AMF_GetProp(&obj2, &av_description, -1), &description); + RTMP_Log(RTMP_LOGDEBUG, "%s, error description: %s", __FUNCTION__, description.av_val); + /* if PublisherAuth returns 1, then reconnect */ + if (PublisherAuth(r, &description) == 1) + { + CloseInternal(r, 1); + if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) + goto leave; + } + } + } + else + { + RTMP_Log(RTMP_LOGERROR, "rtmp server sent error"); + } + free(methodInvoked.av_val); +#else RTMP_Log(RTMP_LOGERROR, "rtmp server sent error"); +#endif } else if (AVMATCH(&method, &av_close)) { @@ -2588,7 +3209,7 @@ return TRUE; } - if (prop->p_type == AMF_OBJECT) + if (prop->p_type == AMF_OBJECT || prop->p_type == AMF_ECMA_ARRAY) { if (RTMP_FindFirstMatchingProperty(&prop->p_vu.p_object, name, p)) return TRUE; @@ -2627,47 +3248,44 @@ DumpMetaData(AMFObject *obj) { AMFObjectProperty *prop; - int n; + int n, len; for (n = 0; n < obj->o_num; n++) { + char str[256] = ""; prop = AMF_GetProp(obj, NULL, n); - if (prop->p_type != AMF_OBJECT) - { - char str[256] = ""; - switch (prop->p_type) - { - case AMF_NUMBER: - snprintf(str, 255, "%.2f", prop->p_vu.p_number); - break; - case AMF_BOOLEAN: - snprintf(str, 255, "%s", - prop->p_vu.p_number != 0. ? "TRUE" : "FALSE"); - break; - case AMF_STRING: - snprintf(str, 255, "%.*s", prop->p_vu.p_aval.av_len, - prop->p_vu.p_aval.av_val); - break; - case AMF_DATE: - snprintf(str, 255, "timestamp:%.2f", prop->p_vu.p_number); - break; - default: - snprintf(str, 255, "INVALID TYPE 0x%02x", - (unsigned char)prop->p_type); - } - if (prop->p_name.av_len) - { - /* chomp */ - if (strlen(str) >= 1 && str[strlen(str) - 1] == '\n') - str[strlen(str) - 1] = '\0'; - RTMP_Log(RTMP_LOGINFO, " %-22.*s%s", prop->p_name.av_len, - prop->p_name.av_val, str); - } - } - else + switch (prop->p_type) { + case AMF_OBJECT: + case AMF_ECMA_ARRAY: + case AMF_STRICT_ARRAY: if (prop->p_name.av_len) RTMP_Log(RTMP_LOGINFO, "%.*s:", prop->p_name.av_len, prop->p_name.av_val); DumpMetaData(&prop->p_vu.p_object); + break; + case AMF_NUMBER: + snprintf(str, 255, "%.2f", prop->p_vu.p_number); + break; + case AMF_BOOLEAN: + snprintf(str, 255, "%s", + prop->p_vu.p_number != 0. ? "TRUE" : "FALSE"); + break; + case AMF_STRING: + len = snprintf(str, 255, "%.*s", prop->p_vu.p_aval.av_len, + prop->p_vu.p_aval.av_val); + if (len >= 1 && str[len-1] == '\n') + str[len-1] = '\0'; + break; + case AMF_DATE: + snprintf(str, 255, "timestamp:%.2f", prop->p_vu.p_number); + break; + default: + snprintf(str, 255, "INVALID TYPE 0x%02x", + (unsigned char)prop->p_type); + } + if (str[0] && prop->p_name.av_len) + { + RTMP_Log(RTMP_LOGINFO, " %-22.*s%s", prop->p_name.av_len, + prop->p_name.av_val, str); } } return FALSE; @@ -2827,7 +3445,8 @@ break; if (!r->m_pausing) { - r->m_pauseStamp = r->m_channelTimestamp[r->m_mediaChannel]; + r->m_pauseStamp = r->m_mediaChannel < r->m_channelsAllocatedIn ? + r->m_channelTimestamp[r->m_mediaChannel] : 0; RTMP_SendPause(r, TRUE, r->m_pauseStamp); r->m_pausing = 1; } @@ -2931,6 +3550,7 @@ char *header = (char *)hbuf; int nSize, hSize, nToRead, nChunk; int didAlloc = FALSE; + int extendedTimestamp; RTMP_Log(RTMP_LOGDEBUG2, "%s: fd=%d", __FUNCTION__, r->m_sb.sb_socket); @@ -2972,6 +3592,26 @@ nSize = packetSize[packet->m_headerType]; + if (packet->m_nChannel >= r->m_channelsAllocatedIn) + { + int n = packet->m_nChannel + 10; + int *timestamp = realloc(r->m_channelTimestamp, sizeof(int) * n); + RTMPPacket **packets = realloc(r->m_vecChannelsIn, sizeof(RTMPPacket*) * n); + if (!timestamp) + free(r->m_channelTimestamp); + if (!packets) + free(r->m_vecChannelsIn); + r->m_channelTimestamp = timestamp; + r->m_vecChannelsIn = packets; + if (!timestamp || !packets) { + r->m_channelsAllocatedIn = 0; + return FALSE; + } + memset(r->m_channelTimestamp + r->m_channelsAllocatedIn, 0, sizeof(int) * (n - r->m_channelsAllocatedIn)); + memset(r->m_vecChannelsIn + r->m_channelsAllocatedIn, 0, sizeof(RTMPPacket*) * (n - r->m_channelsAllocatedIn)); + r->m_channelsAllocatedIn = n; + } + if (nSize == RTMP_LARGE_HEADER_SIZE) /* if we get a full header the timestamp is absolute */ packet->m_hasAbsTimestamp = TRUE; @@ -3013,17 +3653,19 @@ packet->m_nInfoField2 = DecodeInt32LE(header + 7); } } - if (packet->m_nTimeStamp == 0xffffff) + } + + extendedTimestamp = packet->m_nTimeStamp == 0xffffff; + if (extendedTimestamp) + { + if (ReadN(r, header + nSize, 4) != 4) { - if (ReadN(r, header + nSize, 4) != 4) - { - RTMP_Log(RTMP_LOGERROR, "%s, failed to read extended timestamp", - __FUNCTION__); - return FALSE; - } - packet->m_nTimeStamp = AMF_DecodeInt32(header + nSize); - hSize += 4; + RTMP_Log(RTMP_LOGERROR, "%s, failed to read extended timestamp", + __FUNCTION__); + return FALSE; } + packet->m_nTimeStamp = AMF_DecodeInt32(header + nSize); + hSize += 4; } RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)hbuf, hSize); @@ -3068,6 +3710,10 @@ if (!r->m_vecChannelsIn[packet->m_nChannel]) r->m_vecChannelsIn[packet->m_nChannel] = malloc(sizeof(RTMPPacket)); memcpy(r->m_vecChannelsIn[packet->m_nChannel], packet, sizeof(RTMPPacket)); + if (extendedTimestamp) + { + r->m_vecChannelsIn[packet->m_nChannel]->m_nTimeStamp = 0xffffff; + } if (RTMPPacket_IsReady(packet)) { @@ -3247,7 +3893,7 @@ int RTMP_SendPacket(RTMP *r, RTMPPacket *packet, int queue) { - const RTMPPacket *prevPacket = r->m_vecChannelsOut[packet->m_nChannel]; + const RTMPPacket *prevPacket; uint32_t last = 0; int nSize; int hSize, cSize; @@ -3257,6 +3903,22 @@ int nChunkSize; int tlen; + if (packet->m_nChannel >= r->m_channelsAllocatedOut) + { + int n = packet->m_nChannel + 10; + RTMPPacket **packets = realloc(r->m_vecChannelsOut, sizeof(RTMPPacket*) * n); + if (!packets) { + free(r->m_vecChannelsOut); + r->m_vecChannelsOut = NULL; + r->m_channelsAllocatedOut = 0; + return FALSE; + } + r->m_vecChannelsOut = packets; + memset(r->m_vecChannelsOut + r->m_channelsAllocatedOut, 0, sizeof(RTMPPacket*) * (n - r->m_channelsAllocatedOut)); + r->m_channelsAllocatedOut = n; + } + + prevPacket = r->m_vecChannelsOut[packet->m_nChannel]; if (prevPacket && packet->m_headerType != RTMP_PACKET_SIZE_LARGE) { /* compress a bit by using the prev packet's attributes */ @@ -3303,10 +3965,11 @@ hSize += cSize; } - if (nSize > 1 && t >= 0xffffff) + if (t >= 0xffffff) { header -= 4; hSize += 4; + RTMP_Log(RTMP_LOGWARNING, "Larger timestamp than 24-bit: 0x%x", t); } hptr = header; @@ -3345,7 +4008,7 @@ if (nSize > 8) hptr += EncodeInt32LE(hptr, packet->m_nInfoField2); - if (nSize > 1 && t >= 0xffffff) + if (t >= 0xffffff) hptr = AMF_EncodeInt32(hptr, hend, t); nSize = packet->m_nBodySize; @@ -3400,6 +4063,11 @@ header -= cSize; hSize += cSize; } + if (t >= 0xffffff) + { + header -= 4; + hSize += 4; + } *header = (0xc0 | c); if (cSize) { @@ -3408,6 +4076,11 @@ if (cSize == 2) header[2] = tmp >> 8; } + if (t >= 0xffffff) + { + char* extendedTimestamp = header + 1 + cSize; + AMF_EncodeInt32(extendedTimestamp, extendedTimestamp + 4, t); + } } } if (tbuf) @@ -3451,6 +4124,12 @@ void RTMP_Close(RTMP *r) { + CloseInternal(r, 0); +} + +static void +CloseInternal(RTMP *r, int reconnect) +{ int i; if (RTMP_IsConnected(r)) @@ -3493,7 +4172,7 @@ r->m_write.m_nBytesRead = 0; RTMPPacket_Free(&r->m_write); - for (i = 0; i < RTMP_CHANNELS; i++) + for (i = 0; i < r->m_channelsAllocatedIn; i++) { if (r->m_vecChannelsIn[i]) { @@ -3501,12 +4180,23 @@ free(r->m_vecChannelsIn[i]); r->m_vecChannelsIn[i] = NULL; } + } + free(r->m_vecChannelsIn); + r->m_vecChannelsIn = NULL; + free(r->m_channelTimestamp); + r->m_channelTimestamp = NULL; + r->m_channelsAllocatedIn = 0; + for (i = 0; i < r->m_channelsAllocatedOut; i++) + { if (r->m_vecChannelsOut[i]) { free(r->m_vecChannelsOut[i]); r->m_vecChannelsOut[i] = NULL; } } + free(r->m_vecChannelsOut); + r->m_vecChannelsOut = NULL; + r->m_channelsAllocatedOut = 0; AV_clear(r->m_methodCalls, r->m_numCalls); r->m_methodCalls = NULL; r->m_numCalls = 0; @@ -3519,16 +4209,24 @@ r->m_resplen = 0; r->m_unackd = 0; - free(r->Link.playpath0.av_val); - r->Link.playpath0.av_val = NULL; - - if (r->Link.lFlags & RTMP_LF_FTCU) + if (r->Link.lFlags & RTMP_LF_FTCU && !reconnect) { free(r->Link.tcUrl.av_val); r->Link.tcUrl.av_val = NULL; r->Link.lFlags ^= RTMP_LF_FTCU; } + if (r->Link.lFlags & RTMP_LF_FAPU && !reconnect) + { + free(r->Link.app.av_val); + r->Link.app.av_val = NULL; + r->Link.lFlags ^= RTMP_LF_FAPU; + } + if (!reconnect) + { + free(r->Link.playpath0.av_val); + r->Link.playpath0.av_val = NULL; + } #ifdef CRYPTO if (r->Link.dh) { @@ -3558,7 +4256,7 @@ while (1) { - nBytes = sizeof(sb->sb_buf) - sb->sb_size - (sb->sb_start - sb->sb_buf); + nBytes = sizeof(sb->sb_buf) - 1 - sb->sb_size - (sb->sb_start - sb->sb_buf); #if defined(CRYPTO) && !defined(NO_SSL) if (sb->sb_ssl) { @@ -3710,8 +4408,8 @@ int hlen = snprintf(hbuf, sizeof(hbuf), "POST /%s%s/%d HTTP/1.1\r\n" "Host: %.*s:%d\r\n" "Accept: */*\r\n" - "User-Agent: Shockwave Flash\n" - "Connection: Keep-Alive\n" + "User-Agent: Shockwave Flash\r\n" + "Connection: Keep-Alive\r\n" "Cache-Control: no-cache\r\n" "Content-type: application/x-fcs\r\n" "Content-length: %d\r\n\r\n", RTMPT_cmds[cmd], @@ -3731,12 +4429,23 @@ char *ptr; int hlen; +restart: if (fill) RTMPSockBuf_Fill(&r->m_sb); - if (r->m_sb.sb_size < 144) + if (r->m_sb.sb_size < 13) { + if (fill) + goto restart; return -2; + } if (strncmp(r->m_sb.sb_start, "HTTP/1.1 200 ", 13)) return -1; + r->m_sb.sb_start[r->m_sb.sb_size] = '\0'; + if (!strstr(r->m_sb.sb_start, "\r\n\r\n")) { + if (fill) + goto restart; + return -2; + } + ptr = r->m_sb.sb_start + sizeof("HTTP/1.1 200"); while ((ptr = strstr(ptr, "Content-"))) { if (!strncasecmp(ptr+8, "length:", 7)) break; @@ -3749,6 +4458,12 @@ if (!ptr) return -1; ptr += 4; + if (ptr + (r->m_clientID.av_val ? 1 : hlen) > r->m_sb.sb_start + r->m_sb.sb_size) + { + if (fill) + goto restart; + return -2; + } r->m_sb.sb_size -= ptr - r->m_sb.sb_start; r->m_sb.sb_start = ptr; r->m_unackd--; @@ -4289,6 +5004,7 @@ memcpy(mybuf, flvHeader, sizeof(flvHeader)); r->m_read.buf += sizeof(flvHeader); r->m_read.buflen -= sizeof(flvHeader); + cnt += sizeof(flvHeader); while (r->m_read.timestamp == 0) { @@ -4305,6 +5021,7 @@ if (r->m_read.buf < mybuf || r->m_read.buf > end) { mybuf = realloc(mybuf, cnt + nRead); memcpy(mybuf+cnt, r->m_read.buf, nRead); + free(r->m_read.buf); r->m_read.buf = mybuf+cnt+nRead; break; } diff -Nru rtmpdump-2.4+20121230.gitdf6c518/librtmp/rtmp.h rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/rtmp.h --- rtmpdump-2.4+20121230.gitdf6c518/librtmp/rtmp.h 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/rtmp.h 2015-01-27 19:17:52.000000000 +0000 @@ -157,6 +157,8 @@ AVal subscribepath; AVal usherToken; AVal token; + AVal pubUser; + AVal pubPasswd; AMFObject extras; int edepth; @@ -169,6 +171,7 @@ #define RTMP_LF_PLST 0x0008 /* send playlist before play */ #define RTMP_LF_BUFX 0x0010 /* toggle stream on BufferEmpty msg */ #define RTMP_LF_FTCU 0x0020 /* free tcUrl on close */ +#define RTMP_LF_FAPU 0x0040 /* free app on close */ int lFlags; int swfAge; @@ -176,6 +179,8 @@ int protocol; int timeout; /* connection timeout in seconds */ + int pFlags; /* unused, but kept to avoid breaking ABI */ + unsigned short socksport; unsigned short port; @@ -253,9 +258,11 @@ int m_numCalls; RTMP_METHOD *m_methodCalls; /* remote method calls queue */ - RTMPPacket *m_vecChannelsIn[RTMP_CHANNELS]; - RTMPPacket *m_vecChannelsOut[RTMP_CHANNELS]; - int m_channelTimestamp[RTMP_CHANNELS]; /* abs timestamp of last packet */ + int m_channelsAllocatedIn; + int m_channelsAllocatedOut; + RTMPPacket **m_vecChannelsIn; + RTMPPacket **m_vecChannelsOut; + int *m_channelTimestamp; /* abs timestamp of last packet */ double m_fAudioCodecs; /* audioCodecs for the connect packet */ double m_fVideoCodecs; /* videoCodecs for the connect packet */ @@ -307,6 +314,7 @@ int RTMP_Connect0(RTMP *r, struct sockaddr *svc); int RTMP_Connect1(RTMP *r, RTMPPacket *cp); int RTMP_Serve(RTMP *r); + int RTMP_TLS_Accept(RTMP *r, void *ctx); int RTMP_ReadPacket(RTMP *r, RTMPPacket *packet); int RTMP_SendPacket(RTMP *r, RTMPPacket *packet, int queue); @@ -329,6 +337,9 @@ void RTMP_Free(RTMP *r); void RTMP_EnableWrite(RTMP *r); + void *RTMP_TLS_AllocServerContext(const char* cert, const char* key); + void RTMP_TLS_FreeServerContext(void *ctx); + int RTMP_LibVersion(void); void RTMP_UserInterrupt(void); /* user typed Ctrl-C */ diff -Nru rtmpdump-2.4+20121230.gitdf6c518/librtmp/rtmp_sys.h rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/rtmp_sys.h --- rtmpdump-2.4+20121230.gitdf6c518/librtmp/rtmp_sys.h 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/librtmp/rtmp_sys.h 2015-01-27 19:17:52.000000000 +0000 @@ -61,21 +61,46 @@ #include "rtmp.h" #ifdef USE_POLARSSL +#include #include #include #include +#if POLARSSL_VERSION_NUMBER < 0x01010000 +#define havege_random havege_rand +#endif +#if POLARSSL_VERSION_NUMBER >= 0x01020000 +#define SSL_SET_SESSION(S,resume,timeout,ctx) ssl_set_session(S,ctx) +#else +#define SSL_SET_SESSION(S,resume,timeout,ctx) ssl_set_session(S,resume,timeout,ctx) +#endif typedef struct tls_ctx { havege_state hs; ssl_session ssn; } tls_ctx; +typedef struct tls_server_ctx { + havege_state *hs; + x509_cert cert; + rsa_context key; + ssl_session ssn; + const char *dhm_P, *dhm_G; +} tls_server_ctx; + #define TLS_CTX tls_ctx * #define TLS_client(ctx,s) s = malloc(sizeof(ssl_context)); ssl_init(s);\ ssl_set_endpoint(s, SSL_IS_CLIENT); ssl_set_authmode(s, SSL_VERIFY_NONE);\ - ssl_set_rng(s, havege_rand, &ctx->hs);\ + ssl_set_rng(s, havege_random, &ctx->hs);\ + ssl_set_ciphersuites(s, ssl_default_ciphersuites);\ + SSL_SET_SESSION(s, 1, 600, &ctx->ssn) +#define TLS_server(ctx,s) s = malloc(sizeof(ssl_context)); ssl_init(s);\ + ssl_set_endpoint(s, SSL_IS_SERVER); ssl_set_authmode(s, SSL_VERIFY_NONE);\ + ssl_set_rng(s, havege_random, ((tls_server_ctx*)ctx)->hs);\ ssl_set_ciphersuites(s, ssl_default_ciphersuites);\ - ssl_set_session(s, 1, 600, &ctx->ssn) + SSL_SET_SESSION(s, 1, 600, &((tls_server_ctx*)ctx)->ssn);\ + ssl_set_own_cert(s, &((tls_server_ctx*)ctx)->cert, &((tls_server_ctx*)ctx)->key);\ + ssl_set_dh_param(s, ((tls_server_ctx*)ctx)->dhm_P, ((tls_server_ctx*)ctx)->dhm_G) #define TLS_setfd(s,fd) ssl_set_bio(s, net_recv, &fd, net_send, &fd) #define TLS_connect(s) ssl_handshake(s) +#define TLS_accept(s) ssl_handshake(s) #define TLS_read(s,b,l) ssl_read(s,(unsigned char *)b,l) #define TLS_write(s,b,l) ssl_write(s,(unsigned char *)b,l) #define TLS_shutdown(s) ssl_close_notify(s) @@ -89,8 +114,10 @@ } tls_ctx; #define TLS_CTX tls_ctx * #define TLS_client(ctx,s) gnutls_init((gnutls_session_t *)(&s), GNUTLS_CLIENT); gnutls_priority_set(s, ctx->prios); gnutls_credentials_set(s, GNUTLS_CRD_CERTIFICATE, ctx->cred) +#define TLS_server(ctx,s) gnutls_init((gnutls_session_t *)(&s), GNUTLS_SERVER); gnutls_priority_set_direct(s, "NORMAL", NULL); gnutls_credentials_set(s, GNUTLS_CRD_CERTIFICATE, ctx) #define TLS_setfd(s,fd) gnutls_transport_set_ptr(s, (gnutls_transport_ptr_t)(long)fd) #define TLS_connect(s) gnutls_handshake(s) +#define TLS_accept(s) gnutls_handshake(s) #define TLS_read(s,b,l) gnutls_record_recv(s,b,l) #define TLS_write(s,b,l) gnutls_record_send(s,b,l) #define TLS_shutdown(s) gnutls_bye(s, GNUTLS_SHUT_RDWR) @@ -99,8 +126,10 @@ #else /* USE_OPENSSL */ #define TLS_CTX SSL_CTX * #define TLS_client(ctx,s) s = SSL_new(ctx) +#define TLS_server(ctx,s) s = SSL_new(ctx) #define TLS_setfd(s,fd) SSL_set_fd(s,fd) #define TLS_connect(s) SSL_connect(s) +#define TLS_accept(s) SSL_accept(s) #define TLS_read(s,b,l) SSL_read(s,b,l) #define TLS_write(s,b,l) SSL_write(s,b,l) #define TLS_shutdown(s) SSL_shutdown(s) diff -Nru rtmpdump-2.4+20121230.gitdf6c518/Makefile rtmpdump-2.4+20150114.gita107cef9b~trusty/Makefile --- rtmpdump-2.4+20121230.gitdf6c518/Makefile 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/Makefile 2015-01-27 19:17:52.000000000 +0000 @@ -12,7 +12,7 @@ #CRYPTO=POLARSSL #CRYPTO=GNUTLS LIBZ=-lz -LIB_GNUTLS=-lgnutls -lgcrypt $(LIBZ) +LIB_GNUTLS=-lgnutls -lhogweed -lnettle -lgmp $(LIBZ) LIB_OPENSSL=-lssl -lcrypto $(LIBZ) LIB_POLARSSL=-lpolarssl $(LIBZ) CRYPTO_LIB=$(LIB_$(CRYPTO)) diff -Nru rtmpdump-2.4+20121230.gitdf6c518/rtmpdump.1 rtmpdump-2.4+20150114.gita107cef9b~trusty/rtmpdump.1 --- rtmpdump-2.4+20121230.gitdf6c518/rtmpdump.1 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/rtmpdump.1 2015-01-27 19:17:52.000000000 +0000 @@ -1,4 +1,4 @@ -.TH RTMPDUMP 1 "2011-07-20" "RTMPDump v2.4" +.TH RTMPDUMP 1 "2012-07-24" "RTMPDump v2.4" .\" Copyright 2011 Howard Chu. .\" Copying permitted according to the GNU General Public License V2. .SH NAME @@ -177,6 +177,12 @@ Name of live stream to subscribe to. Defaults to .IR playpath . .TP +.B \-\-realtime \-R +Download approximately in realtime, without attempting to speed up via +Pause/Unpause commands ("the BUFX hack"). +Useful for servers that jump backwards in time at the Unpause command. +Resuming and seeking in realtime streams is still possible. +.TP .B \-\-resume \-e Resume an incomplete RTMP download. .TP diff -Nru rtmpdump-2.4+20121230.gitdf6c518/rtmpdump.1.html rtmpdump-2.4+20150114.gita107cef9b~trusty/rtmpdump.1.html --- rtmpdump-2.4+20121230.gitdf6c518/rtmpdump.1.html 2013-05-01 09:57:27.000000000 +0000 +++ rtmpdump-2.4+20150114.gita107cef9b~trusty/rtmpdump.1.html 2015-01-27 19:17:52.000000000 +0000 @@ -6,7 +6,7 @@ RTMPDUMP(1)RTMPDUMP(1) -RTMPDump v2.42011-07-20RTMPDUMP(1) +RTMPDump v2.42012-07-24RTMPDUMP(1)