Disable sending packages to untrusted devices
This commit is contained in:
parent
c9e67f3cf0
commit
ac7f4d0618
1 changed files with 6 additions and 1 deletions
|
@ -156,6 +156,11 @@ void Device::removeLink(DeviceLink* link)
|
||||||
|
|
||||||
bool Device::sendPackage(const NetworkPackage& np) const
|
bool Device::sendPackage(const NetworkPackage& np) const
|
||||||
{
|
{
|
||||||
|
if (!m_paired) {
|
||||||
|
//qDebug() << "sendpackage disabled on untrusted device" << name();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Q_FOREACH(DeviceLink* dl, m_deviceLinks) {
|
Q_FOREACH(DeviceLink* dl, m_deviceLinks) {
|
||||||
//TODO: Actually detect if a package is received or not, now when have TCP
|
//TODO: Actually detect if a package is received or not, now when have TCP
|
||||||
//"ESTABLISHED" connections that look legit and return true when we use them,
|
//"ESTABLISHED" connections that look legit and return true when we use them,
|
||||||
|
@ -170,7 +175,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
|
||||||
if (np.type() == "kdeconnect.identity" && !m_knownIdentiy) {
|
if (np.type() == "kdeconnect.identity" && !m_knownIdentiy) {
|
||||||
m_deviceName = np.get<QString>("deviceName");
|
m_deviceName = np.get<QString>("deviceName");
|
||||||
} else if (m_paired) {
|
} else if (m_paired) {
|
||||||
qDebug() << "package received from trusted device";
|
//qDebug() << "package received from trusted device" << name();
|
||||||
Q_EMIT receivedPackage(np);
|
Q_EMIT receivedPackage(np);
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "device" << name() << "not trusted, ignoring package" << np.type();
|
qDebug() << "device" << name() << "not trusted, ignoring package" << np.type();
|
||||||
|
|
Loading…
Reference in a new issue