[Home]

Summary:ASTERISK-06301: dest variable in ENUMLOOKUP/func_enum.c is too small
Reporter:evilbunny (evilbunny)Labels:
Date Opened:2006-02-13 08:23:29.000-0600Date Closed:2008-01-15 16:47:27.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/Configuration
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:By default the dest var is set to 80 characters, this stiffles some creative uses of this function apart from route lookups.

--- func_enum.c.orig    2006-02-13 10:07:33.734795792 -0500
+++ func_enum.c 2006-02-13 10:01:15.271941685 -0500
@@ -55,7 +55,7 @@
{
       int res=0;
       char tech[80];
-       char dest[80] = "";
+       char dest[256] = "";
       char *zone;
       char *options;
       struct localuser *u;


****** ADDITIONAL INFORMATION ******

e164.org stores E2U+ADDRESS records in a manner that is consistent with RFC 1779, and the new ENUMLOOKUP function allows this information to be used much more effectively then txtcidname.

For example we could store the following string in DNS:

/CN=Fred Smith/O=XYZ Enterprises Pty Ltd/OU=Accounting and Administration Dept/L=Dullsville/ST=Some State/C=Gondwana Land/PC=1234567890

And the following macro could be used to parse this information:

[macro-address]
exten => s,1,Set(addy=${ENUMLOOKUP(+${ARG1},address,0,e164.org)})
exten => s,n,Set(counter=1)
exten => s,n(start),Set(counter=$[${counter}+1])
exten => s,n,Set(foo=${CUT(addy|/|${counter})})
exten => s,n,GotoIf($["${foo}"=""]?end)
exten => s,n,Set(key=${CUT(foo|=|1)})
exten => s,n,Set(${key}=${CUT(foo|=|2)})
exten => s,n,Goto(start)
exten => s,n(end),NoOp(${CN})

However due to the 80 character limit the returned string from DNS is truncated.
Comments:By: Olle Johansson (oej) 2006-02-13 09:28:16.000-0600

A candidate for stringfields I guess...

By: evilbunny (evilbunny) 2006-02-13 09:42:47.000-0600

After re-reading RFC 1779 '/' isn't valid as a separater, below is an example that complies with 1799...

CN=Fred Smith;O=XYZ Enterprises Pty Ltd;OU=Accounting and Administration Dept;L=Dullsville;ST=Some State;C=Gondwana Land;PC=1234567890

By: evilbunny (evilbunny) 2006-02-13 10:10:19.000-0600

also after thinking about this further there is a potential for people to exceed the 80 character limit with normal VoIP URIs as well, for example global TLDs allow up to 64 characters including the TLD, if you then have a 20 letter/number user portion this limit will be exceeded. The following example is 154 characters and requires almost double the 80 allowed characters.

"!^\\+1234567890(.*)$!IAX2:guestusername:guestpassword@voipserver2000.thelongestdomainnameintheworldandthensomeandthensomemoreandmore.com/1234567890\\1!"

By: Kevin P. Fleming (kpfleming) 2006-02-14 17:51:41.000-0600

Fixed in branch-1.2 and trunk (and no, this is not a candidate for a stringfield, since this is just a single buffer on the stack of this function).

By: Digium Subversion (svnbot) 2008-01-15 16:47:25.000-0600

Repository: asterisk
Revision: 10110

U   branches/1.2/funcs/func_enum.c

------------------------------------------------------------------------
r10110 | kpfleming | 2008-01-15 16:47:25 -0600 (Tue, 15 Jan 2008) | 2 lines

handle longer ENUM lookup results (issue ASTERISK-6301)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=10110

By: Digium Subversion (svnbot) 2008-01-15 16:47:27.000-0600

Repository: asterisk
Revision: 10112

U   trunk/funcs/func_enum.c

------------------------------------------------------------------------
r10112 | kpfleming | 2008-01-15 16:47:26 -0600 (Tue, 15 Jan 2008) | 2 lines

handle longer ENUM lookup results (issue ASTERISK-6301)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=10112