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:
@@ -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
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user