#!/usr/bin/perl # import.cgi # Add an imported connection to the config file require './ipsec-lib.pl'; &ReadParseMime(); &error_setup($text{'import_err'}); # Get the file if ($in{'mode'} == 0) { $in{'upload'} || &error($text{'import_eupload'}); $in{'upload'} =~ s/\r//g; @data = split(/\n/, $in{'upload'}); } else { $in{'file'} || &error($text{'import_efile'}); open(FILE, "<$in{'file'}") || &error($text{'import_eopen'}); while(<FILE>) { s/\r|\n//g; push(@data, $_); } close(FILE); } # Read and validate it $temp = &transname(); open(TEMP, ">$temp"); print TEMP map { "$_\n" } @data; close(TEMP); @iconf = &get_config($temp); unlink($temp); if (@iconf != 1 || $iconf[0]->{'name'} ne 'conn') { &error($text{'import_eformat'}); } @conf = &get_config(); foreach $c (@conf) { if (lc($c->{'value'}) eq lc($iconf[0]->{'value'})) { $clash = $c; if (!$in{'over'}) { &error(&text('import_eclash', "<tt>$iconf[0]->{'value'}</tt>")); } } } # Add to the real config file if ($clash) { &lock_file($clash->{'file'}); $lref = &read_file_lines($clash->{'file'}); splice(@$lref, $clash->{'line'}, $clash->{'eline'} - $clash->{'line'} + 1, @data); } else { &lock_file($config{'file'}); $lref = &read_file_lines($config{'file'}); push(@$lref, @data); } &flush_file_lines(); &unlock_all_files(); # Tell the user &ui_print_header(undef, $text{'import_title'}, ""); print "<p>",&text($clash ? 'import_done2' : 'import_done1', "<tt>$iconf[0]->{'value'}</tt>"),"<p>\n"; &ui_print_footer("", $text{'index_return'}); # All done &webmin_log("import", "conn", $iconf[0]->{'value'}, $iconf[0]->{'values'});
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
help | Folder | 0755 |
|
|
images | Folder | 0755 |
|
|
lang | Folder | 0755 |
|
|
CHANGELOG | File | 239 B | 0644 |
|
backup_config.pl | File | 694 B | 0755 |
|
bootup.cgi | File | 381 B | 0755 |
|
config | File | 241 B | 0644 |
|
config-AlmaLinux-7.0-ALL | File | 235 B | 0644 |
|
config-Amazon-Linux-2-ALL | File | 235 B | 0644 |
|
config-CentOS-Linux-7.0-ALL | File | 235 B | 0644 |
|
config-CentOS-Stream-Linux-8.0-ALL | File | 235 B | 0644 |
|
config-CloudLinux-8.0-ALL | File | 235 B | 0644 |
|
config-Oracle-Linux-8.0-ALL | File | 235 B | 0644 |
|
config-Redhat-Enterprise-Linux-7.0-ALL | File | 235 B | 0644 |
|
config-Rocky-Linux-7.0-ALL | File | 235 B | 0644 |
|
config-Scientific-Linux-7.0-ALL | File | 235 B | 0644 |
|
config-coherent-linux | File | 256 B | 0644 |
|
config-debian-linux | File | 235 B | 0644 |
|
config-mandrake-linux | File | 250 B | 0644 |
|
config-openSUSE-Linux-15.0-ALL | File | 229 B | 0644 |
|
config-openmamba-linux | File | 250 B | 0644 |
|
config-redhat-linux | File | 256 B | 0644 |
|
config-suse-linux-8.2-ALL | File | 235 B | 0644 |
|
config-syno-linux | File | 241 B | 0644 |
|
config-trustix-linux | File | 235 B | 0644 |
|
config.info | File | 342 B | 0644 |
|
config.info.ca | File | 381 B | 0644 |
|
config.info.de | File | 386 B | 0644 |
|
config.info.es | File | 401 B | 0644 |
|
config.info.fr | File | 371 B | 0644 |
|
config.info.nl | File | 388 B | 0644 |
|
config.info.no | File | 357 B | 0644 |
|
edit.cgi | File | 8.25 KB | 0755 |
|
edit_config.cgi | File | 3.6 KB | 0755 |
|
edit_policy.cgi | File | 1.3 KB | 0755 |
|
edit_secret.cgi | File | 2.1 KB | 0755 |
|
export.cgi | File | 934 B | 0755 |
|
export_form.cgi | File | 776 B | 0755 |
|
import.cgi | File | 1.61 KB | 0755 |
|
import_form.cgi | File | 776 B | 0755 |
|
index.cgi | File | 5.21 KB | 0755 |
|
install_check.pl | File | 450 B | 0755 |
|
ipsec-lib.pl | File | 10.33 KB | 0755 |
|
list_secrets.cgi | File | 1.08 KB | 0755 |
|
log_parser.pl | File | 820 B | 0755 |
|
module.info | File | 184 B | 0644 |
|
module.info.af | File | 0 B | 0644 |
|
module.info.af.auto | File | 130 B | 0644 |
|
module.info.ar | File | 0 B | 0644 |
|
module.info.ar.auto | File | 179 B | 0644 |
|
module.info.be | File | 0 B | 0644 |
|
module.info.be.auto | File | 160 B | 0644 |
|
module.info.bg | File | 0 B | 0644 |
|
module.info.bg.auto | File | 169 B | 0644 |
|
module.info.ca | File | 122 B | 0644 |
|
module.info.ca.auto | File | 14 B | 0644 |
|
module.info.cs | File | 29 B | 0644 |
|
module.info.cs.auto | File | 79 B | 0644 |
|
module.info.da | File | 0 B | 0644 |
|
module.info.da.auto | File | 133 B | 0644 |
|
module.info.de | File | 115 B | 0644 |
|
module.info.de.auto | File | 14 B | 0644 |
|
module.info.el | File | 0 B | 0644 |
|
module.info.el.auto | File | 221 B | 0644 |
|
module.info.es | File | 36 B | 0644 |
|
module.info.es.auto | File | 91 B | 0644 |
|
module.info.eu | File | 0 B | 0644 |
|
module.info.eu.auto | File | 136 B | 0644 |
|
module.info.fa | File | 0 B | 0644 |
|
module.info.fa.auto | File | 181 B | 0644 |
|
module.info.fi | File | 0 B | 0644 |
|
module.info.fi.auto | File | 122 B | 0644 |
|
module.info.fr | File | 0 B | 0644 |
|
module.info.fr.auto | File | 134 B | 0644 |
|
module.info.he | File | 0 B | 0644 |
|
module.info.he.auto | File | 129 B | 0644 |
|
module.info.hr | File | 0 B | 0644 |
|
module.info.hr.auto | File | 131 B | 0644 |
|
module.info.hu | File | 0 B | 0644 |
|
module.info.hu.auto | File | 148 B | 0644 |
|
module.info.it | File | 0 B | 0644 |
|
module.info.it.auto | File | 133 B | 0644 |
|
module.info.ja | File | 0 B | 0644 |
|
module.info.ja.auto | File | 164 B | 0644 |
|
module.info.ko | File | 0 B | 0644 |
|
module.info.ko.auto | File | 149 B | 0644 |
|
module.info.lt | File | 0 B | 0644 |
|
module.info.lt.auto | File | 146 B | 0644 |
|
module.info.lv | File | 0 B | 0644 |
|
module.info.lv.auto | File | 121 B | 0644 |
|
module.info.ms | File | 122 B | 0644 |
|
module.info.ms.auto | File | 14 B | 0644 |
|
module.info.mt | File | 0 B | 0644 |
|
module.info.mt.auto | File | 127 B | 0644 |
|
module.info.nl | File | 31 B | 0644 |
|
module.info.nl.auto | File | 88 B | 0644 |
|
module.info.no | File | 32 B | 0644 |
|
module.info.no.auto | File | 100 B | 0644 |
|
module.info.pl | File | 0 B | 0644 |
|
module.info.pl.auto | File | 123 B | 0644 |
|
module.info.pt | File | 0 B | 0644 |
|
module.info.pt.auto | File | 133 B | 0644 |
|
module.info.pt_BR | File | 0 B | 0644 |
|
module.info.pt_BR.auto | File | 142 B | 0644 |
|
module.info.ro | File | 0 B | 0644 |
|
module.info.ro.auto | File | 133 B | 0644 |
|
module.info.ru | File | 0 B | 0644 |
|
module.info.ru.auto | File | 180 B | 0644 |
|
module.info.sk | File | 0 B | 0644 |
|
module.info.sk.auto | File | 112 B | 0644 |
|
module.info.sl | File | 0 B | 0644 |
|
module.info.sl.auto | File | 126 B | 0644 |
|
module.info.sv | File | 0 B | 0644 |
|
module.info.sv.auto | File | 124 B | 0644 |
|
module.info.th | File | 0 B | 0644 |
|
module.info.th.auto | File | 225 B | 0644 |
|
module.info.tr | File | 0 B | 0644 |
|
module.info.tr.auto | File | 134 B | 0644 |
|
module.info.uk | File | 0 B | 0644 |
|
module.info.uk.auto | File | 178 B | 0644 |
|
module.info.ur | File | 0 B | 0644 |
|
module.info.ur.auto | File | 220 B | 0644 |
|
module.info.vi | File | 0 B | 0644 |
|
module.info.vi.auto | File | 131 B | 0644 |
|
module.info.zh | File | 0 B | 0644 |
|
module.info.zh.auto | File | 114 B | 0644 |
|
module.info.zh_TW | File | 0 B | 0644 |
|
module.info.zh_TW.auto | File | 123 B | 0644 |
|
newkey.cgi | File | 388 B | 0755 |
|
restart.cgi | File | 210 B | 0755 |
|
save.cgi | File | 4.8 KB | 0755 |
|
save_config.cgi | File | 1.8 KB | 0755 |
|
save_policy.cgi | File | 717 B | 0755 |
|
save_secret.cgi | File | 1.53 KB | 0755 |
|
showkey.cgi | File | 861 B | 0755 |
|
start.cgi | File | 281 B | 0755 |
|
stop.cgi | File | 243 B | 0755 |
|
up.cgi | File | 783 B | 0755 |
|