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

Jaco Kroon asteriskteam at digium.com
Mon Feb 22 08:25:00 CST 2021


Hello Joshua Colp, 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 (#5).

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
A doc/CHANGES-staging/func_odbc_ARGC_minargs.txt
M funcs/func_odbc.c
3 files changed, 60 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/48/15448/5
-- 
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: 5
Gerrit-Owner: Jaco Kroon <jaco at uls.co.za>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: newpatchset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210222/7223d239/attachment.html>


More information about the asterisk-code-review mailing list