NAPTR lookup in subversion trunk is broken with the Erlang R13. Patch
included.

/Mikael

diff --git a/src/dnsutil.erl b/src/dnsutil.erl
index dde585d..a287ad4 100644
--- a/src/dnsutil.erl
+++ b/src/dnsutil.erl
@@ -745,6 +745,10 @@ parse_naptr_answer(DNSRRList) when is_list(DNSRRList) ->
 parse_naptr_answer2([#dns_rr{type=?T_NAPTR, data=Data} | T], Res) when is_list(Data) ->
     This = parsenaptr(list_to_binary(Data)),
     parse_naptr_answer2(T, [This | Res]);
+%% Pre-parsed NAPTR record
+parse_naptr_answer2([#dns_rr{type=naptr, data=Data} | T], Res) when is_tuple(Data) ->
+    This = naptr_from_tuple(Data),
+    parse_naptr_answer2(T, [This | Res]);
 %% non-NAPTR record
 parse_naptr_answer2([H | T], Res) when is_record(H, dns_rr) ->
     parse_naptr_answer2(T, Res);
@@ -790,6 +794,32 @@ parsenaptr(Binary) when is_binary(Binary) ->
 		}.
 
 %%--------------------------------------------------------------------
+%% @spec    ({Order, Preference, Flags,
+%%            Services, Regexp, Replacement}) ->
+%%            NAPTRrecord
+%%
+%%            Order = integer()
+%%            Preference = integer()
+%%            Flags = string()
+%%            Services = string()
+%%            Regexp = string()
+%%            Replacement = string()
+%%
+%%            NAPTRrecord = #naptrrecord{}
+%%
+%% @doc     Takes some pre-parsed DNS RR data and converts it into
+%%          a naptrrecord.
+%% @end
+%%--------------------------------------------------------------------
+naptr_from_tuple({Order, Preference, Flags, Services, Regexp, Replacement}) ->
+    #naptrrecord{order=Order, preference=Preference,
+		 flags=Flags,
+		 services=string:to_upper(Services),
+		 regexp=Regexp,
+		 replacement=Replacement
+		}.
+
+%%--------------------------------------------------------------------
 %% @spec    (Len, In, []) ->
 %%            Replacement
 %%
_______________________________________________
Yxa-devel mailing list
Yxa-devel@lists.su.se
https://lists.su.se/mailman/listinfo/yxa-devel

Reply via email to