From cdad8ada47125326b8e492255f4f02716b9c9bd7 Mon Sep 17 00:00:00 2001 From: Bernd Wachter Date: Sun, 21 Oct 2012 17:40:28 +0300 Subject: [PATCH] Don't allow registration for phones with empty IMEI --- libssu/ssu.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libssu/ssu.cpp b/libssu/ssu.cpp index 2465664..b5eeae9 100644 --- a/libssu/ssu.cpp +++ b/libssu/ssu.cpp @@ -108,6 +108,11 @@ QString Ssu::deviceModel(){ QString Ssu::deviceUid(){ QString IMEI; QSystemDeviceInfo devInfo; + + // for all devices where we know that they have an IMEI we can't fall back other UID + if (deviceFamily() == "n950-n9" || deviceFamily() == "n900") + return devInfo.imei(); + IMEI = devInfo.imei(); // this might not be completely unique (or might change on reflash), but works for now if (IMEI == "") @@ -298,6 +303,10 @@ void Ssu::sendRegistration(QString username, QString password){ ssuRegisterUrl = settings->value("register-url").toString(); QString IMEI = deviceUid(); + if (IMEI == ""){ + setError("No valid UID available for your device. For phones: is your modem online?"); + return; + } QSslConfiguration sslConfiguration; if (!useSslVerify()) @@ -391,6 +400,11 @@ void Ssu::setRelease(QString release, bool rnd){ void Ssu::updateCredentials(bool force){ errorFlag = false; + if (deviceUid() == ""){ + setError("No valid UID available for your device. For phones: is your modem online?"); + return; + } + QString ssuCaCertificate, ssuCredentialsUrl; if (!settings->contains("ca-certificate")){ setError("CA certificate for SSU not set (config key 'ca-certificate')");