3 # Save the ADSL client configuration
5 require './adsl-client-lib.pl';
6 &error_setup($text{'save_err'});
7 &lock_file($config{'pppoe_conf'});
11 # Validate and store inputs
12 $eth = $in{'eth'} || $in{'other'};
13 $eth =~ /^\S+$/ || &error($text{'save_eeth'});
14 &save_directive($conf, "ETH", $eth);
16 if ($in{'demand'} eq 'yes') {
17 $in{'timeout'} =~ /^\d+$/ || &error($text{'save_etimeout'});
18 &save_directive($conf, "DEMAND", $in{'timeout'});
21 &save_directive($conf, "DEMAND", 'no');
24 $olduser = &find("USER", $conf);
25 $in{'user'} =~ /^\S+$/ || &error($text{'save_euser'});
26 &save_directive($conf, "USER", $in{'user'});
28 $dnsdir = &find("USEPEERDNS", $conf) ? "USEPEERDNS" : "PEERDNS";
29 &save_directive($conf, $dnsdir, $in{'dns'});
31 if ($in{'connect_def'}) {
32 &save_directive($conf, "CONNECT_TIMEOUT", 0);
35 $in{'connect'} =~ /^\d+$/ || &error($text{'save_econnect'});
36 &save_directive($conf, "CONNECT_TIMEOUT", $in{'connect'});
39 if ($in{'mss'} eq 'yes') {
40 $in{'psize'} =~ /^\d+$/ || &error($text{'save_emss'});
41 &save_directive($conf, "CLAMPMSS", $in{'psize'});
44 &save_directive($conf, "CLAMPMSS", 'no');
48 &save_directive($conf, "FIREWALL", $in{'fw'});
51 # Actually save the directives, and update the pap-secrets file
53 &unlock_file($config{'pppoe_conf'});
54 &lock_file($config{'pap_file'});
55 @secs = &list_secrets();
56 ($sec) = grep { $_->{'client'} eq $olduser } @secs;
58 ($sec) = grep { $_->{'client'} eq $in{'user'} } @secs;
61 $sec->{'secret'} = $in{'sec'};
62 $sec->{'client'} = $in{'user'};
66 $sec = { 'secret' => $in{'sec'},
67 'client' => $in{'user'},
71 &unlock_file($config{'pap_file'});
75 &ui_print_header(undef, $text{'save_title'}, "");
77 print "<p>$text{'save_desc'}<p>\n";
79 &ui_print_footer("", $text{'index_return'});