When getting a "404 Not Found" response from the DESCRIBE request, the
source produced a "No supported authentication protocol was found" error
instead of passing on the 404, which was confusing.
Only produce this error message when we're handling a response of "401
Unauthorized" without a compatible WWW-Authenticate header.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3414>
*
* At the moment, for Basic auth, we just do a minimal check and don't
* even parse out the realm */
*
* At the moment, for Basic auth, we just do a minimal check and don't
* even parse out the realm */
gst_rtspsrc_parse_auth_hdr (GstRTSPMessage * response,
GstRTSPAuthMethod * methods, GstRTSPConnection * conn, gboolean * stale)
{
GstRTSPAuthCredential **credentials, **credential;
gst_rtspsrc_parse_auth_hdr (GstRTSPMessage * response,
GstRTSPAuthMethod * methods, GstRTSPConnection * conn, gboolean * stale)
{
GstRTSPAuthCredential **credentials, **credential;
- g_return_if_fail (response != NULL);
- g_return_if_fail (methods != NULL);
- g_return_if_fail (stale != NULL);
+ g_return_val_if_fail (response != NULL, FALSE);
+ g_return_val_if_fail (methods != NULL, FALSE);
+ g_return_val_if_fail (stale != NULL, FALSE);
credentials =
gst_rtsp_message_parse_auth_credentials (response,
GST_RTSP_HDR_WWW_AUTHENTICATE);
if (!credentials)
credentials =
gst_rtsp_message_parse_auth_credentials (response,
GST_RTSP_HDR_WWW_AUTHENTICATE);
if (!credentials)
credential = credentials;
while (*credential) {
credential = credentials;
while (*credential) {
}
gst_rtsp_auth_credentials_free (credentials);
}
gst_rtsp_auth_credentials_free (credentials);
GstRTSPConnection *conn;
gboolean stale = FALSE;
GstRTSPConnection *conn;
gboolean stale = FALSE;
+ g_return_val_if_fail (response != NULL, FALSE);
+
conn = src->conninfo.connection;
conn = src->conninfo.connection;
- /* Identify the available auth methods and see if any are supported */
- gst_rtspsrc_parse_auth_hdr (response, &avail_methods, conn, &stale);
+ /* Identify the available auth methods and see if any are supported. If no
+ * headers were found, propagate the HTTP error. */
+ if (!gst_rtspsrc_parse_auth_hdr (response, &avail_methods, conn, &stale))
+ goto propagate_error;
if (avail_methods == GST_RTSP_AUTH_NONE)
goto no_auth_available;
if (avail_methods == GST_RTSP_AUTH_NONE)
goto no_auth_available;
* already, request a username and passwd from the application via some kind
* of credentials request message */
* already, request a username and passwd from the application via some kind
* of credentials request message */
- /* If we don't have a username and passwd at this point, bail out. */
+ /* If we don't have a username and passwd at this point, bail out and
+ * propagate the normal NOT_AUTHORIZED error. */
if (user == NULL || pass == NULL)
if (user == NULL || pass == NULL)
/* Try to configure for each available authentication method, strongest to
* weakest */
/* Try to configure for each available authentication method, strongest to
* weakest */
("No supported authentication protocol was found"));
return FALSE;
}
("No supported authentication protocol was found"));
return FALSE;
}
{
/* We don't fire an error message, we just return FALSE and let the
{
/* We don't fire an error message, we just return FALSE and let the
- * normal NOT_AUTHORIZED error be propagated */
+ * normal error be propagated */