summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhu, Yongsheng <yongsheng.zhu@intel.com>2010-04-13 17:07:03 +0800
committerZhu, Yongsheng <yongsheng.zhu@intel.com>2010-04-14 14:51:53 +0800
commit3da3a388cc8fcb85338035482adf55f787aefdb0 (patch)
tree03f6fe12616a36e8fddc088ca8818f81feeb4bb4
parent03f649c4599061d17b43ed7e5210805c2ffe9a26 (diff)
DBus server: abort when user didn't provide password (MB#10475)mb10475
When user didn't provide password, sync ui sends a hash without 'password' key-value pair in the response. Abort the current sync process under this situation.
-rw-r--r--src/syncevo-dbus-server.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/syncevo-dbus-server.cpp b/src/syncevo-dbus-server.cpp
index 5db2cc1a..335796e4 100644
--- a/src/syncevo-dbus-server.cpp
+++ b/src/syncevo-dbus-server.cpp
@@ -3470,7 +3470,12 @@ string Session::askPassword(const string &passwordName,
boost::shared_ptr<InfoReq> req = m_server.createInfoReq("password", params, this);
std::map<string, string> response;
if(req->wait(response) == InfoReq::ST_OK) {
- return response["password"];
+ std::map<string, string>::iterator it = response.find("password");
+ if (it == response.end()) {
+ SE_THROW_EXCEPTION_STATUS(StatusException, "user didn't provide password, abort", SyncMLStatus(sysync::LOCERR_USERABORT));
+ } else {
+ return it->second;
+ }
}
SE_THROW_EXCEPTION_STATUS(StatusException, "can't get the password from clients. The password request is '" + req->getStatusStr() + "'", STATUS_PASSWORD_TIMEOUT);