Mercurial > libervia-backend
comparison src/plugins/plugin_misc_extra_pep.py @ 1744:9a48e09044eb
plugin extra_pep, params: fixed insecure building of jids_list
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 15 Dec 2015 16:25:19 +0100 |
parents | cc31dd72526d |
children | 0dfabe746ec4 |
comparison
equal
deleted
inserted
replaced
1743:4c48468ead4c | 1744:9a48e09044eb |
---|---|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 from sat.core.i18n import _, D_ | 20 from sat.core.i18n import _, D_ |
21 from sat.core.log import getLogger | 21 from sat.core.log import getLogger |
22 log = getLogger(__name__) | 22 log = getLogger(__name__) |
23 from sat.memory import params | |
24 from twisted.words.protocols.jabber import jid | |
23 | 25 |
24 | 26 |
25 PLUGIN_INFO = { | 27 PLUGIN_INFO = { |
26 "name": "Extra PEP", | 28 "name": "Extra PEP", |
27 "import_name": "EXTRA-PEP", | 29 "import_name": "EXTRA-PEP", |
32 "main": "ExtraPEP", | 34 "main": "ExtraPEP", |
33 "handler": "no", | 35 "handler": "no", |
34 "description": _(u"""Display messages from extra PEP services""") | 36 "description": _(u"""Display messages from extra PEP services""") |
35 } | 37 } |
36 | 38 |
39 | |
37 PARAM_KEY = u"Misc" | 40 PARAM_KEY = u"Misc" |
38 PARAM_NAME = u"Blog authors following list" | 41 PARAM_NAME = u"Blog authors following list" |
39 PARAM_DEFAULT = ["salut-a-toi@libervia.org"] | 42 PARAM_DEFAULT = (jid.JID("salut-a-toi@libervia.org"),) |
43 | |
40 | 44 |
41 class ExtraPEP(object): | 45 class ExtraPEP(object): |
42 | 46 |
43 params = """ | 47 params = """ |
44 <params> | 48 <params> |
53 """ % { | 57 """ % { |
54 'category_name': PARAM_KEY, | 58 'category_name': PARAM_KEY, |
55 'category_label': D_(PARAM_KEY), | 59 'category_label': D_(PARAM_KEY), |
56 'param_name': PARAM_NAME, | 60 'param_name': PARAM_NAME, |
57 'param_label': D_(PARAM_NAME), | 61 'param_label': D_(PARAM_NAME), |
58 'jids': "".join(["<jid>%s</jid>" % jid for jid in PARAM_DEFAULT]) | 62 'jids': u"\n".join({elt.toXml() for elt in params.createJidElts(PARAM_DEFAULT)}) |
59 } | 63 } |
60 | 64 |
61 def __init__(self, host): | 65 def __init__(self, host): |
62 log.info(_(u"Plugin Extra PEP initialization")) | 66 log.info(_(u"Plugin Extra PEP initialization")) |
63 self.host = host | 67 self.host = host |