I noticed this when someone entered full URL with http:// in the aliases, breaking web server configuration (or at least breaking web server reload due to broken configuration). Yet, it is possible to enter *valid* arbitrary configuration using domain aliases text area. Patch linked. It silently drops any invalid aliases. It is a quick fix, but maybe some error should be also displayed.

The fix: http://drupalcode.org/sandbox/omega8cc/1074912.git/commit/e85a76a

Comments

joestewart’s picture

The patch seemed to work great except when an alias entered was a single word. _hosting_valid_fqdn() shouldn't allow this should it?

omega8cc’s picture

The _hosting_valid_fqdn() regex allows this probably to still accepts simple localname install, so you don't need to use the dot in the name, yet, then it is no longer FQDN check, I agree.

Also, current regex allows you to use IP address as a site name and you can enter the dot at the end (which is wrong).

In my setup I don't allow IP addresses and the domain should start with a letter (probably too restrictive these days, but it is per RFC1035):

function _hosting_valid_fqdn($fqdn) {
  # regex is an implementation of RFC1035
  # original: return preg_match("/^([a-z0-9]([a-z0-9-]*[a-z0-9])?\.?)+$/i", $fqdn);
  #
  # We don't allow using IPs as a site name.
  # The domain name should start with a letter
  # and end with a-z0-9 only - dot is not allowed.
  #
  return preg_match("/^([a-z]+([a-z0-9-]*[a-z0-9])?\.?)+[a-z0-9]+$/i", $fqdn);
}
anarcat’s picture

I originally wrote the regex as you did, but it was changed because registrars actually allow domains to start with numbers. Also, a domain name actually ends with a dot, it's just optional.

anarcat’s picture

Status: Needs review » Fixed

Fix committed.

anarcat’s picture

I also contacted the security team about this. I don't think this issue should have been reported in the trackers, according to http://drupal.org/node/101494

anarcat’s picture

In fact, reporting it in the trackers was okay because we're not stable yet, according to the security team.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.