#!/usr/local/bin/perl # edit_options.cgi # XXX +chap options? require './pptp-server-lib.pl'; $access{'options'} || &error($text{'options_ecannot'}); $out = `pppd --help 2>&1`; if ($out =~ /version\s+(\S+)/i) { $vers = $1; } &ui_print_header(undef, $text{'options_title'}, "", "options", 0, 0, 0, undef, undef, undef, &text('options_version', $vers)); $conf = &get_config(); $option = &find_conf("option", $conf); $option ||= $config{'ppp_options'}; @opts = &parse_ppp_options($option); if ($option eq $config{'ppp_options'}) { print &text('options_desc0', "$option"),"\n"; } else { print &text('options_desc1', "$option"),"\n"; } print "$text{'options_desc2'}

\n"; print "

\n"; print "\n"; print "\n"; print "
$text{'options_header'}
\n"; $lock = &find("lock", \@opts); print "\n"; printf "\n", $lock ? "" : "checked", $text{'no'}; $proxy = &find("proxyarp", \@opts); print "\n"; printf "\n", $proxy ? "" : "checked", $text{'no'}; $mtu = &find("mtu", \@opts); printf "\n"; $mru = &find("mru", \@opts); printf "\n"; print "\n"; $auth = &find("auth", \@opts); $noauth = &find("noauth", \@opts); print "\n"; printf "\n", $auth ? "checked" : "", $text{'options_auth2'}; &auth_input("pap"); &auth_input("chap"); $login = &find("login", \@opts); print "\n"; printf "\n", $login ? "" : "checked", $text{'no'}; $name = &find("name", \@opts); printf "\n"; print "\n"; print "\n"; &foreign_require("pptp-client", "pptp-client-lib.pl"); if (&pptp_client::mppe_support() == 1) { # Show new-style MS-CHAP options &auth_input("mschap"); &auth_input("mschap-v2"); } else { # Show old-style MS-CHAP option &auth_input("chapms"); &auth_input("chapms-v2"); } # Show general MPPE options &pptp_client::mppe_options_form(\@opts); print "
$text{'options_lock'} %s\n", $lock ? "checked" : "", $text{'yes'}; printf " %s$text{'options_proxyarp'} %s\n", $proxy ? "checked" : "", $text{'yes'}; printf " %s
$text{'options_mtu'} \n"; printf " %s\n", $mtu ? "" : "checked", $text{'default'}; printf "\n", $mtu ? "checked" : ""; print " bytes$text{'options_mru'} \n"; printf " %s\n", $mru ? "" : "checked", $text{'default'}; printf "\n", $mru ? "checked" : ""; print " bytes

$text{'options_auth'} %s\n", $noauth || $auth ? "" : "checked", $text{'options_auth0'}; printf " %s\n", $noauth ? "checked" : "", $text{'options_auth1'}; printf " %s
$text{'options_login'} %s\n", $login ? "checked" : "", $text{'yes'}; printf " %s
$text{'options_name'} \n"; printf " %s (%s)\n", $name ? "" : "checked", $text{'options_hn'}, &get_system_hostname(); printf "\n", $name ? "checked" : ""; print "

$text{'options_msdesc'}
\n"; print "
\n"; &ui_print_footer("", $text{'index_return'}); # auth_input(name) sub auth_input { local $a = $_[0]; local $req = &find("require-$a", \@opts); local $ref = &find("refuse-$a", \@opts); print " ",$text{'options_'.$a}," \n"; printf " %s\n", $req ? "checked" : "", $text{"options_req"}; printf " %s\n", $req || $ref ? "" : "checked", $text{"options_all"}; printf " %s \n", $ref ? "checked" : "", $text{"options_ref"}; }