]> 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:13 +0000 (12:18 -0600)
commitbee35fe04ac9473f5d98588421fd1a2dad401cb8
tree0573949104cd5760479d72f3e96bfbadb61c8420
parent092628c9829f1ff89333f9c5099b649ec060b5ac
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