Skip to content

Commit cc1f54c

Browse files
Mark KendallBeirdo
authored andcommitted
RAOP: Don't try and start a service if there is no key.
(cherry picked from commit 5097e924e87d62e679bac408c88ac720ea3d98d6) Signed-off-by: Gavin Hurlbut <ghurlbut@mythtv.org>
1 parent 5e5a024 commit cc1f54c

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

mythtv/libs/libmythtv/mythraopconnection.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,8 @@ RSA* MythRAOPConnection::LoadKey(void)
712712

713713
if ( !file )
714714
{
715-
LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to read key from " + GetConfDir().toUtf8() + sName.toUtf8());
715+
LOG(VB_GENERAL, LOG_ERR, LOC + QString("Failed to read key from: %1")
716+
.arg(GetConfDir() + sName));
716717
g_rsa = NULL;
717718
return NULL;
718719
}
@@ -728,7 +729,7 @@ RSA* MythRAOPConnection::LoadKey(void)
728729
}
729730

730731
g_rsa = NULL;
731-
LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to load RSA private key. Playback will fail.");
732+
LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to load RSA private key.");
732733
return NULL;
733734
}
734735

mythtv/libs/libmythtv/mythraopconnection.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class MythRAOPConnection : public QObject
2727
{
2828
Q_OBJECT
2929

30+
friend class MythRAOPDevice;
31+
3032
public:
3133
MythRAOPConnection(QObject *parent, QTcpSocket* socket, QByteArray id, int port);
3234
~MythRAOPConnection();
@@ -41,6 +43,9 @@ class MythRAOPConnection : public QObject
4143
void timeout(void);
4244
void audioRetry(void);
4345

46+
protected:
47+
static RSA* LoadKey(void);
48+
4449
private:
4550
uint64_t FramesToMs(uint64_t timestamp);
4651
void ProcessSyncPacket(const QByteArray &buf, uint64_t timenow);
@@ -54,7 +59,6 @@ class MythRAOPConnection : public QObject
5459
void FinishResponse(QTextStream *stream, QTcpSocket *socket,
5560
QByteArray &option, QByteArray &cseq);
5661
RawHash FindTags(const QList<QByteArray> &lines);
57-
static RSA* LoadKey(void);
5862
bool CreateDecoder(void);
5963
void DestroyDecoder(void);
6064
bool OpenAudioDevice(void);

mythtv/libs/libmythtv/mythraopdevice.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ bool MythRAOPDevice::Create(void)
2020
{
2121
QMutexLocker locker(gMythRAOPDeviceMutex);
2222

23+
// don't bother trying to start if there is no private key
24+
if (!MythRAOPConnection::LoadKey())
25+
{
26+
LOG(VB_GENERAL, LOG_ERR, LOC + "Aborting startup - no key found.");
27+
return false;
28+
}
29+
2330
// create the device thread
2431
if (!gMythRAOPDeviceThread)
2532
gMythRAOPDeviceThread = new MThread("RAOPDevice");

0 commit comments

Comments
 (0)