SYSTEM WARNING: 'date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.' in '/usr/share/mantis/www/core.php' line 264

0002380: DHCP server don't start if you have a paratemer in "Custom Configuration Lines" that has double quotes (") - MantisBT
MantisBT - Endian Firewall
View Issue Details
0002380Endian FirewallOther Scriptspublic2009-11-05 10:362010-11-22 12:04
arcanos 
simon-endian 
normalminoralways
closedfixed 
2.3 
2.3.1 
0002380: DHCP server don't start if you have a paratemer in "Custom Configuration Lines" that has double quotes (")
If "Custom configuration lines" in dhcpserver has a parameter with double quotes, dhcp server start fails. 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 &quot192.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).

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/\&quot\;/\"/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.
No tags attached.
duplicate of 0002314closed simon-endian DHCP fails start with CUSTOM DHCP-Option Field used 
duplicate of 0002190closed simon-endian Using quotes in "Custom configuration lines" boxes are translated to """ in config file. 
Issue History
2009-11-05 10:36arcanosNew Issue
2009-11-05 11:16arcanosNote Added: 0003245
2009-11-05 11:19arcanosNote Added: 0003246
2009-11-05 11:20arcanosNote Added: 0003247
2009-11-05 11:22simon-endianRelationship addedduplicate of 0002314
2009-11-05 11:22simon-endianRelationship addedduplicate of 0002190
2009-11-05 11:24simon-endianNote Added: 0003249
2009-11-05 11:25simon-endianStatusnew => resolved
2009-11-05 11:25simon-endianFixed in Version => 2.3.1
2009-11-05 11:25simon-endianResolutionopen => fixed
2009-11-05 11:25simon-endianAssigned To => simon-endian
2010-11-22 12:04peter-endianStatusresolved => closed

Notes
(0003245)
arcanos   
2009-11-05 11:16   
Correction, it saves...

option tftp-server-name "192.168.1.23"

... instead of...

option tftp-server-name "192.168.1.23"
(0003246)
arcanos   
2009-11-05 11:19   
Sorry, but bug tracker is interpreting html entities. It saves (i hope now is ok):

option tftp-server-name \"192.168.1.23\"
(0003247)
arcanos   
2009-11-05 11:20   
Fuck!!

option tftp-server-name "192.168.1.23&uot;
(0003249)
simon-endian   
2009-11-05 11:24   
please try patch located in 0002190, which fixes this problem