# HG changeset patch # User rejo # Date 1215868550 0 # Node ID a3e83a34f26705dd6dd198fcd0973a39b38e0fc6 # Parent 6baa2f78d3fe2380737c23fe85f539768975928b [feladat @ 294] Update of SRV record validation. Now checks for a maximum number of characters of content field and allows dash in first label of content field. Closes #45. diff -r 6baa2f78d3fe -r a3e83a34f267 inc/dns.inc.php --- a/inc/dns.inc.php Fri Jul 11 08:59:07 2008 +0000 +++ b/inc/dns.inc.php Sat Jul 12 13:15:50 2008 +0000 @@ -352,9 +352,15 @@ } function is_valid_rr_srv_name($name){ + + if (strlen($name) > 255) { + error(ERR_DNS_HN_TOO_LONG); + return false; + } + $fields = explode('.', $name, 3); - if (!preg_match('/^_[a-z0-9]+$/i', $fields[0])) { error(ERR_DNS_SRV_NAME) ; return false; } - if (!preg_match('/^_[a-z0-9]+$/i', $fields[1])) { error(ERR_DNS_SRV_NAME) ; return false; } + if (!preg_match('/^_[\w-]+$/i', $fields[0])) { error(ERR_DNS_SRV_NAME) ; return false; } + if (!preg_match('/^_[\w]+$/i', $fields[1])) { error(ERR_DNS_SRV_NAME) ; return false; } if (!is_valid_hostname_fqdn($fields[2],0)) { error(ERR_DNS_SRV_NAME) ; return false ; } return true ; }