Bug in dhcp server reading Custom configuration lines with double quotes

View: New views
2 Messages — Rating Filter:   Alert me  

Bug in dhcp server reading Custom configuration lines with double quotes

by Alberto Iglesias :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everybody

I've found a bug with custom configuration lines in dhcpserver, if the
option has double quotes. I was trying to add this option:

option tftp-server-name "192.168.1.23";

... but when a click save all, dhcp server start fails. Entering in
configuration files, I've found the problem. When efw save "Custom
configuration lines" textarea data, in configuration file
(/var/efw/dhcp/custom.tpl) is saves:

option tftp-server-name "192.168.1.23";

... instead of...

option tftp-server-name "192.168.1.23";

... so dhcpserver don't understand the line and can't start.

I've been analyzing /home/httpd/cgi-bin/dhcp.cgi and I've been unable to
find where the hell it makes the conversion from " to " (maybe in
the POST data). Anyway, I have to admit that have no idea of perl, so
maybe is just a stupid thing, but I can't find it.

What I've done to solve it is to make a string substitution before data
is written to the file, changing this (in /home/httpd/cgi-bin/dhcp.cgi)...

    $dhcpsettings{'CUSTOM_GLOBAL'} =~ s/\r//;                  # LINE 472
    write_file($custom_global_file, $dhcpsettings{'CUSTOM_GLOBAL'});
    $custom_global=$dhcpsettings{'CUSTOM_GLOBAL'};
    $dhcpsettings{'CUSTOM_GLOBAL'} = unset;
    &writehash("${swroot}/dhcp/settings", \%dhcpsettings);
    &buildconf;

...for this...

    $dhcpsettings{'CUSTOM_GLOBAL'} =~ s/\r//;                  # LINE 472
    $dhcpsettings{'CUSTOM_GLOBAL'} =~
s/\"\;/\"/g;                          # This is the line that
substitute " for ", so configuration file gets the right data.
    write_file($custom_global_file, $dhcpsettings{'CUSTOM_GLOBAL'});
    $custom_global=$dhcpsettings{'CUSTOM_GLOBAL'};
    $dhcpsettings{'CUSTOM_GLOBAL'} = unset;
    &writehash("${swroot}/dhcp/settings", \%dhcpsettings);
    &buildconf;

It works, but I'm not sure if this is the best solution. I think it
should be better if there's a way to avoid that original data of "Custom
configuration lines" textarea was changed for html entities. In 2.2.
version this didn't happen, and I've been compairing dhcp.cgi files of
both version, but I can't find the issue.

Well, here you have a solution and It would be good if anybody can't
find the better way to correct this.


--

Alberto Iglesias
Gerente
aiglesias@...

-----------------------------------------------------------
ARCANOS INTERCOM S.L.
Centro de Empresas Camargo (local 211)
Polígono Industrial de Trascueto s/n
39600 Revilla de Camargo (Cantabria)

Tel:          +34 942 072 801 <http://www.snapanumber.com/>
Tel IP:      700 754 960
Fax:          +34 942 072 802 <http://www.snapanumber.com/>
@mail:    arcanos@...
Web:        http://www.arcanos.es

------------------------------------------------------------------------------------------------------------
Este e-mail y cualquiera de sus ficheros anexos son confidenciales y pueden
incluir información privilegiada. Si usted no es el destinatario adecuado
(o responsable de remitirlo a la persona indicada), agradeceríamos lo
notificase o reenviase inmediatamente al emisor. No revele estos contenidos a
ninguna otra persona, no los utilice para otra finalidad, ni almacene y, o,
copie esta información en medio alguno. Opiniones, conclusiones y otro tipo
de información relacionada con este mensaje que no sean relativas a la
actividad propia de ARCANOS INTERCOM S.L., deberán ser entendidas como
exclusivas del emisor.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Efw-user mailing list
Efw-user@...
https://lists.sourceforge.net/lists/listinfo/efw-user

Re: Bug in dhcp server reading Custom configuration lines with double quotes

by Alberto Iglesias :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Forget it. This bug is already detected and solved:

http://bugs.endian.com/view.php?id=2190

Sorry


Alberto Iglesias escribió:

> Hi everybody
>
> I've found a bug with custom configuration lines in dhcpserver, if the
> option has double quotes. I was trying to add this option:
>
> option tftp-server-name "192.168.1.23";
>
> ... but when a click save all, dhcp server start fails. Entering in
> configuration files, I've found the problem. When efw save "Custom
> configuration lines" textarea data, in configuration file
> (/var/efw/dhcp/custom.tpl) is saves:
>
> option tftp-server-name "192.168.1.23";
>
> ... instead of...
>
> option tftp-server-name "192.168.1.23";
>
> ... so dhcpserver don't understand the line and can't start.
>
> I've been analyzing /home/httpd/cgi-bin/dhcp.cgi and I've been unable to
> find where the hell it makes the conversion from " to " (maybe in
> the POST data). Anyway, I have to admit that have no idea of perl, so
> maybe is just a stupid thing, but I can't find it.
>
> What I've done to solve it is to make a string substitution before data
> is written to the file, changing this (in /home/httpd/cgi-bin/dhcp.cgi)...
>
>     $dhcpsettings{'CUSTOM_GLOBAL'} =~ s/\r//;                  # LINE 472
>     write_file($custom_global_file, $dhcpsettings{'CUSTOM_GLOBAL'});
>     $custom_global=$dhcpsettings{'CUSTOM_GLOBAL'};
>     $dhcpsettings{'CUSTOM_GLOBAL'} = unset;
>     &writehash("${swroot}/dhcp/settings", \%dhcpsettings);
>     &buildconf;
>
> ...for this...
>
>     $dhcpsettings{'CUSTOM_GLOBAL'} =~ s/\r//;                  # LINE 472
>     $dhcpsettings{'CUSTOM_GLOBAL'} =~
> s/\"\;/\"/g;                          # This is the line that
> substitute " for ", so configuration file gets the right data.
>     write_file($custom_global_file, $dhcpsettings{'CUSTOM_GLOBAL'});
>     $custom_global=$dhcpsettings{'CUSTOM_GLOBAL'};
>     $dhcpsettings{'CUSTOM_GLOBAL'} = unset;
>     &writehash("${swroot}/dhcp/settings", \%dhcpsettings);
>     &buildconf;
>
> It works, but I'm not sure if this is the best solution. I think it
> should be better if there's a way to avoid that original data of "Custom
> configuration lines" textarea was changed for html entities. In 2.2.
> version this didn't happen, and I've been compairing dhcp.cgi files of
> both version, but I can't find the issue.
>
> Well, here you have a solution and It would be good if anybody can't
> find the better way to correct this.
>
>
>  

--

Alberto Iglesias
Gerente
aiglesias@...

-----------------------------------------------------------
ARCANOS INTERCOM S.L.
Centro de Empresas Camargo (local 211)
Polígono Industrial de Trascueto s/n
39600 Revilla de Camargo (Cantabria)

Tel:          +34 942 072 801
Tel IP:      700 754 960
Fax:          +34 942 072 802
@mail:    arcanos@...
Web:        http://www.arcanos.es

------------------------------------------------------------------------------------------------------------
Este e-mail y cualquiera de sus ficheros anexos son confidenciales y pueden
incluir información privilegiada. Si usted no es el destinatario adecuado
(o responsable de remitirlo a la persona indicada), agradeceríamos lo
notificase o reenviase inmediatamente al emisor. No revele estos contenidos a
ninguna otra persona, no los utilice para otra finalidad, ni almacene y, o,
copie esta información en medio alguno. Opiniones, conclusiones y otro tipo
de información relacionada con este mensaje que no sean relativas a la
actividad propia de ARCANOS INTERCOM S.L., deberán ser entendidas como
exclusivas del emisor.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Efw-user mailing list
Efw-user@...
https://lists.sourceforge.net/lists/listinfo/efw-user