freebsd-ports/net-im/gajim/files/extra-patch-src-common_resolver.py
Ruslan Makhmatkhanov f87c8b3c38 Fix runtime on FreeBSD >=10.0
Gajim relies on nslookup when looking up for an SRV record of jabber server.
Since, nslookup was removed from FreeBSD 10, gajim is now fails to connect
unless jabber-server hostname and port were defined by user explicitly. This
patch make it use host(1) for this task.

Submitted by:	walker_643 <walker_643@yahoo.com> (by email)
MFH:    2014Q1
2014-02-19 20:41:53 +00:00

37 lines
1.5 KiB
Python

--- src/common/resolver.py.orig 2014-02-03 11:03:20.000000000 -0500
+++ src/common/resolver.py 2014-02-04 09:37:37.000000000 -0500
@@ -238,8 +238,8 @@
return hosts
def _parse_srv_result_posix(self, fqdn, result):
- # typical output of bind-tools nslookup command:
- # _xmpp-client._tcp.jabber.org service = 30 30 5222 jabber.org.
+ # typical output of host lookup command
+ # _xmpp-client._tcp.jabber.org has SRV record 30 30 5222 jabber.org.
if not result:
return []
ufqdn = helpers.ascii_to_idn(fqdn) # Unicode domain name
@@ -255,11 +255,12 @@
line = helpers.decode_string(line)
domain = ufqdn # For nslookup 9.6
if domain:
- rest = line[len(domain):].split('=')
+ # add 4 for ' has' after domain name
+ rest = line[len(domain)+4:].split('record')
if len(rest) != 2:
continue
answer_type, props_str = rest
- if answer_type.strip() != 'service':
+ if answer_type.strip() != 'SRV':
continue
props = props_str.strip().split(' ')
if len(props) < 4:
@@ -309,7 +310,7 @@
return
def _compose_command_args(self):
- return ['nslookup', '-type=' + self.type, self.host]
+ return ['host', '-t', self.type, self.host]
def _return_result(self):
if self.result_handler: