/[smeserver]/rpms/e-smith-hosts/sme8/e-smith-hosts-2.2.0.comment_hostname_validator.patch
ViewVC logotype

Diff of /rpms/e-smith-hosts/sme8/e-smith-hosts-2.2.0.comment_hostname_validator.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

Revision 1.4 by stephdl, Mon Jan 26 18:17:46 2015 UTC Revision 1.6 by stephdl, Fri Feb 6 21:43:11 2015 UTC
# Line 8  diff -Nur e-smith-hosts-2.4.0.old8723/ro Line 8  diff -Nur e-smith-hosts-2.4.0.old8723/ro
8  +      {  +      {
9  +          my $comment = $host->prop('Comment');  +          my $comment = $host->prop('Comment');
10  +          next unless $comment;  +          next unless $comment;
11  +          $comment =~ s/['"]//g;  +          $comment =~ s/[^a-zA-Z0-9\ \_\-\,\.]+//g;
12  +          $host->merge_props(Comment => $comment);  +          $host->merge_props(Comment => $comment);
13  +      }  +      }
14  +}  +}
# Line 23  diff -Nur e-smith-hosts-2.4.0.old8723/ro Line 23  diff -Nur e-smith-hosts-2.4.0.old8723/ro
23  +   <base>HOSTNAME_COMMENT_ERROR</base>  +   <base>HOSTNAME_COMMENT_ERROR</base>
24  +    <trans>  +    <trans>
25  +    Error: unexpected characters in the comment of "{$hostname}.{$domain}".  +    Error: unexpected characters in the comment of "{$hostname}.{$domain}".
26  +    The comment must contain only letters, numbers, undescores, dots 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.
27  +    </trans>  +    </trans>
28  +  </entry>  +  </entry>
29  +    <entry>  +    <entry>
# Line 41  diff -Nur e-smith-hosts-2.4.0.old8723/ro Line 41  diff -Nur e-smith-hosts-2.4.0.old8723/ro
41       my $hostname = lc $q->param('name');       my $hostname = lc $q->param('name');
42       my $domain = lc $q->param('domain');       my $domain = lc $q->param('domain');
43       my $fqdn = "$hostname.$domain";       my $fqdn = "$hostname.$domain";
44  +    my $comment = lc $q->param('comment');  +    my $comment = $q->param('comment');
45       $self->cgi->param(-name=>'name', -value=>$hostname);       $self->cgi->param(-name=>'name', -value=>$hostname);
46    
47       unless ( $hostname =~ /^[a-z0-9][a-z0-9-]*$/ )       unless ( $hostname =~ /^[a-z0-9][a-z0-9-]*$/ )
# Line 50  diff -Nur e-smith-hosts-2.4.0.old8723/ro Line 50  diff -Nur e-smith-hosts-2.4.0.old8723/ro
50  +        return $self->error('HOSTNAME_VALIDATOR_ERROR');  +        return $self->error('HOSTNAME_VALIDATOR_ERROR');
51  +    }  +    }
52  +  +
53  +    unless ( $comment =~ /^([a-z0-9][\_\.\-a-z0-9\s]*)$/ )  +    unless ( $comment =~ /^([a-zA-Z0-9][\_\.\-,A-Za-z0-9\s]*)$/ )
54  +    {  +    {
55  +        return $self->error('HOSTNAME_COMMENT_ERROR');  +        return $self->error('HOSTNAME_COMMENT_ERROR');
56       }       }


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed