I have no idea when it has been introduced, but I think it was properly filtered in the past. See attached screenshot.

CommentFileSizeAuthor
#1 1333978.patch1.06 KBmig5
Redirect Loop108.68 KBomega8cc
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Status: Active » Needs review
FileSize
1.06 KB

The issue here is that in our invocation of hook_validate(), we implement the hosting_domain_allowed() API hook to see if this is a valid URL or if it has already been taken.

The problem is that hosting_domain_allowed() hook optionally takes an array of parameters as an arg, and in the API hook itself we check if such a parameter was provided called 'nid' and then we append 'IS NOT $nid' to the query. In other words, the result looks something like:

SELECT COUNT(n.nid) FROM node n LEFT JOIN hosting_site h ON h.nid=n.nid LEFT JOIN hosting_site_alias a  ON n.vid = a.vid WHERE n.type='site' AND a.alias='vagrant-debian-squeeze.vagrantup.com' AND h.status <> 2 AND n.nid <> 10;

This will return a 0 count because the node in which this URL *does* appear in, is the same node as the site itself, obviously! Take off the AND n.nid <> 10 and you'll get a count of 1, because yes indeed, this URL *is* already in use *somewhere*, just happens to be this very node itself.

However! We can't just drop the nid argument off this invocation, because it prevents us ever editing the site node again (the submission of the form will fail from thereon: we probably found this bug once and that's what we did to fix it)

For this reason I think the only fix is to add an additional conditional in this check to error if the $alias is identical to the $node->title, which should never be allowed. Tested this and it's working for me..

Patch attached.

Steven Jones’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me! Can you pop fixes in both 6.x-1.x and 6.x-2.x?

Anonymous’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

  • Commit 71b3ff1 on 6.x-2.x, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-588728-views-integration, dev-1403208-new_roles, dev-helmo-3.x by mig5:
    add a conditional when validating site aliases to ensure that not only...

  • Commit 71b3ff1 on 6.x-2.x, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-588728-views-integration, dev-1403208-new_roles, dev-helmo-3.x by mig5:
    add a conditional when validating site aliases to ensure that not only...