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
This commit is contained in:
Ruslan Makhmatkhanov 2014-02-19 20:41:53 +00:00
parent d54642e6c0
commit f87c8b3c38
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=345147
2 changed files with 42 additions and 0 deletions

View file

@ -3,6 +3,7 @@
PORTNAME= gajim
PORTVERSION= 0.15.4
PORTREVISION= 1
CATEGORIES= net-im
MASTER_SITES= http://gajim.org/downloads/0.15/
@ -42,6 +43,10 @@ NLS_USES= gettext
NO_STAGE= yes
.include <bsd.port.options.mk>
.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1000000
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-src-common_resolver.py
.endif
.if ! ${PORT_OPTIONS:MNLS}
CONFIGURE_ARGS+= --disable-nls
.endif

View file

@ -0,0 +1,37 @@
--- 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: