[SCM] rtmpdump/upstream: Set RTMP_PUB_ALLOC if tcUrl is allocated in PublisherAuth

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jul 20 00:29:38 UTC 2014


The following commit has been merged in the upstream branch:
commit 0226b868539463e27dead0892bb48493ddcd0337
Author: Martin Storsjo <martin at martin.st>
Date:   Sun Jul 6 00:44:29 2014 +0300

    Set RTMP_PUB_ALLOC if tcUrl is allocated in PublisherAuth
    
    This makes sure we don't free tcUrl in RTMP_Close when reconnecting,
    and avoids leaks (or simplifies code to avoid leaks).
    
    This fixes connecting with authentication (both adobe and limelight)
    when the app has been specified separately from the rest of the url.
    
    This is only a temporary step while refactoring, this is removed
    in a later commit.

diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
index a6ea64d..75906be 100644
--- a/librtmp/rtmp.c
+++ b/librtmp/rtmp.c
@@ -2532,6 +2532,19 @@ PublisherAuth(RTMP *r, AVal *description)
   char salted2[SALTED2_LEN];
   AVal pubToken;
 
+  // If tcUrl is allocated, set RTMP_PUB_ALLOC instead to simplify checks below.
+  // This also avoids accidentally freeing tcUrl in RTMP_Close when reconnecting.
+  if (r->Link.lFlags & RTMP_LF_FTCU && !(r->Link.pFlags & RTMP_PUB_ALLOC))
+    {
+      ptr = malloc(r->Link.app.av_len + 1);
+      strncpy(ptr, r->Link.app.av_val, r->Link.app.av_len);
+      ptr[r->Link.app.av_len] = '\0'; // We use strstr on this string below
+      r->Link.app.av_val = ptr;
+
+      r->Link.lFlags &= ~RTMP_LF_FTCU;
+      r->Link.pFlags |= RTMP_PUB_ALLOC;
+    }
+
   if (strstr(description->av_val, av_authmod_adobe.av_val) != NULL)
     {
       if(strstr(description->av_val, "code=403 need auth") != NULL)

-- 
rtmpdump packaging



More information about the pkg-multimedia-commits mailing list