--- rpms/e-smith-hosts/sme9/e-smith-hosts-2.4.0.comment_hostname_validator.patch 2015/01/22 07:35:32 1.3 +++ rpms/e-smith-hosts/sme9/e-smith-hosts-2.4.0.comment_hostname_validator.patch 2015/02/06 21:37:09 1.6 @@ -8,22 +8,13 @@ diff -Nur e-smith-hosts-2.4.0.old8723/ro + { + my $comment = $host->prop('Comment'); + next unless $comment; -+ $comment =~ s/['"]//g; ++ $comment =~ s/[^a-zA-Z0-9\ \_\-\,\.]+//g; + $host->merge_props(Comment => $comment); + } +} diff -Nur e-smith-hosts-2.4.0.old8723/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/hostentries e-smith-hosts-2.4.0.bz8723/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/hostentries --- e-smith-hosts-2.4.0.old8723/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/hostentries 2015-01-18 11:25:40.356221775 +0100 +++ e-smith-hosts-2.4.0.bz8723/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/hostentries 2015-01-18 12:57:12.694843190 +0100 -@@ -128,7 +128,7 @@ - - HOSTNAME_DESCRIPTION - -- The hostname must contain only letters, numbers, and hyphens, -+ The hostname and the comment must contain only letters, numbers, and hyphens, - and must start with a letter or number. - - @@ -271,4 +271,18 @@ MUST_BE_VALID_HOSTNAME_OR_IP Must be a valid hostname or IP number @@ -32,7 +23,7 @@ diff -Nur e-smith-hosts-2.4.0.old8723/ro + HOSTNAME_COMMENT_ERROR + + Error: unexpected characters in the comment of "{$hostname}.{$domain}". -+ The comment must contain only letters, numbers and hyphens, and must start with a letter or number. ++ The comment must contain only letters, spaces, numbers, dots, commas, undescores, hyphens and must start with a letter or number. + + + @@ -50,7 +41,7 @@ diff -Nur e-smith-hosts-2.4.0.old8723/ro my $hostname = lc $q->param('name'); my $domain = lc $q->param('domain'); my $fqdn = "$hostname.$domain"; -+ my $comment = lc $q->param('comment'); ++ my $comment = $q->param('comment'); $self->cgi->param(-name=>'name', -value=>$hostname); unless ( $hostname =~ /^[a-z0-9][a-z0-9-]*$/ ) @@ -59,7 +50,7 @@ diff -Nur e-smith-hosts-2.4.0.old8723/ro + return $self->error('HOSTNAME_VALIDATOR_ERROR'); + } + -+ unless ( $comment =~ /^[a-z0-9][a-z0-9-]*$/ ) ++ unless ( $comment =~ /^([a-zA-Z0-9][\_\.\-,A-Za-z0-9\s]*)$/ ) + { + return $self->error('HOSTNAME_COMMENT_ERROR'); }