From a1ade3232afde3163613e5e2887b22ee7188c69a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Fri, 2 May 2008 05:58:44 +0000 Subject: [PATCH] Fix authentication when using VLC --- http.h | 5 +++++ rtsp.c | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/http.h b/http.h index 38538b42..7cd6d4aa 100644 --- a/http.h +++ b/http.h @@ -108,6 +108,11 @@ typedef struct http_connection { struct rtsp_session_head hc_rtsp_sessions; + int hc_authenticated; /* Used by RTSP, it seems VLC does not + send authentication headers for each + command, so we just say that it's ok + if it has authenticated at least once */ + struct config_head *hc_user_config; /* Support for HTTP POST */ diff --git a/rtsp.c b/rtsp.c index fe9a5eee..fd05c8b2 100644 --- a/rtsp.c +++ b/rtsp.c @@ -569,9 +569,18 @@ rtsp_cmd_teardown(http_connection_t *hc) static int rtsp_access_list(http_connection_t *hc) { - return access_verify(hc->hc_username, hc->hc_password, - (struct sockaddr *)&hc->hc_tcp_session.tcp_peer_addr, - ACCESS_STREAMING); + int x; + + if(hc->hc_authenticated) + return 0; + + x = access_verify(hc->hc_username, hc->hc_password, + (struct sockaddr *)&hc->hc_tcp_session.tcp_peer_addr, + ACCESS_STREAMING); + if(x == 0) + hc->hc_authenticated = 1; + + return x; }