AU: Restrict URL/version change over D-Bus to non-official builds only.

BUG=7159
TEST=unit tests, test on device

Change-Id: I7dd6293d3e61db123b2be2f1e3ee283fcb5ba968

Review URL: http://codereview.chromium.org/3965001
diff --git a/dbus_service.cc b/dbus_service.cc
index 677dbc8..63fbf50 100644
--- a/dbus_service.cc
+++ b/dbus_service.cc
@@ -3,9 +3,13 @@
 // found in the LICENSE file.
 
 #include "update_engine/dbus_service.h"
+
 #include <string>
-#include "base/logging.h"
+
+#include <base/logging.h>
+
 #include "update_engine/marshal.glibmarshal.h"
+#include "update_engine/utils.h"
 
 using std::string;
 
@@ -51,8 +55,18 @@
                                               gchar* app_version,
                                               gchar* omaha_url,
                                               GError **error) {
-  const string update_app_version = app_version ? app_version : "";
-  const string update_omaha_url = omaha_url ? omaha_url : "";
+  string update_app_version;
+  string update_omaha_url;
+  // Only non-official (e.g., dev and test) builds can override the current
+  // version and update server URL over D-Bus.
+  if (!chromeos_update_engine::utils::IsOfficialBuild()) {
+    if (app_version) {
+      update_app_version = app_version;
+    }
+    if (omaha_url) {
+      update_omaha_url = omaha_url;
+    }
+  }
   LOG(INFO) << "Attempt update: app_version=\"" << update_app_version << "\" "
             << "omaha_url=\"" << update_omaha_url << "\"";
   self->update_attempter_->CheckForUpdate(app_version, omaha_url);