Sanitize certificate subject name before comparing to deviceId
The device ID is sanitized to make it safe for D-Bus, so the device ID
stored in the certificate as the subject name also needs to be
sanitized before comparison.
(cherry picked from commit 0640279ae0
)
This commit is contained in:
parent
98dd492f75
commit
106ce36ca4
1 changed files with 2 additions and 0 deletions
|
@ -31,6 +31,7 @@
|
||||||
#include <QUdpSocket>
|
#include <QUdpSocket>
|
||||||
|
|
||||||
#include "daemon.h"
|
#include "daemon.h"
|
||||||
|
#include "dbushelper.h"
|
||||||
#include "kdeconnectconfig.h"
|
#include "kdeconnectconfig.h"
|
||||||
#include "landevicelink.h"
|
#include "landevicelink.h"
|
||||||
#include "qtcompat_p.h"
|
#include "qtcompat_p.h"
|
||||||
|
@ -576,6 +577,7 @@ void LanLinkProvider::configureSocket(QSslSocket *socket)
|
||||||
void LanLinkProvider::addLink(QSslSocket *socket, const DeviceInfo &deviceInfo)
|
void LanLinkProvider::addLink(QSslSocket *socket, const DeviceInfo &deviceInfo)
|
||||||
{
|
{
|
||||||
QString certDeviceId = socket->peerCertificate().subjectDisplayName();
|
QString certDeviceId = socket->peerCertificate().subjectDisplayName();
|
||||||
|
DBusHelper::filterNonExportableCharacters(certDeviceId);
|
||||||
if (deviceInfo.id != certDeviceId) {
|
if (deviceInfo.id != certDeviceId) {
|
||||||
socket->disconnectFromHost();
|
socket->disconnectFromHost();
|
||||||
qCWarning(KDECONNECT_CORE) << "DeviceID in cert doesn't match deviceID in identity packet. " << deviceInfo.id << " vs " << certDeviceId;
|
qCWarning(KDECONNECT_CORE) << "DeviceID in cert doesn't match deviceID in identity packet. " << deviceInfo.id << " vs " << certDeviceId;
|
||||||
|
|
Loading…
Reference in a new issue