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.
This commit is contained in:
Alessandro Ros
2025-02-18 15:18:17 +01:00
committed by GitHub
parent 244da930a1
commit b950a0a601
2 changed files with 8 additions and 0 deletions
+3
View File
@@ -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
+5
View File
@@ -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))