diff options
author | ron42 <51223319+ron42@users.noreply.github.com> | 2020-07-24 13:33:07 +0530 |
---|---|---|
committer | ron42 <51223319+ron42@users.noreply.github.com> | 2020-07-24 13:33:07 +0530 |
commit | f48a01a202ab0fc6cea71dcc3569d4b99d657b98 (patch) | |
tree | c2fa8372a273268e8ae93aa698bd90a4472ff009 | |
parent | 4648d3cd247e89c83829e38009a352f94b0b672d (diff) |
Fix handling of multiple SRV records for a single domain
-rwxr-xr-x | echoz.sh | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -6,8 +6,8 @@ jid="$1" password="$2" username="$(echo "$jid" | sed 's/@.*//')" domain="$(echo "$jid" | sed 's/.*@//')" -srv="$( ( dig +short SRV "_xmpp-client._tcp.$domain" | grep . || echo "0 0 5222 $domain" ) | sort -n | sed 's/[[:digit:]]\+[[:space:]][[:digit:]]\+[[:space:]]//')" -host="$(echo "$srv" | sed 's/[[:digit:]]\+[[:space:]]//')" +srv="$( ( dig +short SRV "_xmpp-client._tcp.$domain" | grep . || echo "0 0 5222 $domain" ) | sort -n | sed -n '1s/[[:digit:]]\+[[:space:]][[:digit:]]\+[[:space:]]//p')" +host="$(echo "$srv" | sed 's/[[:digit:]]\+[[:space:]]//' | sed 's/\.$//')" port="$(echo "$srv" | sed 's/[[:space:]].*//')" authstr="$(printf '\0%s\0%s' "$username" "$password" | base64)" rm -f "$pipename" |