diff options
author | L. Sorin <sorin@axis.com> | 2014-05-20 17:09:43 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-05-21 08:36:51 +0200 |
commit | 5edf0add57efb84ec08b95dd5e4b0cd390702177 (patch) | |
tree | 082a333b4da2f455e859b0b3d016d887fe8ea5d6 | |
parent | 2da979831ec3b1a8d993eb6f2d3999c5810c4d67 (diff) | |
download | gstreamer-plugins-bad-5edf0add57efb84ec08b95dd5e4b0cd390702177.tar.gz |
curlsshsink: post error on bus in element, not transfer thread
Looks like this file was missed in Bug 728960:
https://bugzilla.gnome.org/show_bug.cgi?id=728960
https://bugzilla.gnome.org/show_bug.cgi?id=730459
-rw-r--r-- | ext/curl/gstcurlsshsink.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/ext/curl/gstcurlsshsink.c b/ext/curl/gstcurlsshsink.c index 7e06dab3d..b4c6b7793 100644 --- a/ext/curl/gstcurlsshsink.c +++ b/ext/curl/gstcurlsshsink.c @@ -318,14 +318,14 @@ static gboolean gst_curl_ssh_sink_set_options_unlocked (GstCurlBaseSink * bcsink) { GstCurlSshSink *sink = GST_CURL_SSH_SINK (bcsink); - gint curl_err = CURLE_OK; + CURLcode curl_err = CURLE_OK; /* set SSH specific options here */ if (sink->ssh_pub_keyfile) { if ((curl_err = curl_easy_setopt (bcsink->curl, CURLOPT_SSH_PUBLIC_KEYFILE, sink->ssh_pub_keyfile)) != CURLE_OK) { - GST_ERROR_OBJECT (sink, "curl error: %d setting public key file: %s.", - curl_err, sink->ssh_pub_keyfile); + bcsink->error = g_strdup_printf ("failed to set public key file: %s", + curl_easy_strerror (curl_err)); return FALSE; } } @@ -333,8 +333,8 @@ gst_curl_ssh_sink_set_options_unlocked (GstCurlBaseSink * bcsink) if (sink->ssh_priv_keyfile) { if ((curl_err = curl_easy_setopt (bcsink->curl, CURLOPT_SSH_PRIVATE_KEYFILE, sink->ssh_priv_keyfile)) != CURLE_OK) { - GST_ERROR_OBJECT (sink, "curl error: %d setting private key file: %s.", - curl_err, sink->ssh_priv_keyfile); + bcsink->error = g_strdup_printf ("failed to set private key file: %s", + curl_easy_strerror (curl_err)); return FALSE; } } @@ -342,8 +342,8 @@ gst_curl_ssh_sink_set_options_unlocked (GstCurlBaseSink * bcsink) if (sink->ssh_knownhosts) { if ((curl_err = curl_easy_setopt (bcsink->curl, CURLOPT_SSH_KNOWNHOSTS, sink->ssh_knownhosts)) != CURLE_OK) { - GST_ERROR_OBJECT (sink, "curl error: %d setting known_hosts file: %s.", - curl_err, sink->ssh_knownhosts); + bcsink->error = g_strdup_printf ("failed to set known_hosts file: %s", + curl_easy_strerror (curl_err)); return FALSE; } } @@ -353,17 +353,16 @@ gst_curl_ssh_sink_set_options_unlocked (GstCurlBaseSink * bcsink) * hexdigits long it silently ignores CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 and * performs the transfer without authenticating the server! */ if (strlen (sink->ssh_host_public_key_md5) != 32) { - GST_ERROR_OBJECT (sink, - "MD5-hash string has invalid length, must be exactly 32 hexdigits!"); + bcsink->error = g_strdup ("MD5-hash string has invalid length, " + "must be exactly 32 hexdigits!"); return FALSE; } if ((curl_err = curl_easy_setopt (bcsink->curl, CURLOPT_SSH_HOST_PUBLIC_KEY_MD5, sink->ssh_host_public_key_md5)) != CURLE_OK) { - GST_ERROR_OBJECT (sink, - "curl error: %d setting remote host's public key MD5: %s.", curl_err, - sink->ssh_host_public_key_md5); + bcsink->error = g_strdup_printf ("failed to set remote host's public " + "key MD5: %s", curl_easy_strerror (curl_err)); return FALSE; } } @@ -376,8 +375,8 @@ gst_curl_ssh_sink_set_options_unlocked (GstCurlBaseSink * bcsink) /* set the SSH_AUTH_TYPE */ if ((curl_err = curl_easy_setopt (bcsink->curl, CURLOPT_SSH_AUTH_TYPES, sink->ssh_auth_type)) != CURLE_OK) { - GST_ERROR_OBJECT (sink, "curl error: %d setting auth type: %d.", curl_err, - sink->ssh_auth_type); + bcsink->error = g_strdup_printf ("failed to set authentication type: %s", + curl_easy_strerror (curl_err)); return FALSE; } @@ -386,9 +385,8 @@ gst_curl_ssh_sink_set_options_unlocked (GstCurlBaseSink * bcsink) if (sink->ssh_key_passphrase) { if ((curl_err = curl_easy_setopt (bcsink->curl, CURLOPT_KEYPASSWD, sink->ssh_key_passphrase)) != CURLE_OK) { - GST_ERROR_OBJECT (sink, - "curl error: %d setting private key passphrase: %s.", curl_err, - sink->ssh_key_passphrase); + bcsink->error = g_strdup_printf ("failed to set private key " + "passphrase: %s", curl_easy_strerror (curl_err)); return FALSE; } } else { @@ -401,8 +399,8 @@ gst_curl_ssh_sink_set_options_unlocked (GstCurlBaseSink * bcsink) } } else { - GST_ERROR_OBJECT (sink, "Error: unsupported authentication type: %d.", - sink->ssh_auth_type); + bcsink->error = g_strdup_printf ("Error: unsupported authentication type: " + "%d.", sink->ssh_auth_type); return FALSE; } @@ -411,8 +409,8 @@ gst_curl_ssh_sink_set_options_unlocked (GstCurlBaseSink * bcsink) * is also set! */ if ((curl_err = curl_easy_setopt (bcsink->curl, CURLOPT_SSH_KEYFUNCTION, curl_ssh_sink_sshkey_cb)) != CURLE_OK) { - GST_ERROR_OBJECT (sink, "curl error: %d setting CURLOPT_SSH_KEYFUNCTION.", - curl_err); + bcsink->error = g_strdup_printf ("failed to set SSH_KEYFUNCTION callback: " + "%s", curl_easy_strerror (curl_err)); return FALSE; } else { /* SSH_KEYFUNCTION callback successfully installed so go on and @@ -420,8 +418,9 @@ gst_curl_ssh_sink_set_options_unlocked (GstCurlBaseSink * bcsink) if ((curl_err = curl_easy_setopt (bcsink->curl, CURLOPT_SSH_KEYDATA, sink)) != CURLE_OK) { - GST_ERROR_OBJECT (sink, "curl error: %d setting CURLOPT_SSH_KEYDATA.", - curl_err); + bcsink->error = g_strdup_printf ("failed to set CURLOPT_SSH_KEYDATA: %s", + curl_easy_strerror (curl_err)); + return FALSE; } } @@ -484,8 +483,8 @@ curl_ssh_sink_sshkey_cb (CURL * easy_handle, /* easy handle */ default: /* something went wrong, we got some bogus key match result */ - GST_ERROR_OBJECT (sink, - "libcurl internal error encountered during known_host matching"); + GST_CURL_BASE_SINK (sink)->error = + g_strdup ("libcurl internal error during known_host matching"); break; } |