/** * Validates a NS record * * @param Records $record * * @return bool */ public function _validateNs(Records $record) { $name = $record->getName(); $target = $record->getContent(); if (0 != strlen($record->getName())) { if (!$this->_checkHostname($name . '.' . $record->getDomain()->getName(), true, $record->getLooseCheck())) { $this->context->addViolationAt('name', 'Value: ' . $name . ' is not a valid hostname or ip address', array(), null); } } if (!$this->_checkHostname($target, true)) { $this->context->addViolationAt('content', 'Value: ' . $target . ' is not a valid hostname or ip address', array(), null); } $options = array('options' => array('min_range' => 1, 'max_range' => 99999)); // We don't force a priority for NS // But if there, we check if it is valid if (0 != strlen($record->getPrio()) && !filter_var($record->getPrio(), FILTER_VALIDATE_INT, $options)) { $this->context->addViolationAt('prio', 'Value: ' . $record->getPrio() . ' is not a valid priority', array(), null); } return true; }