raop: add error handling to rsa_encrypt()

When reviewing another change in rsa_encrypt(), Felipe Sateler pointed
out some deficiencies in error handling. This patch adds error handling
for all openssl calls in rsa_encrypt().

This patch doesn't propagate the error all the way up to the
pa_rtsp_client owner, because there's no mechanism for doing that. I
could implement such mechanism myself, but I think it's better I don't
make such complex changes to the RAOP code, because I don't have any
RAOP hardware to test the changes. The result is that module-raop-sink
will just sit around without doing anything. I think this is still
better than having no error handling at all.
This commit is contained in:
Tanu Kaskinen 2016-11-07 17:12:55 +02:00
parent fe6a9a8f59
commit 2ee5dffffb
2 changed files with 62 additions and 3 deletions

View file

@ -906,6 +906,15 @@ static void rtsp_stream_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_
case PA_RAOP_ENCRYPTION_MFISAP:
case PA_RAOP_ENCRYPTION_FAIRPLAY_SAP25: {
key = pa_raop_secret_get_key(c->secret);
if (!key) {
pa_log("pa_raop_secret_get_key() failed.");
pa_rtsp_disconnect(rtsp);
/* FIXME: This is an unrecoverable failure. We should notify
* the pa_raop_client owner so that it could shut itself
* down. */
goto connect_finish;
}
iv = pa_raop_secret_get_iv(c->secret);
sdp = pa_sprintf_malloc(
@ -929,6 +938,7 @@ static void rtsp_stream_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_
pa_rtsp_announce(c->rtsp, sdp);
connect_finish:
pa_xfree(sdp);
pa_xfree(url);
break;