static void
gst_rtsp_auth_init (GstRTSPAuth * auth)
{
+ g_mutex_init (&auth->lock);
/* bitwise or of all methods that need authentication */
auth->methods = GST_RTSP_DESCRIBE |
GST_RTSP_ANNOUNCE |
GST_INFO ("finalize auth %p", auth);
g_free (auth->basic);
+ g_mutex_clear (&auth->lock);
G_OBJECT_CLASS (gst_rtsp_auth_parent_class)->finalize (obj);
}
void
gst_rtsp_auth_set_basic (GstRTSPAuth * auth, const gchar * basic)
{
+ g_return_if_fail (GST_IS_RTSP_AUTH (auth));
+
+ g_mutex_lock (&auth->lock);
g_free (auth->basic);
auth->basic = g_strdup (basic);
+ g_mutex_unlock (&auth->lock);
}
static gboolean
gboolean result = FALSE;
GstRTSPAuthClass *klass;
+ g_return_val_if_fail (GST_IS_RTSP_AUTH (auth), FALSE);
+ g_return_val_if_fail (GST_IS_RTSP_CLIENT (client), FALSE);
+ g_return_val_if_fail (state != NULL, FALSE);
+
klass = GST_RTSP_AUTH_GET_CLASS (auth);
GST_DEBUG_OBJECT (auth, "setup auth");
/* parse type */
if (g_ascii_strncasecmp (authorization, "basic ", 6) == 0) {
GST_DEBUG_OBJECT (auth, "check Basic auth");
+ g_mutex_lock (&auth->lock);
if (auth->basic && strcmp (&authorization[6], auth->basic) == 0)
result = TRUE;
+ g_mutex_unlock (&auth->lock);
} else if (g_ascii_strncasecmp (authorization, "digest ", 7) == 0) {
GST_DEBUG_OBJECT (auth, "check Digest auth");
/* not implemented yet */
gboolean result = FALSE;
GstRTSPAuthClass *klass;
+ g_return_val_if_fail (GST_IS_RTSP_AUTH (auth), FALSE);
+ g_return_val_if_fail (GST_IS_RTSP_CLIENT (client), FALSE);
+ g_return_val_if_fail (state != NULL, FALSE);
+
klass = GST_RTSP_AUTH_GET_CLASS (auth);
GST_DEBUG_OBJECT (auth, "check state");
gchar *user_pass;
gchar *result;
+ g_return_val_if_fail (user != NULL, NULL);
+ g_return_val_if_fail (pass != NULL, NULL);
+
user_pass = g_strjoin (":", user, pass, NULL);
result = g_base64_encode ((guchar *) user_pass, strlen (user_pass));
g_free (user_pass);