[asterisk-dev] [Code Review] Add #includeif statement

Jason Parker jparker at digium.com
Wed Oct 5 09:21:39 CDT 2011


On 10/04/2011 07:47 PM, Matt Riddell wrote:
> What was the original reason that #include started blocking the loading of
> modules when the included file was missing?  I've always hated that.
> 

Take the following config setup as an example.

sip.conf:
#include mypeer.conf
#include yourpeer.conf

mypeer.conf:
[mypeer]
type=peer
host=10.0.0.2
#include mypeer-secret.conf

yourpeer.conf:
[yourpeer]
type=peer
host=10.0.0.3
#include yourpeer-secret.conf

myypeer-secret.conf:
secret=applesauce

yourpeer-secret.conf:
secret=embiggen


The astute may have noticed that there is a typo in the mypeer-secret.conf.
What would happen if we allowed the config parser to continue?  Very bad things.

This is just one of several scenarios that I could think of.  It makes a lot of
sense to me that if somebody uses a #include, then they absolutely must have
that file - even if it's empty.



More information about the asterisk-dev mailing list