Projects
Essentials
rtmpdump
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 11
View file
rtmpdump.changes
Changed
@@ -1,4 +1,18 @@ ------------------------------------------------------------------- +Fri Mar 06 08:45:23 UTC 2015 - joerg.lorenzen@ki.tng.de + +- update to 2.4.git20150115 + * Add extended timestamp for Type 3 chunks if necessary + * Replace RTMP_PUB_ALLOC with RTMP_LF_FTCU and RTMP_LF_FAPU + * Simplify the logic for freeing reused strings in RTMP_Close + * Set RTMP_PUB_ALLOC if tcUrl is allocated in PublisherAuth + * Reconnect directly when authenticating, don't wait for the close message + * Extended timestamp field may be present in type 3 chunk headers + * Fix leaks in AMF objects that contain arrays + * Free the extra read buffer if the initial FLV buffer overflowed + * Correct the count of bytes written to the initial FLV buffer + +------------------------------------------------------------------- Mon Nov 25 15:15:00 UTC 2013 - joerg.lorenzen@ki.tng.de - update to 2.4.git20131007
View file
rtmpdump.spec
Changed
@@ -4,7 +4,7 @@ # Name: rtmpdump -Version: 2.4.git20131007 +Version: 2.4.git20150115 Release: 0 License: GPL-2.0 %define soname 1
View file
rtmpdump-2.4.git20131007.tar.bz2/librtmp/amf.c -> rtmpdump-2.4.git20150115.tar.bz2/librtmp/amf.c
Changed
@@ -861,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 {
View file
rtmpdump-2.4.git20131007.tar.bz2/librtmp/rtmp.c -> rtmpdump-2.4.git20150115.tar.bz2/librtmp/rtmp.c
Changed
@@ -142,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 @@ -2538,7 +2540,6 @@ { 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__); - r->Link.pFlags |= RTMP_PUB_CLEAN; 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); @@ -2546,10 +2547,8 @@ av_authmod_adobe.av_val, r->Link.pubUser.av_val); RTMP_Log(RTMP_LOGDEBUG, "%s, pubToken1: %s", __FUNCTION__, pubToken.av_val); - r->Link.pFlags |= RTMP_PUB_NAME; } else { RTMP_Log(RTMP_LOGERROR, "%s, need to set pubUser & pubPasswd for publisher auth", __FUNCTION__); - r->Link.pFlags |= RTMP_PUB_CLEAN; return 0; } } @@ -2639,25 +2638,21 @@ opaque.av_len ? opaque.av_val : ""); RTMP_Log(RTMP_LOGDEBUG, "%s, pubToken2: %s", __FUNCTION__, pubToken.av_val); free(orig_ptr); - r->Link.pFlags |= RTMP_PUB_RESP|RTMP_PUB_CLATE; } else if(strstr(description->av_val, "?reason=authfailed") != NULL) { RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: wrong password", __FUNCTION__); - r->Link.pFlags |= RTMP_PUB_CLEAN; return 0; } else if(strstr(description->av_val, "?reason=nosuchuser") != NULL) { RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: no such user", __FUNCTION__); - r->Link.pFlags |= RTMP_PUB_CLEAN; return 0; } else { RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: unknown auth mode: %s", __FUNCTION__, description->av_val); - r->Link.pFlags |= RTMP_PUB_CLEAN; return 0; } @@ -2665,7 +2660,7 @@ 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.pFlags & RTMP_PUB_ALLOC) + if(r->Link.lFlags & RTMP_LF_FAPU) free(r->Link.app.av_val); r->Link.app.av_val = ptr; @@ -2673,12 +2668,12 @@ 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.pFlags & RTMP_PUB_ALLOC) + 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.pFlags |= RTMP_PUB_ALLOC; + 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, @@ -2693,7 +2688,6 @@ 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__); - r->Link.pFlags |= RTMP_PUB_CLEAN; 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); @@ -2701,10 +2695,8 @@ av_authmod_llnw.av_val, r->Link.pubUser.av_val); RTMP_Log(RTMP_LOGDEBUG, "%s, pubToken1: %s", __FUNCTION__, pubToken.av_val); - r->Link.pFlags |= RTMP_PUB_NAME; } else { RTMP_Log(RTMP_LOGERROR, "%s, need to set pubUser & pubPasswd for publisher auth", __FUNCTION__); - r->Link.pFlags |= RTMP_PUB_CLEAN; return 0; } } @@ -2828,27 +2820,23 @@ nonce.av_val, cnonce, nchex, hash3); pubToken.av_len = strlen(pubToken.av_val); RTMP_Log(RTMP_LOGDEBUG, "%s, pubToken2: %s", __FUNCTION__, pubToken.av_val); - r->Link.pFlags |= RTMP_PUB_RESP|RTMP_PUB_CLATE; free(orig_ptr); } else if(strstr(description->av_val, "?reason=authfail") != NULL) { RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed", __FUNCTION__); - r->Link.pFlags |= RTMP_PUB_CLEAN; return 0; } else if(strstr(description->av_val, "?reason=nosuchuser") != NULL) { RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: no such user", __FUNCTION__); - r->Link.pFlags |= RTMP_PUB_CLEAN; return 0; } else { RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: unknown auth mode: %s", __FUNCTION__, description->av_val); - r->Link.pFlags |= RTMP_PUB_CLEAN; return 0; } @@ -2856,7 +2844,7 @@ 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.pFlags & RTMP_PUB_ALLOC) + if(r->Link.lFlags & RTMP_LF_FAPU) free(r->Link.app.av_val); r->Link.app.av_val = ptr; @@ -2864,12 +2852,12 @@ 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.pFlags & RTMP_PUB_ALLOC) + 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.pFlags |= RTMP_PUB_ALLOC; + 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, @@ -3091,7 +3079,12 @@ 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 */ - PublisherAuth(r, &description); + if (PublisherAuth(r, &description) == 1) + { + CloseInternal(r, 1); + if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) + goto leave; + } } } else @@ -3107,22 +3100,6 @@ { RTMP_Log(RTMP_LOGERROR, "rtmp server requested close"); RTMP_Close(r); -#ifdef CRYPTO - if ((r->Link.protocol & RTMP_FEATURE_WRITE) && - !(r->Link.pFlags & RTMP_PUB_CLEAN) && - ( !(r->Link.pFlags & RTMP_PUB_NAME) || - !(r->Link.pFlags & RTMP_PUB_RESP) || - (r->Link.pFlags & RTMP_PUB_CLATE) ) ) - { - /* clean later */ - if(r->Link.pFlags & RTMP_PUB_CLATE) - r->Link.pFlags |= RTMP_PUB_CLEAN; - RTMP_Log(RTMP_LOGERROR, "authenticating publisher"); - - if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) - goto leave; - } -#endif } else if (AVMATCH(&method, &av_onStatus)) { @@ -3573,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); @@ -3675,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); @@ -3730,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)) { @@ -3981,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; @@ -4023,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; @@ -4078,6 +4063,11 @@ header -= cSize; hSize += cSize; } + if (t >= 0xffffff) + { + header -= 4; + hSize += 4; + } *header = (0xc0 | c); if (cSize) { @@ -4086,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) @@ -4129,6 +4124,12 @@ void RTMP_Close(RTMP *r) { + CloseInternal(r, 0); +} + +static void +CloseInternal(RTMP *r, int reconnect) +{ int i; if (RTMP_IsConnected(r)) @@ -4208,28 +4209,25 @@ r->m_resplen = 0; r->m_unackd = 0; - 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; + } -#ifdef CRYPTO - if (!(r->Link.protocol & RTMP_FEATURE_WRITE) || (r->Link.pFlags & RTMP_PUB_CLEAN)) + if (!reconnect) { free(r->Link.playpath0.av_val); r->Link.playpath0.av_val = NULL; } - if ((r->Link.protocol & RTMP_FEATURE_WRITE) && - (r->Link.pFlags & RTMP_PUB_CLEAN) && - (r->Link.pFlags & RTMP_PUB_ALLOC)) - { - free(r->Link.app.av_val); - r->Link.app.av_val = NULL; - free(r->Link.tcUrl.av_val); - r->Link.tcUrl.av_val = NULL; - } +#ifdef CRYPTO if (r->Link.dh) { MDH_free(r->Link.dh); @@ -4245,9 +4243,6 @@ RC4_free(r->Link.rc4keyOut); r->Link.rc4keyOut = NULL; } -#else - free(r->Link.playpath0.av_val); - r->Link.playpath0.av_val = NULL; #endif } @@ -5009,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) { @@ -5025,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; }
View file
rtmpdump-2.4.git20131007.tar.bz2/librtmp/rtmp.h -> rtmpdump-2.4.git20150115.tar.bz2/librtmp/rtmp.h
Changed
@@ -171,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; @@ -178,12 +179,7 @@ int protocol; int timeout; /* connection timeout in seconds */ -#define RTMP_PUB_NAME 0x0001 /* send login to server */ -#define RTMP_PUB_RESP 0x0002 /* send salted password hash */ -#define RTMP_PUB_ALLOC 0x0004 /* allocated data for new tcUrl & app */ -#define RTMP_PUB_CLEAN 0x0008 /* need to free allocated data for newer tcUrl & app at exit */ -#define RTMP_PUB_CLATE 0x0010 /* late clean tcUrl & app at exit */ - int pFlags; + int pFlags; /* unused, but kept to avoid breaking ABI */ unsigned short socksport; unsigned short port;
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.