comparison src/plugins/plugin_xep_0277.py @ 1679:9ff4f60de005

plugin XEP-0277: use bare JIDs to verify publisher
author souliane <souliane@mailoo.org>
date Wed, 25 Nov 2015 17:19:25 +0100
parents 1895846fc9cb
children 1e06a0f8be66
comparison
equal deleted inserted replaced
1678:c2d96f74105e 1679:9ff4f60de005
300 microblog_data['author_jid'] = item_elt.getAttribute("publisher") or "" 300 microblog_data['author_jid'] = item_elt.getAttribute("publisher") or ""
301 301
302 if not publisher: 302 if not publisher:
303 log.debug("No publisher attribute, we can't verify author jid") 303 log.debug("No publisher attribute, we can't verify author jid")
304 microblog_data['author_jid_verified'] = C.BOOL_FALSE 304 microblog_data['author_jid_verified'] = C.BOOL_FALSE
305 elif publisher == uri: 305 elif publisher.split("/")[0] == uri.split("/")[0]:
306 microblog_data['author_jid_verified'] = C.BOOL_TRUE 306 microblog_data['author_jid_verified'] = C.BOOL_TRUE
307 else: 307 else:
308 log.warning("item atom:uri differ from publisher attribute, spoofing attempt ? atom:uri = {} publisher = {}".format(uri, item_elt.getAttribute("publisher"))) 308 log.warning("item atom:uri differs from publisher attribute: spoofing attempt? atom:uri = {} publisher = {}".format(uri, item_elt.getAttribute("publisher")))
309 microblog_data['author_jid_verified'] = C.BOOL_FALSE 309 microblog_data['author_jid_verified'] = C.BOOL_FALSE
310 # email 310 # email
311 try: 311 try:
312 email_elt = author_elt.elements(NS_ATOM, 'email').next() 312 email_elt = author_elt.elements(NS_ATOM, 'email').next()
313 except StopIteration: 313 except StopIteration: