I have made the following changes intended for :
  CE:MW:Shared / ssu

Please review and accept or decline.
BOSS has already run some checks on this request.
See the "Messages from BOSS" section below.

https://build.pub.meego.com//request/show/7146

Thank You,
aard

[This message was auto-generated]

---

Request # 7146:

Messages from BOSS:

State: review at 2012-10-26T02:29:18 by bossbot

Reviews:
       accepted by bossbot : Prechecks succeeded.
       new for CE-maintainers : Please replace this text with a review and 
approve/reject the review (not the SR). BOSS will take care of the rest

Changes:
  submit: home:aard:branches:CE:MW:Shared / ssu -> CE:MW:Shared / ssu
  
changes files:
--------------
--- ssu.changes
+++ ssu.changes
@@ -0,0 +1,6 @@
+* Thu Oct 25 2012 Bernd Wachter <[email protected]> - 0.13
+- Fall back to imei environement variable for N9/N950/N900
+
+* Wed Oct 24 2012 Bernd Wachter <[email protected]> - 0.12
+- Add configurable URLs for credentials scope
+

old:
----
  ssu-0.11.tar.gz

new:
----
  ssu-0.13.tar.gz

spec files:
-----------
--- ssu.spec
+++ ssu.spec
@@ -1,5 +1,5 @@
 Name: ssu
-Version: 0.11
+Version: 0.13
 Release: 1
 Summary: SSU enabler for RND
 Group: System/Base
@@ -13,6 +13,8 @@
 Requires(pre): shadow-utils
 Requires(postun): shadow-utils
 Requires: ssu-vendor-data
+Obsoletes: libssu
+Provides: libssu
 
 %description
 %{summary}.

other changes:
--------------

++++++ ssu-0.11.tar.gz -> ssu-0.13.tar.gz
--- libssu/ssu.cpp
+++ libssu/ssu.cpp
@@ -126,6 +126,13 @@
     return 
"your-configuration-is-broken-and-does-not-contain-credentials-scope";
 }
 
+QString Ssu::credentialsUrl(QString scope){
+  if (settings->contains("credentials-url-" + scope))
+    return settings->value("credentials-url-" + scope).toString();
+  else
+    return 
"your-configuration-is-broken-and-does-not-contain-credentials-url-for-" + 
scope;
+}
+
 QString Ssu::deviceFamily(){
   QString model = deviceModel();
 
@@ -166,14 +173,21 @@
   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();
+  QString IMEIenv = getenv("imei");
+  bool ok;
 
   IMEI = devInfo.imei();
   // this might not be completely unique (or might change on reflash), but 
works for now
-  if (IMEI == "")
-    IMEI = devInfo.uniqueDeviceID();
+  if (IMEI == ""){
+    if (deviceFamily() == "n950-n9" || deviceFamily() == "n900"){
+      bool ok;
+      QString IMEIenv = getenv("imei");
+      IMEIenv.toLongLong(&ok, 10);
+      if (ok && (IMEIenv.length() == 16 || IMEIenv.length() == 15))
+        IMEI = IMEIenv;
+    } else
+      IMEI = devInfo.uniqueDeviceID();
+  }
   return IMEI;
 }
 
--- libssu/ssu.h
+++ libssu/ssu.h
@@ -37,6 +37,10 @@
      */
     QString credentialsScope(QString repoName, bool rndRepo=false);
     /**
+     * Return the URL for which credentials scope is valid
+     */
+    QString credentialsUrl(QString scope);
+    /**
      * Try to find the device family for the system this is running on
      */
     Q_INVOKABLE QString deviceFamily();
--- ssu-defaults.ini
+++ ssu-defaults.ini
@@ -14,3 +14,4 @@
 
 [2]
 release=latest
+credentials-url-example=https://example.com
--- ssuurlresolver/ssuurlresolver.cpp
+++ ssuurlresolver/ssuurlresolver.cpp
@@ -84,7 +84,7 @@
       credentialsFile.open(QIODevice::WriteOnly | QIODevice::Text | 
QIODevice::Truncate);
       QTextStream out(&credentialsFile);
       QPair<QString, QString> credentials = ssu.credentials(credentialsScope);
-      out << "[ssu-credentials]\n";
+      out << "[" << ssu.credentialsUrl(credentialsScope) << "]\n";
       out << "username=" << credentials.first << "\n";
       out << "password=" << credentials.second << "\n";
       out.flush();



Reply via email to