Skip to content
Snippets Groups Projects
Commit 8d8db580 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

ignore invalid SRV reply from libasyncns. Fixes #5507

parent 5ec5886c
No related branches found
No related tags found
No related merge requests found
...@@ -23,8 +23,14 @@ import re ...@@ -23,8 +23,14 @@ import re
import logging import logging
log = logging.getLogger('gajim.c.resolver') log = logging.getLogger('gajim.c.resolver')
if __name__ == '__main__':
sys.path.append('..')
from common import i18n
import common.configpaths
common.configpaths.gajimpaths.init(None)
from common import helpers from common import helpers
from xmpp.idlequeue import IdleCommand from common.xmpp.idlequeue import IdleCommand
# it is good to check validity of arguments, when calling system commands # it is good to check validity of arguments, when calling system commands
ns_type_pattern = re.compile('^[a-z]+$') ns_type_pattern = re.compile('^[a-z]+$')
...@@ -126,18 +132,23 @@ class LibAsyncNSResolver(CommonResolver): ...@@ -126,18 +132,23 @@ class LibAsyncNSResolver(CommonResolver):
while resq is not None: while resq is not None:
try: try:
rl = resq.get_done() rl = resq.get_done()
except: except Exception:
rl = [] rl = []
hosts = []
requested_type = resq.userdata['type']
requested_host = resq.userdata['host']
if rl: if rl:
for r in rl: for r in rl:
if r['type'] != requested_type:
# Answer doesn't contain valid SRV data
continue
r['prio'] = r['pref'] r['prio'] = r['pref']
self._on_ready( hosts.append(r)
host = resq.userdata['host'], self._on_ready(host=requested_host, type=requested_type,
type = resq.userdata['type'], result_list=hosts)
result_list = rl)
try: try:
resq = self.asyncns.get_next() resq = self.asyncns.get_next()
except: except Exception:
resq = None resq = None
elif type(resq) == libasyncns.AddrInfoQuery: elif type(resq) == libasyncns.AddrInfoQuery:
# getaddrinfo result (A or AAAA) # getaddrinfo result (A or AAAA)
...@@ -324,6 +335,8 @@ if __name__ == '__main__': ...@@ -324,6 +335,8 @@ if __name__ == '__main__':
win.add(hbox) win.add(hbox)
win.show_all() win.show_all()
gobject.timeout_add(200, idlequeue.process) gobject.timeout_add(200, idlequeue.process)
if USE_LIBASYNCNS:
gobject.timeout_add(200, resolver.process)
gtk.main() gtk.main()
# vim: se ts=3: # vim: se ts=3:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment