[Pkg-voip-commits] r2421 - yxa/trunk/debian/patches
Mikael Magnusson
mikma-guest at costa.debian.org
Sun Sep 24 19:42:08 UTC 2006
Author: mikma-guest
Date: 2006-09-24 19:42:08 +0000 (Sun, 24 Sep 2006)
New Revision: 2421
Added:
yxa/trunk/debian/patches/homedomain.dpatch
Modified:
yxa/trunk/debian/patches/00list
Log:
A Sip Proxy should not consume SIP requests if the ip address matches one
of addresses the proxy listens to but the port doesn't.
Modified: yxa/trunk/debian/patches/00list
===================================================================
--- yxa/trunk/debian/patches/00list 2006-09-24 19:04:17 UTC (rev 2420)
+++ yxa/trunk/debian/patches/00list 2006-09-24 19:42:08 UTC (rev 2421)
@@ -5,5 +5,6 @@
distclean
#init-mnesia
net_util
+homedomain
yxa_yaws_makefile
yxa_yaws
Added: yxa/trunk/debian/patches/homedomain.dpatch
===================================================================
--- yxa/trunk/debian/patches/homedomain.dpatch (rev 0)
+++ yxa/trunk/debian/patches/homedomain.dpatch 2006-09-24 19:42:08 UTC (rev 2421)
@@ -0,0 +1,117 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## homedomain.dpatch by <mikma at users.sourceforge.net>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Proxy should not consume SIP requests if the ip address matches one
+## DP: of addresses the proxy listens to but the port doesn't.
+
+ at DPATCH@
+diff -urNad yxa-0.91~/src/incomingproxy.erl yxa-0.91/src/incomingproxy.erl
+--- yxa-0.91~/src/incomingproxy.erl 2006-09-24 21:19:58.000000000 +0200
++++ yxa-0.91/src/incomingproxy.erl 2006-09-24 21:20:05.000000000 +0200
+@@ -107,7 +107,7 @@
+ %% Check if the From: address matches our homedomains, and if so
+ %% call verify_homedomain_user() to make sure the user is
+ %% authorized and authenticated to use this From: address
+- case local:homedomain(FromURI#sipurl.host) of
++ case local:homedomain(FromURI) of
+ true ->
+ case verify_homedomain_user(Request, LogTag, Origin, LogStr) of
+ true ->
+@@ -289,7 +289,7 @@
+ URL = Request#request.uri,
+ case keylist:fetch('route', Request#request.header) of
+ [] ->
+- Loc1 = case local:homedomain(URL#sipurl.host) of
++ Loc1 = case local:homedomain(URL) of
+ true ->
+ case local:is_request_to_this_proxy(Request) of
+ true ->
+diff -urNad yxa-0.91~/src/lookup.erl yxa-0.91/src/lookup.erl
+--- yxa-0.91~/src/lookup.erl 2006-09-24 21:19:58.000000000 +0200
++++ yxa-0.91/src/lookup.erl 2006-09-24 21:23:11.000000000 +0200
+@@ -372,7 +372,7 @@
+ %% Reason = string(), SIP reason phrase
+ %%--------------------------------------------------------------------
+ lookupdefault(URL) when is_record(URL, sipurl) ->
+- case homedomain(URL#sipurl.host) of
++ case homedomain(URL) of
+ true ->
+ logger:log(debug, "Lookup: Cannot default-route request to a local domain (~s), aborting",
+ [URL#sipurl.host]),
+@@ -456,7 +456,7 @@
+ URL = sipurl:parse(URLstr),
+ E164User = URL#sipurl.user,
+ E164Host = URL#sipurl.host,
+- IsMe = homedomain(E164Host),
++ IsMe = homedomain(URL),
+ %% Try to rewrite the userpart of the returned URL into a E164 number
+ %% to make sure it is not a loop back to this proxy. If it is a remote
+ %% domain, the username comparison test does not have any effect, so
+@@ -577,7 +577,7 @@
+ case sipurl:parse_url_with_default_protocol("sip", Res) of
+ URL when is_record(URL, sipurl) ->
+ %% Check if it is a local URL or a remote
+- case homedomain(URL#sipurl.host) of
++ case homedomain(URL) of
+ true ->
+ {proxy, URL};
+ false ->
+@@ -651,7 +651,7 @@
+ is_request_to_this_proxy(Request) when is_record(Request, request) ->
+ {Method, URI, Header} = {Request#request.method, Request#request.uri, Request#request.header},
+ IsOptionsForMe = is_request_to_this_proxy2(Method, URI, Header),
+- IsHomedomain = local:homedomain(URI#sipurl.host),
++ IsHomedomain = local:homedomain(URI),
+ NoUserpart = (URI#sipurl.user == none),
+ if
+ IsOptionsForMe == true ->
+@@ -692,6 +692,15 @@
+ %% Returns : true | false
+ %%--------------------------------------------------------------------
+ homedomain(Domain) when is_list(Domain) ->
++ homedomain2(Domain, any);
++
++homedomain(URL) when is_record(URL, sipurl) ->
++ Port = sipsocket:default_port(URL#sipurl.proto, sipurl:get_port(URL)),
++ homedomain2(URL#sipurl.host, Port).
++
++
++homedomain2(Domain, Port) when is_list(Domain) ->
++
+ {ok, HomedomainL} = yxa_config:get_env(homedomain, []),
+ LCdomain = http_util:to_lower(Domain),
+ case lists:member(LCdomain, HomedomainL) of
+@@ -701,10 +710,18 @@
+ %% Domain did not match configured sets of homedomain, check against list
+ %% of hostnames and also my IP address
+ {ok, MyHostnames} = yxa_config:get_env(myhostnames, []),
+- lists:member(LCdomain, MyHostnames)
+- orelse lists:member(LCdomain, siphost:myip_list())
++ (lists:member(LCdomain, MyHostnames)
++ orelse lists:member(LCdomain, siphost:myip_list()))
++ andalso case Port of
++ any ->
++ true;
++ Port1 ->
++ MyPorts = sipsocket:get_all_listenports(),
++ lists:member(Port1, MyPorts)
++ end
+ end.
+
++
+ %%--------------------------------------------------------------------
+ %% Function: get_remote_party_number(User, Header, DstHost)
+ %% User = string(), SIP authentication username
+diff -urNad yxa-0.91~/src/siplocation.erl yxa-0.91/src/siplocation.erl
+--- yxa-0.91~/src/siplocation.erl 2006-09-24 21:19:58.000000000 +0200
++++ yxa-0.91/src/siplocation.erl 2006-09-24 21:20:05.000000000 +0200
+@@ -147,7 +147,7 @@
+ logger:log(debug, "~p: REGISTER ~p", [AppName, sipurl:print(URL)]),
+ %% RFC 3261 chapter 10.3 - Processing REGISTER Request - step 1
+ %% check if this registrar handles the domain the request wants to register for
+- case local:homedomain(URL#sipurl.host) of
++ case local:homedomain(URL) of
+ true ->
+ register_require_supported(Request, LogStr, THandler, LogTag, AppName);
+ false ->
Property changes on: yxa/trunk/debian/patches/homedomain.dpatch
___________________________________________________________________
Name: svn:executable
+ *
More information about the Pkg-voip-commits
mailing list