ClearOS Bug Tracker


View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000066ClearOSapp-settings - System Settingspublic2010-03-27 13:012010-06-01 21:02
Reporterbchambers 
Assigned Touser2 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version5.1 
Target Version5.2Fixed in Version5.2 
Summary0000066: Allow 'localhost' as a valid hostname for SMTP hostname field
DescriptionMail notification uses the Network class's "IsValidHostname" function to validate input of the form variables. This function checks for the presence of a 'period', and throws a validation error if the hostname does not contain at least one:

/var/webconfig/api/Hostname.class.php

if (substr_count($hostname, ".") == 0) {
  $errmsg = NETWORK_LANG_ERRMSG_HOSTNAME_MUST_HAVE_A_PERIOD;
  $this->AddValidationError($errmsg, __METHOD__, __LINE__);
  return false;
}

The entry 'localhost' is valid...but in the Network class, this may want to be more strict.

For the Mail Notification, a check for 'localhost' before the network class validation routine could be a solution:

if ($host == 'localhost')
  return true;
$network = new Network();

if (! $network->IsValidHostname($host))
  throw new ValidationException(implode($network->GetValidationErrors(true)));
return true;

Additional InformationThere are lots of 'workarounds' to get around this bug until it is fixed.

Use the local IP (192.168.1.1, for example)
Use the local hostname (clear.lan, for example)
Use the external hostname (myclearbox.poweredbyclear.com, for example)
Create an entry in the hosts file.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0000063)
timb80 (developer)
2010-03-27 13:40

Another alternative?

/var/webconfig/api/Network.class.php line 300

Function "IsValidHostname($hostname)"

Change
Code:
                if (substr_count($hostname, ".") == 0 ) {

TO

                if (substr_count($hostname, ".") == 0 && $hostname!='localhost') {

- Issue History
Date Modified Username Field Change
2010-03-27 13:01 bchambers New Issue
2010-03-27 13:40 timb80 Note Added: 0000063
2010-03-28 20:05 user2 Status new => assigned
2010-03-28 20:05 user2 Assigned To => user2
2010-03-28 20:07 user2 Target Version => 5.2
2010-03-30 18:03 user2 Checkin
2010-03-30 18:03 user2 Note Added: 0000072
2010-03-30 18:03 user2 Status assigned => resolved
2010-03-30 18:03 user2 Resolution open => fixed
2010-05-19 11:30 user2 Fixed in Version => 5.2
2010-06-01 21:02 user2 Status resolved => closed
2010-08-18 15:05 user2 Note Deleted: 0000072