prevent sending messages to invalid JIDs. Fixes #4577
This commit is contained in:
parent
d820977e16
commit
d0c3b6fd44
|
@ -1074,6 +1074,14 @@ class Connection(ConnectionHandlers):
|
|||
original_message=None, delayed=None):
|
||||
if not self.connection:
|
||||
return 1
|
||||
try:
|
||||
jid = helpers.parse_jid(jid)
|
||||
except helpers.InvalidFormat:
|
||||
self.dispatch('ERROR', (_('Invalid Jabber ID'),
|
||||
_('It is not possible to send a message to %s, this JID is not '
|
||||
'valid.') % jid))
|
||||
return
|
||||
|
||||
if msg and not xhtml and gajim.config.get(
|
||||
'rst_formatting_outgoing_messages'):
|
||||
from common.rst_xhtml_generator import create_xhtml
|
||||
|
|
|
@ -1682,8 +1682,12 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
|
|||
self._HttpAuthCB(con, msg)
|
||||
return
|
||||
|
||||
frm = helpers.get_full_jid_from_iq(msg)
|
||||
jid = helpers.get_jid_from_iq(msg)
|
||||
try:
|
||||
frm = helpers.get_full_jid_from_iq(msg)
|
||||
jid = helpers.get_jid_from_iq(msg)
|
||||
except helpers.InvalidFormat:
|
||||
self.dispatch('ERROR', (_('Invalid Jabber ID'),
|
||||
_('A message from a non-valid JID arrived, it has been ignored.')))
|
||||
|
||||
addressTag = msg.getTag('addresses', namespace = common.xmpp.NS_ADDRESS)
|
||||
|
||||
|
|
|
@ -2352,6 +2352,13 @@ class SingleMessageWindow:
|
|||
for to_whom_jid in sender_list:
|
||||
if to_whom_jid in self.completion_dict:
|
||||
to_whom_jid = self.completion_dict[to_whom_jid].jid
|
||||
try:
|
||||
to_whom_jid = helpers.parse_jid(to_whom_jid)
|
||||
except helpers.InvalidFormat:
|
||||
ErrorDialog(_('Invalid Jabber ID'),
|
||||
_('It is not possible to send a message to %s, this JID is not '
|
||||
'valid.') % to_whom_jid)
|
||||
return
|
||||
|
||||
subject = self.subject_entry.get_text().decode('utf-8')
|
||||
begin, end = self.message_tv_buffer.get_bounds()
|
||||
|
|
Loading…
Reference in New Issue