[Asterisk-code-review] func_odbc: Introduce minargs config and expose ARGC in addition to A... (asterisk[master])

Jaco Kroon asteriskteam at digium.com
Wed Feb 17 16:08:22 CST 2021


Hello Friendly Automation, 

I'd like you to reexamine a change. Please visit

    https://gerrit.asterisk.org/c/asterisk/+/15448

to look at the new patch set (#4).

Change subject: func_odbc:  Introduce minargs config and expose ARGC in addition to ARGn.
......................................................................

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 at uls.co.za>
---
M configs/samples/func_odbc.conf.sample
M funcs/func_odbc.c
2 files changed, 40 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/48/15448/4
-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15448
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I6ca0b137d90b03f6aa9c496991f6cbf1518f6c24
Gerrit-Change-Number: 15448
Gerrit-PatchSet: 4
Gerrit-Owner: Jaco Kroon <jaco at uls.co.za>
Gerrit-Reviewer: Friendly Automation
Gerrit-MessageType: newpatchset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210217/0b5e6859/attachment.html>


More information about the asterisk-code-review mailing list