Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 2/2] avformat/rtsp: add TLS options
Date: Mon, 7 Jul 2025 13:15:53 +0200
Message-ID: <AS8P250MB0744278E6E921ED60CDB45008F4FA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20250624192345.44376-2-epirat07@gmail.com>

Marvin Scholz:
> From: Daniel N Pettersson <danielnp@axis.com>
> 
> Add TLS options to RTSP for when TLS is used for the lower protocol.
> 
> Signed-off-by: Marvin Scholz <epirat07@gmail.com>
> Co-authored-by: Marvin Scholz <epirat07@gmail.com>
> ---
>  libavformat/rtsp.c | 26 +++++++++++++++++++++++++-
>  libavformat/rtsp.h | 11 +++++++++++
>  2 files changed, 36 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 3f2966414f..8d360b375f 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c>  
> +/**
> + * Add the TLS options of the given RTSPState to the dict
> + */
> +static void copy_tls_opts_dict(RTSPState *rt, AVDictionary **dict)
> +{
> +    av_dict_set_int(dict, "tls_verify", rt->tls_opts.verify, 0);
> +    av_dict_set(dict, "ca_file", rt->tls_opts.ca_file, 0);
> +    av_dict_set(dict, "cert_file", rt->tls_opts.cert_file, 0);
> +    av_dict_set(dict, "key_file", rt->tls_opts.key_file, 0);
> +    av_dict_set(dict, "verifyhost", rt->tls_opts.host, 0);
> +}

Should this not be checked?

> +
>  static void get_word_until_chars(char *buf, int buf_size,
>                                   const char *sep, const char **pp)
>  {
> @@ -1821,6 +1837,8 @@ redirect:
>          AVDictionary *options = NULL;
>  
>          av_dict_set_int(&options, "timeout", rt->stimeout, 0);
> +        if (https_tunnel)
> +            copy_tls_opts_dict(rt, &options);
>  
>          ff_url_join(httpname, sizeof(httpname), https_tunnel ? "https" : "http", auth, host, port, "%s", path);
>          snprintf(sessioncookie, sizeof(sessioncookie), "%08x%08x",
> @@ -1905,14 +1923,20 @@ redirect:
>      } else {
>          int ret;
>          /* open the tcp connection */
> +        AVDictionary *proto_opts = NULL;
> +        if (strcmp("tls", lower_rtsp_proto) == 0)
> +            copy_tls_opts_dict(rt, &proto_opts);
> +
>          ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL,
>                      host, port,
>                      "?timeout=%"PRId64, rt->stimeout);
>          if ((ret = ffurl_open_whitelist(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
> -                       &s->interrupt_callback, NULL, s->protocol_whitelist, s->protocol_blacklist, NULL)) < 0) {
> +                       &s->interrupt_callback, &proto_opts, s->protocol_whitelist, s->protocol_blacklist, NULL)) < 0) {
> +            av_dict_free(&proto_opts);
>              err = ret;
>              goto fail;
>          }
> +        av_dict_free(&proto_opts);
>          rt->rtsp_hd_out = rt->rtsp_hd;
>      }
>      rt->seq = 0;
> diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
> index 83b2e3f4fb..ca278acd43 100644
> --- a/libavformat/rtsp.h
> +++ b/libavformat/rtsp.h
> @@ -419,6 +419,17 @@ typedef struct RTSPState {
>      int buffer_size;
>      int pkt_size;
>      char *localaddr;
> +
> +    /**
> +     * Options used for TLS based RTSP streams.
> +     */
> +    struct {
> +        char *ca_file;
> +        int verify;
> +        char *cert_file;
> +        char *key_file;
> +        char *host;
> +    } tls_opts;
>  } RTSPState;
>  
>  #define RTSP_FLAG_FILTER_SRC  0x1    /**< Filter incoming UDP packets -

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2025-07-07 11:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24 19:23 [FFmpeg-devel] [PATCH 1/2] avformat/tls: move common client options into their own define Marvin Scholz
2025-06-24 19:23 ` [FFmpeg-devel] [PATCH 2/2] avformat/rtsp: add TLS options Marvin Scholz
2025-07-07 11:15   ` Andreas Rheinhardt [this message]
2025-07-04 15:14 ` [FFmpeg-devel] [PATCH 1/2] avformat/tls: move common client options into their own define Marvin Scholz
2025-07-07  0:08 ` Marvin Scholz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB0744278E6E921ED60CDB45008F4FA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git