#!/usr/local/bin/perl # edit_options.cgi # Display list of options for PPP, and show if mgetty has autoPPP mode enabled require './pap-lib.pl'; $access{'options'} || &error($text{'options_ecannot'}); &ReadParse(); &ui_print_header(undef, $text{'options_title'}, ""); $of = $config{'ppp_options'}; if ($in{'file'} =~ /^\Q$of\E\.ttyS(\d+)$/) { $tty = "ttyS$1"; print "
",&text('options_serial', $1+1), "
\n"; } elsif ($in{'file'} =~ /^\Q$of\E\.(\S+)$/) { $tty = $1; $tty =~ s/\./\//g; print "
",&text('options_dev', "$tty"), "
\n"; } # Check if the PPP daemon is actually installed if (!&has_command($config{'pppd'})) { print "

",&text('options_ecmd', "$config{'pppd'}"),"

\n"; &ui_print_footer("", $text{'index_return'}); exit; } # Check if the pppd is the linux one $out = `$config{'pppd'} -v 2>&1`; if ($out !~ /version\s+([0-9\.]+)/) { print "

",&text('options_epppd', "$config{'pppd'}"),"

\n"; &ui_print_footer("", $text{'index_return'}); exit; } @opts = &parse_ppp_options($in{'file'} || $of); if (!$in{'file'}) { # Check for the mgetty login config file if (!-r $config{'login_config'}) { print "

",&text('options_elogin', "$config{'login_config'}", "$gconfig{'webprefix'}/config.cgi?$module_name"),"

\n"; &ui_print_footer("", $text{'index_return'}); exit; } @login = &parse_login_config(); } print "

$text{'options_desc'}

\n" if (!$in{'file'}); print "

\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'options_header'}
\n"; if (!$in{'file'}) { # Show if autoPPP is being used or not ($auto) = grep { $_->{'user'} eq "/AutoPPP/" } @login; print "\n"; printf "\n", $auto ? "" : "checked", $text{'no'}; print "\n"; } ($ip) = grep { $_->{'local'} } @opts; print "\n"; printf "\n", $text{'options_remote'}, $ip->{'remote'}; $nm = &find("netmask", \@opts); print "\n"; printf "\n", $nm->{'value'}; $proxy = &find("proxyarp", \@opts); print "\n"; printf "\n", $proxy ? "" : "checked", $text{'no'}; $lock = &find("lock", \@opts); print "\n"; printf "\n", $lock ? "" : "checked", $text{'no'}; $modem = &find("modem", \@opts); $local = &find("local", \@opts); print "\n"; print "\n"; $auth = &find("auth", \@opts); $noauth = &find("noauth", \@opts); print "\n"; printf "\n", $auth ? "checked" : "", $text{'options_auth2'}; $login = &find("login", \@opts); print "\n"; printf "\n", $login ? "" : "checked", $text{'no'}; $idle = &find("idle", \@opts); print "\n"; printf "\n", $idle->{'value'}, $text{'mgetty_secs'}; @dns = &find("ms-dns", \@opts); print "\n"; printf "\n", join(" ", map { $_->{'value'} } @dns); print "
$text{'options_autoppp'} %s\n", $auto ? "checked" : "", $text{'yes'}; printf " %s

$text{'options_ip'} %s\n", $ip ? "" : "checked", $text{'options_auto'}; printf "\n", $ip ? "checked" : ""; printf "%s \n", $text{'options_local'}, $ip->{'local'}; printf "%s
$text{'options_netmask'} %s\n", $nm ? "" : "checked", $text{'default'}; printf "\n", $nm ? "checked" : ""; printf "$text{'options_proxyarp'} %s\n", $proxy ? "checked" : "", $text{'yes'}; printf " %s
$text{'options_lock'} %s\n", $lock ? "checked" : "", $text{'yes'}; printf " %s$text{'options_ctrl'}
$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_idle'} %s\n", $idle ? "" : "checked", $text{'options_idle_def'}; printf "\n", $idle ? "checked" : ""; printf " %s
$text{'options_dns'}
\n"; print "
\n"; if ($in{'file'}) { &ui_print_footer("list_mgetty.cgi", $text{'mgetty_return'}); } else { &ui_print_footer("", $text{'index_return'}); }