Revision: 6445 http://ipcop.svn.sourceforge.net/ipcop/?rev=6445&view=rev Author: owes Date: 2012-03-02 13:59:08 +0000 (Fri, 02 Mar 2012) Log Message: ----------- Easier to let suid helper handle start delay.
Modified Paths: -------------- ipcop/trunk/src/misc-progs/ipsecctrl.c ipcop/trunk/src/rc.d/rc.updatered ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0 Modified: ipcop/trunk/src/misc-progs/ipsecctrl.c =================================================================== --- ipcop/trunk/src/misc-progs/ipsecctrl.c 2012-03-02 12:47:08 UTC (rev 6444) +++ ipcop/trunk/src/misc-progs/ipsecctrl.c 2012-03-02 13:59:08 UTC (rev 6445) @@ -12,9 +12,10 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with IPCop; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with IPCop. If not, see <http://www.gnu.org/licenses/>. * + * (c) 2001-2012, the IPCop team + * * $Id$ * */ @@ -24,6 +25,7 @@ #include <getopt.h> #include <signal.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> @@ -45,6 +47,7 @@ static int flag_stop = 0; static int flag_status = 0; static int flag_reload = 0; +static int flag_wait = 0; static int enabled_count; @@ -52,12 +55,13 @@ { printf("Usage: %s [OPTION]\n\n", prg); printf("Options:\n"); - printf(" --start start/restart\n"); - printf(" --stop stop\n"); - printf(" --status retrieve pluto status\n"); - printf(" --reload reload certificates and secrets\n"); - printf(" --start=key# start/restart key number\n"); - printf(" --stop=key# stop key number\n"); + printf(" --start start/restart\n"); + printf(" --stop stop\n"); + printf(" --status retrieve pluto status\n"); + printf(" --reload reload certificates and secrets\n"); + printf(" --start=key# start/restart key number\n"); + printf(" --stop=key# stop key number\n"); + printf(" --wait wait before start\n"); printf(" -v, --verbose be verbose\n"); printf(" --help display this help and exit\n"); exit(exit_code); @@ -241,6 +245,7 @@ { "status", no_argument, &flag_status, 1 }, { "reload", no_argument, &flag_reload, 1 }, { "verbose", no_argument, 0, 'v' }, + { "wait", no_argument, &flag_wait, 1 }, { "help", no_argument, 0, 'h' }, { 0, 0, 0, 0} }; @@ -448,6 +453,15 @@ // start the system if (flag_start && ((connection == NULL) || (ipsec_running() == FAILURE))) { + if (flag_wait) { + char ipsec_delay[STRING_SIZE] = "0"; + find_kv_default(ipsec_kv, "VPN_DELAYED_START", ipsec_delay); + verbose_printf(1, "IPsec delayed start (%s) ", ipsec_delay); + _flushlbf(); + snprintf(buffer, STRING_SIZE-1, "sleep %s", ipsec_delay); + safe_system(buffer); + verbose_printf(1, "...\n"); + } if (flag_verbose) { verbose_printf(1, "Starting IPsec ... \n"); Modified: ipcop/trunk/src/rc.d/rc.updatered =================================================================== --- ipcop/trunk/src/rc.d/rc.updatered 2012-03-02 12:47:08 UTC (rev 6444) +++ ipcop/trunk/src/rc.d/rc.updatered 2012-03-02 13:59:08 UTC (rev 6445) @@ -13,10 +13,9 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with IPCop; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# along with IPCop. If not, see <http://www.gnu.org/licenses/>. # -# (c) 2001-2011, the IPCop team +# (c) 2001-2012, the IPCop team # # $Id$ # @@ -28,7 +27,6 @@ my %netsettings; my %dhcpsettings; my %pppsettings; -my %ipsecsettings; my %dhclient; @@ -36,7 +34,6 @@ &General::readhash('/var/ipcop/ethernet/settings', \%netsettings); &General::readhash('/var/ipcop/dhcp/settings', \%dhcpsettings); &General::readhash('/var/ipcop/ppp/settings', \%pppsettings); -&General::readhash('/var/ipcop/ipsec/settings', \%ipsecsettings); &General::readhash('/var/log/dhcpclient.info', \%dhclient) if (-e '/var/log/dhcpclient.info'); @@ -145,7 +142,7 @@ system('/usr/local/bin/restartntpd --red'); system('/usr/local/bin/setddns.pl --force'); system('/usr/local/bin/restartsquid --test &'); - system("/bin/sleep $ipsecsettings{'VPN_DELAYED_START'} && /usr/local/bin/ipsecctrl --start &"); + system('/usr/local/bin/ipsecctrl --start --wait &'); system('/usr/local/bin/updatelists.pl --red &'); `/usr/local/bin/blacklistupdate.pl --red < /dev/null > /dev/null &`; system('/usr/local/bin/restartshaping'); Modified: ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0 =================================================================== --- ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0 2012-03-02 12:47:08 UTC (rev 6444) +++ ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0 2012-03-02 13:59:08 UTC (rev 6445) @@ -1,4 +1,5 @@ ## please place IPCop files first, then packages sorted by alphabetical order +/etc/rc.d/rc.updatered /home/httpd/cgi-bin/ddns.cgi /home/httpd/cgi-bin/dhcp.cgi /home/httpd/cgi-bin/hosts.cgi @@ -17,6 +18,7 @@ /usr/lib/ipcop/library.sh /usr/lib/ipcop/scheduler-lib.pl /usr/local/bin/blacklistupdate.pl +/usr/local/bin/ipsecctrl /usr/local/bin/puzzleFwRules.pl /usr/local/bin/restartsquid /usr/local/bin/scheduler.pl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Ipcop-svn mailing list Ipcop-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipcop-svn