core: added the security_limit to setParam

- params with a security greater than security_limit can not be modified
- special value: security_limit < 0 disable the check (all params can be modified)
This commit is contained in:
souliane 2013-09-07 02:03:17 +02:00
commit 2bf3694fd0
2 changed files with 56 additions and 37 deletions

View file

@ -117,9 +117,12 @@ class MiscAccount(object):
def _profileRegistered(self, result, email, password, profile):
#FIXME: values must be in a config file instead of hardcoded
self.host.memory.setParam("JabberID", "%s@%s/%s" % (profile, _NEW_ACCOUNT_DOMAIN, _NEW_ACCOUNT_RESOURCE), "Connection", profile)
self.host.memory.setParam("Server", _NEW_ACCOUNT_SERVER, "Connection", profile)
self.host.memory.setParam("Password", password, "Connection", profile)
self.host.memory.setParam("JabberID", "%s@%s/%s" % (profile, _NEW_ACCOUNT_DOMAIN, _NEW_ACCOUNT_RESOURCE),
"Connection", profile_key=profile)
self.host.memory.setParam("Server", _NEW_ACCOUNT_SERVER,
"Connection", profile_key=profile)
self.host.memory.setParam("Password", password,
"Connection", profile_key=profile)
#and the account
#XXX: we use "prosodyctl adduser" because "register" doesn't check conflict

View file

@ -798,9 +798,12 @@ class XEP_0065_handler(XMPPHandler):
if len(streamhost_elts) != 1:
warning(_("Multiple streamhost elements in proxy not managed, keeping only the first one"))
streamhost_elt = streamhost_elts[0]
proxy = self.host.memory.setParam("Proxy", streamhost_elt.getAttribute("jid", ""), "File Transfer", self.parent.profile)
proxy = self.host.memory.setParam("Proxy host", streamhost_elt.getAttribute("host", ""), "File Transfer", self.parent.profile)
proxy = self.host.memory.setParam("Proxy port", streamhost_elt.getAttribute("port", ""), "File Transfer", self.parent.profile)
proxy = self.host.memory.setParam("Proxy", streamhost_elt.getAttribute("jid", ""),
"File Transfer", profile_key=self.parent.profile)
proxy = self.host.memory.setParam("Proxy host", streamhost_elt.getAttribute("host", ""),
"File Transfer", profile_key=self.parent.profile)
proxy = self.host.memory.setParam("Proxy port", streamhost_elt.getAttribute("port", ""),
"File Transfer", profile_key=self.parent.profile)
def connectionInitialized(self):
def after_init(ignore):