#!/usr/bin/perl # edit.cgi # Display a form for editing tunnel details require './pptp-client-lib.pl'; &ReadParse(); if ($in{'new'}) { &ui_print_header(undef, $text{'edit_title1'}, ""); } else { &ui_print_header(undef, $text{'edit_title2'}, ""); ($tunnel) = grep { $_->{'name'} eq $in{'tunnel'} } &list_tunnels(); &parse_comments($tunnel); $login = &find("name", $tunnel->{'opts'}); $sn = $login ? $login->{'value'} : &get_system_hostname(1); @secs = &list_secrets(); ($sec) = grep { $_->{'client'} eq $sn } @secs; } print "<form action=save.cgi method=post>\n"; print "<input type=hidden name=new value='$in{'new'}'>\n"; print "<input type=hidden name=old value='$in{'tunnel'}'>\n"; print "<table border width=100%>\n"; print "<tr $tb> <td><b>$text{'edit_header'}</b></td> </tr>\n"; print "<tr $cb> <td><table width=100%>\n"; print "<tr> <td><b>$text{'edit_name'}</b></td>\n"; printf "<td><input name=tunnel size=30 value='%s'></td>\n", $tunnel->{'name'}; print "<td><b>$text{'edit_server'}</b></td>\n"; printf "<td><input name=server size=20 value='%s'></td> </tr>\n", $tunnel->{'server'}; print "<tr> <td><b>$text{'edit_login'}</b></td>\n"; printf "<td nowrap><input type=radio name=login_def value=1 %s> %s\n", $login ? "" : "checked", $text{'edit_same'}; printf "<input type=radio name=login_def value=0 %s>\n", $login ? "checked" : ""; printf "<input name=login size=15 value='%s'></td>\n", $login->{'value'}; print "<td><b>$text{'edit_pass'}</b></td>\n"; printf "<td><input name=spass type=password value='%s'></td> </tr>\n", $sec->{'secret'}; $remote = &find("remotename", $tunnel->{'opts'}); print "<tr> <td><b>$text{'edit_remote'}</b></td>\n"; printf "<td nowrap><input type=radio name=remote_def value=1 %s> %s\n", $remote ? "" : "checked", $text{'edit_auto'}; printf "<input type=radio name=remote_def value=0 %s>\n", $remote ? "checked" : ""; printf "<input name=remote size=15 value='%s'></td>\n", $remote->{'value'}; print "</tr>\n"; # Show PPP include file $file = &find("file", $tunnel->{'opts'}); $fmode = $in{'new'} ? 1 : !$file ? 0 : $file->{'value'} eq $config{'pptp_options'} ? 1 : 2; print "<tr> <td><b>$text{'edit_file'}</b></td> <td colspan=3>\n"; printf "<input type=radio name=file_def value=0 %s> %s\n", $fmode == 0 ? "checked" : "", $text{'edit_none'}; printf "<input type=radio name=file_def value=1 %s> %s\n", $fmode == 1 ? "checked" : "", $text{'edit_global'}; printf "<input type=radio name=file_def value=2 %s> %s\n", $fmode == 2 ? "checked" : "", $text{'edit_ofile'}; printf "<input name=file size=30 value='%s'> %s</td> </tr>\n", $fmode == 2 ? $file->{'value'} : "", &file_chooser_button("file"); print "<tr> <td colspan=4><hr></td> </tr>\n"; # Parse all route comments foreach $r (@{$tunnel->{'routes'}}) { if ($r =~ /^\s*add\s+-net\s+(\S+)\s+netmask\s+(\S+)\s+gw\s+(\S+)\s*$/) { # Net route to specific gateway push(@kroutes, [ 1, $1, $2, $3 ]); } elsif ($r =~ /^\s*add\s+-net\s+(\S+)\s+gw\s+(\S+)\s+netmask\s+(\S+)\s*$/) { # Net route to specific gateway push(@kroutes, [ 1, $1, $3, $2 ]); } elsif ($r =~ /^\s*add\s+-net\s+(\S+)\s+netmask\s+(\S+)\s+dev\s+(TUNNEL_DEV)\s*$/) { # Net route to other end push(@kroutes, [ 1, $1, $2, 'GW' ]); } elsif ($r =~ /^\s*add\s+-net\s+(\S+)\s+dev\s+(TUNNEL_DEV)\s+netmask\s+(\S+)\s*$/) { # Net route to other end push(@kroutes, [ 1, $1, $3, 'GW' ]); } elsif ($r =~ /^\s*add\s+-host\s+(\S+)\s+gw\s+(\S+)\s*$/) { # Host route to specific gateway push(@kroutes, [ 2, $1, undef, $2 ]); } elsif ($r =~ /^\s*add\s+-host\s+(\S+)\s+dev\s+(TUNNEL_DEV)\s*$/) { # Host route to specific gateway push(@kroutes, [ 2, $1, undef, 'GW' ]); } elsif ($r =~ /^\s*add\s+default\s+gw\s+(\S+)\s*$/) { # Default route to specific gateway $adddef = $1; } elsif ($r =~ /^\s*add\s+default\s+dev\s+(TUNNEL_DEV)\s*$/) { # Default route to other end $adddef = 'GW'; } elsif ($r =~ /^\s*delete\s+default\s*$/) { # Deleting old default route $deldef = 1; } else { push(@uroutes, $r); } } # Show default route options print "<tr> <td><b>$text{'edit_adddef'}</b></td> <td colspan=3>\n"; printf "<input type=radio name=adddef value=1 %s> %s\n", $adddef eq "GW" ? "checked" : "", $text{'edit_def1'}; printf "<input type=radio name=adddef value=2 %s> %s\n", $adddef && $adddef ne "GW" ? "checked" : "", $text{'edit_def2'}; printf "<input name=def size=15 value='%s'>\n", $adddef eq "GW" ? "" : $adddef; printf "<input type=radio name=adddef value=0 %s> %s\n", $adddef ? "" : "checked", $text{'no'}; print "</td> </tr>\n"; print "<tr> <td><b>$text{'edit_deldef'}</b></td>\n"; printf "<td><input type=radio name=deldef value=1 %s> %s\n", $deldef ? "checked" : "", $text{'yes'}; printf "<input type=radio name=deldef value=0 %s> %s</td> </tr>\n", $deldef ? "" : "checked", $text{'no'}; # Show editable routes print "<tr> <td valign=top><b>$text{'edit_routes'}</b></td>\n"; print "<td colspan=3><table border width=100%>\n"; print "<tr $tb> <td><b>$text{'edit_type'}</b></td> ", "<td><b>$text{'edit_net'}</b></td> ", "<td><b>$text{'edit_mask'}</b></td> ", "<td><b>$text{'edit_gw'}</b></td> </tr>\n"; $i = 0; foreach $r (@kroutes, [ 0, undef, undef, 'GW' ]) { print "<tr $cb>\n"; print "<td><select name=type_$i>\n"; foreach $o (0 .. 2) { printf "<option value=%d %s>%s</option>\n", $o, $r->[0] == $o ? "selected" : "", $text{'edit_type'.$o}; } print "</select></td>\n"; print "<td><input name=net_$i size=15 value='$r->[1]'></td>\n"; print "<td><input name=mask_$i size=15 value='$r->[2]'></td>\n"; printf "<td nowrap><input type=radio name=gw_def_$i value=1 %s> %s\n", $r->[3] eq 'GW' ? "checked" : "", $text{'edit_gw_def'}; printf "<input type=radio name=gw_def_$i value=0 %s>\n", $r->[3] eq 'GW' ? "" : "checked"; printf "<input name=gw_$i size=15 value='%s'></td>\n", $r->[3] eq 'GW' ? "" : $r->[3]; print "</tr>\n"; $i++; } print "</table></td> </tr>\n"; # Show other route commands print "<tr> <td valign=top><b>$text{'edit_unknown'}</b></td>\n"; print "<td colspan=3><textarea name=unknown rows=3 cols=60>", join("\n", @uroutes),"</textarea></td> </tr>\n"; print "<tr> <td colspan=4><hr></td> </tr>\n"; # Show MPPE options print "<tr> <td colspan=4 align=center>$text{'opts_msdesc'}</td> </tr>\n"; &mppe_options_form($tunnel->{'opts'}); print "</table></td></tr></table>\n"; print "<table width=100%><tr>\n"; if ($in{'new'}) { print "<td><input type=submit value='$text{'create'}'></td>\n"; } else { print "<td><input type=submit value='$text{'save'}'></td>\n"; print "<td align=right><input type=submit name=delete ", "value='$text{'delete'}'></td>\n"; } print "</tr></table>\n"; &ui_print_footer("", $text{'index_return'});
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
help | Folder | 0755 |
|
|
images | Folder | 0755 |
|
|
lang | Folder | 0755 |
|
|
CHANGELOG | File | 448 B | 0644 |
|
backup_config.pl | File | 702 B | 0755 |
|
bootup.cgi | File | 863 B | 0755 |
|
config | File | 112 B | 0644 |
|
config.info | File | 274 B | 0644 |
|
config.info.ca | File | 310 B | 0644 |
|
config.info.de | File | 306 B | 0644 |
|
config.info.fr | File | 0 B | 0644 |
|
config.info.nl | File | 297 B | 0644 |
|
config.info.no | File | 292 B | 0644 |
|
config.info.pt_BR | File | 320 B | 0644 |
|
conn.cgi | File | 2.32 KB | 0755 |
|
disc.cgi | File | 543 B | 0755 |
|
edit.cgi | File | 6.59 KB | 0755 |
|
edit_opts.cgi | File | 1.43 KB | 0755 |
|
index.cgi | File | 2.69 KB | 0755 |
|
install_check.pl | File | 385 B | 0755 |
|
log_parser.pl | File | 733 B | 0755 |
|
module.info | File | 193 B | 0644 |
|
module.info.af | File | 0 B | 0644 |
|
module.info.af.auto | File | 139 B | 0644 |
|
module.info.ar | File | 0 B | 0644 |
|
module.info.ar.auto | File | 150 B | 0644 |
|
module.info.be | File | 0 B | 0644 |
|
module.info.be.auto | File | 192 B | 0644 |
|
module.info.bg | File | 0 B | 0644 |
|
module.info.bg.auto | File | 194 B | 0644 |
|
module.info.ca | File | 116 B | 0644 |
|
module.info.ca.auto | File | 13 B | 0644 |
|
module.info.cs | File | 24 B | 0644 |
|
module.info.cs.auto | File | 102 B | 0644 |
|
module.info.da | File | 0 B | 0644 |
|
module.info.da.auto | File | 134 B | 0644 |
|
module.info.de | File | 121 B | 0644 |
|
module.info.de.auto | File | 13 B | 0644 |
|
module.info.el | File | 0 B | 0644 |
|
module.info.el.auto | File | 216 B | 0644 |
|
module.info.es | File | 0 B | 0644 |
|
module.info.es.auto | File | 132 B | 0644 |
|
module.info.eu | File | 0 B | 0644 |
|
module.info.eu.auto | File | 132 B | 0644 |
|
module.info.fa | File | 0 B | 0644 |
|
module.info.fa.auto | File | 175 B | 0644 |
|
module.info.fi | File | 0 B | 0644 |
|
module.info.fi.auto | File | 123 B | 0644 |
|
module.info.fr | File | 0 B | 0644 |
|
module.info.fr.auto | File | 137 B | 0644 |
|
module.info.he | File | 0 B | 0644 |
|
module.info.he.auto | File | 134 B | 0644 |
|
module.info.hr | File | 0 B | 0644 |
|
module.info.hr.auto | File | 130 B | 0644 |
|
module.info.hu | File | 0 B | 0644 |
|
module.info.hu.auto | File | 151 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 | 161 B | 0644 |
|
module.info.ko | File | 0 B | 0644 |
|
module.info.ko.auto | File | 156 B | 0644 |
|
module.info.lt | File | 0 B | 0644 |
|
module.info.lt.auto | File | 133 B | 0644 |
|
module.info.lv | File | 0 B | 0644 |
|
module.info.lv.auto | File | 136 B | 0644 |
|
module.info.ms | File | 118 B | 0644 |
|
module.info.ms.auto | File | 13 B | 0644 |
|
module.info.mt | File | 0 B | 0644 |
|
module.info.mt.auto | File | 138 B | 0644 |
|
module.info.nl | File | 24 B | 0644 |
|
module.info.nl.auto | File | 111 B | 0644 |
|
module.info.no | File | 24 B | 0644 |
|
module.info.no.auto | File | 109 B | 0644 |
|
module.info.pl | File | 0 B | 0644 |
|
module.info.pl.auto | File | 128 B | 0644 |
|
module.info.pt | File | 0 B | 0644 |
|
module.info.pt.auto | File | 129 B | 0644 |
|
module.info.pt_BR | File | 28 B | 0644 |
|
module.info.pt_BR.auto | File | 110 B | 0644 |
|
module.info.ro | File | 0 B | 0644 |
|
module.info.ro.auto | File | 130 B | 0644 |
|
module.info.ru | File | 0 B | 0644 |
|
module.info.ru.auto | File | 198 B | 0644 |
|
module.info.sk | File | 0 B | 0644 |
|
module.info.sk.auto | File | 124 B | 0644 |
|
module.info.sl | File | 0 B | 0644 |
|
module.info.sl.auto | File | 128 B | 0644 |
|
module.info.sv | File | 0 B | 0644 |
|
module.info.sv.auto | File | 129 B | 0644 |
|
module.info.th | File | 0 B | 0644 |
|
module.info.th.auto | File | 246 B | 0644 |
|
module.info.tr | File | 0 B | 0644 |
|
module.info.tr.auto | File | 139 B | 0644 |
|
module.info.uk | File | 0 B | 0644 |
|
module.info.uk.auto | File | 194 B | 0644 |
|
module.info.ur | File | 0 B | 0644 |
|
module.info.ur.auto | File | 244 B | 0644 |
|
module.info.vi | File | 0 B | 0644 |
|
module.info.vi.auto | File | 150 B | 0644 |
|
module.info.zh | File | 0 B | 0644 |
|
module.info.zh.auto | File | 110 B | 0644 |
|
module.info.zh_TW | File | 0 B | 0644 |
|
module.info.zh_TW.auto | File | 119 B | 0644 |
|
pptp-client-lib.pl | File | 8.62 KB | 0755 |
|
save.cgi | File | 5.72 KB | 0755 |
|
save_opts.cgi | File | 910 B | 0755 |
|
secrets-lib.pl | File | 1.64 KB | 0755 |
|
start.pl | File | 779 B | 0755 |
|
stop.pl | File | 355 B | 0755 |
|