5 require './pap-lib.pl';
6 $access{'options'} || &error($text{'options_ecannot'});
8 &error_setup($text{'options_err'});
9 $file = $in{'file'} || $config{'ppp_options'};
11 @opts = &parse_ppp_options($file);
15 &check_ipaddress($in{'local'}) || &error($text{'options_elocal'});
16 &check_ipaddress($in{'remote'}) || &error($text{'options_eremote'});
18 if (!$in{'netmask_def'}) {
19 &check_ipaddress($in{'netmask'}) || &error($text{'options_enetmask'});
21 if (!$in{'idle_def'}) {
22 $in{'idle'} =~ /^\d+$/ || &error($text{'options_eidle'});
24 @dns = split(/\s+/, $in{'dns'});
26 &check_ipaddress($d) || &error(&text('options_edns', $d));
30 # Save AutoPPP setting
31 &lock_file($config{'login_config'});
32 @login = &parse_login_config();
33 ($auto) = grep { $_->{'user'} eq "/AutoPPP/" } @login;
34 if ($auto && !$in{'auto'}) {
35 # Delete AutoPPP entry
36 &delete_login_config(\@login, $auto);
38 elsif (!$auto && $in{'auto'}) {
39 &create_login_config(\@login,
40 { 'user' => '/AutoPPP/', 'userid' => '-',
41 'utmp' => 'a_ppp', 'program' => &has_command("pppd") });
46 ($ip) = grep { $_->{'local'} } @opts;
47 &save_ppp_option(\@opts, $file, $ip, $in{'ip_def'} ? undef :
48 { 'local' => $in{'local'}, 'remote' => $in{'remote'} });
49 &save_ppp_option(\@opts, $file, "netmask", $in{'netmask_def'} ? undef :
50 { 'name' => 'netmask', 'value' => $in{'netmask'} });
51 &save_ppp_option(\@opts, $file, "proxyarp",
52 $in{'proxyarp'} ? { 'name' => 'proxyarp' } : undef);
53 &save_ppp_option(\@opts, $file, "lock",
54 $in{'lock'} ? { 'name' => 'lock' } : undef);
55 if ($in{'ctrl'} == 0) {
56 &save_ppp_option(\@opts, $file, "modem", undef);
57 &save_ppp_option(\@opts, $file, "local", { 'name' => 'local' });
59 elsif ($in{'ctrl'} == 1) {
60 &save_ppp_option(\@opts, $file, "local", undef);
61 &save_ppp_option(\@opts, $file, "modem", { 'name' => 'modem' });
64 &save_ppp_option(\@opts, $file, "modem", undef);
65 &save_ppp_option(\@opts, $file, "local", undef);
67 if ($in{'auth'} == 0) {
68 &save_ppp_option(\@opts, $file, "auth", undef);
69 &save_ppp_option(\@opts, $file, "noauth", undef);
71 elsif ($in{'auth'} == 1) {
72 &save_ppp_option(\@opts, $file, "auth", undef);
73 &save_ppp_option(\@opts, $file, "noauth", { 'name' => 'noauth' });
76 &save_ppp_option(\@opts, $file, "noauth", undef);
77 &save_ppp_option(\@opts, $file, "auth", { 'name' => 'auth' });
79 &save_ppp_option(\@opts, $file, "login",
80 $in{'login'} ? { 'name' => 'login' } : undef);
81 &save_ppp_option(\@opts, $file, "idle", $in{'idle_def'} ? undef :
82 { 'name' => 'idle', 'value' => $in{'idle'} } );
83 @olddns = &find("ms-dns", \@opts);
84 for($i=0; $i<@dns || $i<@olddns; $i++) {
85 &save_ppp_option(\@opts, $file, $olddns[$i],
86 $dns[$i] ? { 'name' => 'ms-dns', 'value' => $dns[$i] }
93 &unlock_file($config{'login_config'}) if (!$in{'file'});
94 &webmin_log("options", undef, $in{'tty'}, \%in);
95 &redirect($in{'file'} ? "list_mgetty.cgi" : "");