[login_manager] Add stub DBus API for policy get/set
Just adding the DBus calls for getting/setting a policy to the session manager.
BUG=12670
TEST=build the code; methods do nothing as of yet.
Change-Id: I53a5992c813adfda20865ceff583c78a4e56fc51
Review URL: http://codereview.chromium.org/6591109
diff --git a/SessionManager.conf b/SessionManager.conf
index da1ad51..8e8909e 100644
--- a/SessionManager.conf
+++ b/SessionManager.conf
@@ -66,6 +66,12 @@
send_member="RetrieveProperty"/>
<allow send_destination="org.chromium.SessionManager"
send_interface="org.chromium.SessionManagerInterface"
+ send_member="StorePolicy"/>
+ <allow send_destination="org.chromium.SessionManager"
+ send_interface="org.chromium.SessionManagerInterface"
+ send_member="RetrievePolicy"/>
+ <allow send_destination="org.chromium.SessionManager"
+ send_interface="org.chromium.SessionManagerInterface"
send_member="RestartEntd"/>
</policy>
<policy context="default">
diff --git a/interface.cc b/interface.cc
index 134798b..cc88c3a 100644
--- a/interface.cc
+++ b/interface.cc
@@ -135,6 +135,18 @@
GError **error) {
SESSION_MANAGER_WRAP_METHOD(RetrieveProperty, name, OUT_value, OUT_signature);
}
+gboolean session_manager_store_policy(SessionManager *self,
+ gchar *policy_blob,
+ GArray *signature,
+ GError **error) {
+ SESSION_MANAGER_WRAP_METHOD(StorePolicy, policy_blob, signature);
+}
+gboolean session_manager_retrieve_policy(SessionManager *self,
+ gchar **OUT_policy_blob,
+ GArray **OUT_signature,
+ GError **error) {
+ SESSION_MANAGER_WRAP_METHOD(RetrievePolicy, OUT_policy_blob, OUT_signature);
+}
gboolean session_manager_lock_screen(SessionManager *self,
GError **error) {
SESSION_MANAGER_WRAP_METHOD0(LockScreen);
diff --git a/interface.h b/interface.h
index b5ffaf0..9e8eb04 100644
--- a/interface.h
+++ b/interface.h
@@ -80,6 +80,14 @@
gchar **OUT_value,
GArray **OUT_signature,
GError **error);
+gboolean session_manager_store_policy(SessionManager *self,
+ gchar *policy_blob,
+ GArray *signature,
+ GError **error);
+gboolean session_manager_retrieve_policy(SessionManager *self,
+ gchar **OUT_policy_blob,
+ GArray **OUT_signature,
+ GError **error);
gboolean session_manager_unlock_screen(SessionManager *self,
GError **error);
diff --git a/session_manager.xml b/session_manager.xml
index 5e94198..bdb2799 100644
--- a/session_manager.xml
+++ b/session_manager.xml
@@ -61,6 +61,14 @@
<arg type="s" name="value" direction="out" />
<arg type="ay" name="signature" direction="out" />
</method>
+ <method name="StorePolicy">
+ <arg type="s" name="policy_blob" direction="in" />
+ <arg type="ay" name="signature" direction="in" />
+ </method>
+ <method name="RetrievePolicy">
+ <arg type="s" name="policy_blob" direction="in" />
+ <arg type="ay" name="signature" direction="out" />
+ </method>
<method name="RestartEntd">
</method>
<signal name="SessionStateChanged">
diff --git a/session_manager_service.cc b/session_manager_service.cc
index ca195d8..d708ef1 100644
--- a/session_manager_service.cc
+++ b/session_manager_service.cc
@@ -728,6 +728,18 @@
return TRUE;
}
+gboolean SessionManagerService::StorePolicy(gchar* policy_blob,
+ GArray* signature,
+ GError** error) {
+ return FALSE;
+}
+
+gboolean SessionManagerService::RetrievePolicy(gchar** OUT_policy_blob,
+ GArray** OUT_signature,
+ GError** error) {
+ return FALSE;
+}
+
gboolean SessionManagerService::LockScreen(GError** error) {
screen_locked_ = TRUE;
system_->SendSignalToChromium(chromium::kLockScreenSignal, NULL);
diff --git a/session_manager_service.h b/session_manager_service.h
index 36cb640..86a5615 100644
--- a/session_manager_service.h
+++ b/session_manager_service.h
@@ -290,6 +290,21 @@
GArray** OUT_signature,
GError** error);
+ // Store |policy_blob, signature| to disk.
+ //
+ // |signature| is a SAH1 with RSA signature over |policy_blob|,
+ // verifiable with |key_|.
+ //
+ // Returns TRUE if the signature checks out and the data is inserted,
+ // FALSE otherwise.
+ gboolean StorePolicy(gchar* policy_blob, GArray* signature, GError** error);
+
+ // Get the policy_blob and associated signature off of disk.
+ // Returns TRUE if the data is can be fetched, FALSE otherwise.
+ gboolean RetrievePolicy(gchar** OUT_policy_blob,
+ GArray** OUT_signature,
+ GError** error);
+
// Handles LockScreen request from PowerManager. It switches itself to
// lock mode, and emit LockScreen signal to Chromium Browser.
gboolean LockScreen(GError** error);