From b950a0a60102be3fb20d415dc0cd9ab6bf77d3b8 Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Tue, 18 Feb 2025 15:18:17 +0100 Subject: [PATCH] rtsp: fix authentication when rtspAuthMethods is empty (#4266) when rtspAuthMethods is nil, digest+SHA256 gets enabled, resulting in the inability of FFmpeg and most clients to connect due to compatibility issues. --- internal/conf/conf.go | 3 +++ internal/conf/conf_test.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/internal/conf/conf.go b/internal/conf/conf.go index 5ef13499..eedfa9bd 100644 --- a/internal/conf/conf.go +++ b/internal/conf/conf.go @@ -642,6 +642,9 @@ func (conf *Conf) Validate(l logger.Writer) error { l.Log(logger.Warn, "parameter 'serverKey' is deprecated and has been replaced with 'rtspServerKey'") conf.RTSPServerKey = *conf.ServerKey } + if len(conf.RTSPAuthMethods) == 0 { + return fmt.Errorf("at least one 'rtspAuthMethods' must be provided") + } // RTMP diff --git a/internal/conf/conf_test.go b/internal/conf/conf_test.go index e2fd9abc..ca0b930b 100644 --- a/internal/conf/conf_test.go +++ b/internal/conf/conf_test.go @@ -374,6 +374,11 @@ func TestConfErrors(t *testing.T) { "authJWTClaimKey: \"\"", "'authJWTClaimKey' is empty", }, + { + "invalid rtsp auth methods", + "rtspAuthMethods: []", + "at least one 'rtspAuthMethods' must be provided", + }, } { t.Run(ca.name, func(t *testing.T) { tmpf, err := createTempFile([]byte(ca.conf))