Many of these recommendations are intended to allow individual cgi scripts to communicate with each other. By having a common language, it is possible to have one web-page (.cgi) query another for information. This makes it possible to build web based "wizards" for setting up a LEAF router.
It is recommended that the form variable "cmd" be used for the
function a .cgi should perform. For instance, when using
svcstat.sh
"cmd" can be "", "Stop", "Start", or
"Restart". Other useful values for "cmd" can be "Save" and "Cancel"
Since parsing the conf files is unique to each package, it may be helpful if each webconf cgi has a standard way of reports its current settings. Something like this:
if [ "$cmd" = "List" ]; then cat <<-EOF <!-- #BEGIN WEBCONF SETTINGS LIST $( cat /tmp/$SESSIONID.vars ) #END WEBCONF SETTINGS LIST --> </pre> fi
To get the current settings, use a construct like this:
cmd=List /var/webconf/www/dropbear.cgi | \ sed -n "/^#BEGIN WEBCONF SETTINGS/,/^#END WEBCONF SETTINGS/p" > /tmp/tempfile . /tmp/tempfile
This is helpful when one webconf needs to know the values in another; such as the networking.cgi needing to know from shorewall which interface is in the "loc" zone.