]> git.ipfire.org Git - thirdparty/asterisk.git/commit
func_odbc: Introduce minargs config and expose ARGC in addition to ARGn.
authorJaco Kroon <jaco@uls.co.za>
Wed, 17 Feb 2021 20:51:17 +0000 (22:51 +0200)
committerGeorge Joseph <gjoseph@digium.com>
Tue, 23 Feb 2021 18:18:00 +0000 (12:18 -0600)
commitd847f7e8f8736e5f51fd11df2992fac87131c1d8
treefe07e034db1629cac218ecbc26a756e714ec0944
parent435d68be9725d2d72b1e1158beb2e09b95bd7764
func_odbc:  Introduce minargs config and expose ARGC in addition to ARGn.

minargs enables enforcing of minimum count of arguments to pass to
func_odbc, so if you're unconditionally using ARG1 through ARG4 then
this should be set to 4.  func_odbc will generate an error in this case,
so for example

[FOO]
minargs = 4

and ODBC_FOO(a,b,c) in dialplan will now error out instead of using a
potentially leaked ARG4 from Gosub().

ARGC is needed if you're using optional argument, to verify whether or
not an argument has been passed, else it's possible to use a leaked ARGn
from Gosub (app_stack).  So now you can safely do
${IF($[${ARGC}>3]?${ARGV}:default value)} kind of thing.

Change-Id: I6ca0b137d90b03f6aa9c496991f6cbf1518f6c24
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
configs/samples/func_odbc.conf.sample
doc/CHANGES-staging/func_odbc_ARGC_minargs.txt [new file with mode: 0644]
funcs/func_odbc.c