|
From: Gilles E. <gil...@wa...> - 2003-06-22 07:44:21
|
----- Original Message -----
From: "Eric Oberlander" <er...@ob...>
To: "Marco van Beek" <mva...@su...>
Cc: <ipc...@li...>
Sent: Saturday, June 21, 2003 10:52 PM
Subject: Re: [IPCop-devel] PPP settings problem
> on 18/6/03 1:01 pm, Marco van Beek at mva...@su...
wrote:
>
> > Hi All,
> >
> > I haven't seen this reported on the list, but I think there is a bug in
1.3
> > when saving the ppp profiles. It seems to save the settings file as
> > "setting-" without the number, and the profile list dropdown always
shows
> > empty profiles.
> >
> > As long as you only have one profile, it is fine, but if you set up a
second
> > profile, it overwrites the first.
> >
> > I think this may be to do with needing to select a profile before
saving, as
> > the file saving routine uses a variable, which probably isn't set if you
> > start on a blank page. I think the line I mean is indicated below. If
there
> > isn't a $pppsettings{'PROFILE'} variable set, it would be blank, causing
> > what I see when it saves the profile. The workaround isn't difficult,
but
> > may be we need some additional error checking here asking people to
select a
> > blank profile first, maybe?
> >
> > ===========================
> > if ($errormessage) {
> > $pppsettings{'VALID'} = 'no'; }
> > else {
> > $pppsettings{'VALID'} = 'yes'; }
> >
> > # write cgi vars to the file.
> >>>> &writehash("${swroot}/ppp/settings-$pppsettings{'PROFILE'}",
> > \%pppsettings);
> >
> > # make link and write secret file.
> > &updatesettings();
> > &writesecrets();
> >
> > &log("$tr{'profile saved'} $pppsettings{'PROFILENAME'}");
> > =============================
> >
> > Regards
> >
> > Marco van Beek
> > Supporting Role Ltd.
>
> Hi
>
> I can confirm this behaviour. Can I suggest adding this into the error
> checking when the action is 'save'?
>
> if ( $pppsettings{'PROFILE'} eq '') {
> $errormessage = $tr{'select a profile'};
> goto ERROR; }
>
> and adding the translated phrase to en.pl (* required). You may want to
pick
> a better error message, such as "Select a profile before saving" or
"Select
> a profile first".
>
> Anybody else like to test and confirm this?
>
> Eric
>
> (* It won't appear as an error with a blank errormessage string).
>
>
I had seen the problem once but was not able to reproduce again and I didn't
know if the 'setting-' file come from V1.2 backup or V1.3.
The quickest way to see the problem is to erase one profile.
So none is selected even the first profile is displayed and if you save
before to select a profile, the bug is visible in var/ipcop/ppp
It's to late to check in the save part that no profile is selected because
you will loose everything you have typed in.
I think it would be better to avoid that no profil is selected. So I suggest
to change the erase part to keep the current profil selected and not
displaying the first profil name not really selected using a code similar to
the select part.
I have tested partialy my changes and it's look to work when deleting a
profile.
&log("$tr{'profile deleted'} $pppsettings{'PROFILENAME'}");
my $profile = $pppsettings{'PROFILE'};
truncate ("${swroot}/ppp/settings-$pppsettings{'PROFILE'}", 0);
%pppsettings = ();
$pppsettings{'VALID'} = '';
&readhash("${swroot}/ppp/settings", \%pppsettings);
%temppppsettings = ();
$temppppsettings{'PROFILE'} = '';
&readhash("${swroot}/ppp/settings-$pppsettings{'PROFILE'}",
\%temppppsettings);
# make link.
&updatesettings();
%pppsettings = ();
&readhash("${swroot}/ppp/settings", \%pppsettings);
$pppsettings{'PROFILE'} = $profile;
&writehash("${swroot}/ppp/settings-$pppsettings{'PROFILE'}",
\%pppsettings);
Some part of this code may be not necessary. I need to test and understand
But the first time you install without backup, I think that also no profil
is selected and 'something' is to do
I can suggest also to move the profil name box near the save button to avoid
to type a profil name wich will be erased if using the refresh button to
select an interface.
|