@@ -42,6 +42,15 @@ func credentialsProvided(req *base.Request) bool {
4242 return err == nil && auth .Username != ""
4343}
4444
45+ func contains (list []rtspauth.VerifyMethod , item rtspauth.VerifyMethod ) bool {
46+ for _ , i := range list {
47+ if i == item {
48+ return true
49+ }
50+ }
51+ return false
52+ }
53+
4554type connParent interface {
4655 logger.Writer
4756 findSessionByRSessionUnsafe (rsession * gortsplib.ServerSession ) * session
@@ -138,16 +147,23 @@ func (c *conn) onDescribe(ctx *gortsplib.ServerHandlerOnDescribeCtx,
138147 }
139148 ctx .Path = ctx .Path [1 :]
140149
141- req := defs.PathAccessRequest {
142- Name : ctx .Path ,
143- Query : ctx .Query ,
144- Proto : auth .ProtocolRTSP ,
145- ID : & c .uuid ,
146- Credentials : rtsp .Credentials (ctx .Request ),
147- IP : c .ip (),
148- CustomVerifyFunc : func (expectedUser , expectedPass string ) bool {
150+ // CustomVerifyFunc prevents hashed credentials from working.
151+ // Use it only when strictly needed.
152+ var customVerifyFunc func (expectedUser , expectedPass string ) bool
153+ if contains (c .authMethods , rtspauth .VerifyMethodDigestMD5 ) {
154+ customVerifyFunc = func (expectedUser , expectedPass string ) bool {
149155 return c .rconn .VerifyCredentials (ctx .Request , expectedUser , expectedPass )
150- },
156+ }
157+ }
158+
159+ req := defs.PathAccessRequest {
160+ Name : ctx .Path ,
161+ Query : ctx .Query ,
162+ Proto : auth .ProtocolRTSP ,
163+ ID : & c .uuid ,
164+ Credentials : rtsp .Credentials (ctx .Request ),
165+ IP : c .ip (),
166+ CustomVerifyFunc : customVerifyFunc ,
151167 }
152168
153169 res := c .pathManager .Describe (defs.PathDescribeReq {
0 commit comments