/[smeserver]/rpms/e-smith-hosts/sme9/e-smith-hosts-2.4.0.comment_hostname_validator.patch
ViewVC logotype

Contents of /rpms/e-smith-hosts/sme9/e-smith-hosts-2.4.0.comment_hostname_validator.patch

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


Revision 1.2 - (show annotations) (download)
Wed Jan 21 21:53:44 2015 UTC (9 years, 10 months ago) by stephdl
Branch: MAIN
Changes since 1.1: +17 -0 lines
* Wed Jan 21 2014 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-5.sme
- Add a migrate fragment to sanitize the host comment [SME: 8723]

1 diff -Nur e-smith-hosts-2.4.0.old8723/root/etc/e-smith/db/hosts/migrate/30sanitise_host_comment e-smith-hosts-2.4.0.bz8723/root/etc/e-smith/db/hosts/migrate/30sanitise_host_comment
2 --- e-smith-hosts-2.4.0.old8723/root/etc/e-smith/db/hosts/migrate/30sanitise_host_comment 1970-01-01 01:00:00.000000000 +0100
3 +++ e-smith-hosts-2.4.0.bz8723/root/etc/e-smith/db/hosts/migrate/30sanitise_host_comment 2015-01-21 22:49:42.441035251 +0100
4 @@ -0,0 +1,13 @@
5 +{
6 + #Added for bug 8723 & bug 8806
7 + my @hosts = $DB->keys;
8 + foreach my $host (@hosts)
9 + {
10 + my $comment = $DB->get_prop("$host",'Comment')||'';
11 + if ($comment ne '')
12 + {
13 + $comment =~ s/['"]//g;
14 + $DB->set_prop("$host",'Comment',"$comment");
15 + }
16 + }
17 +}
18 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
19 --- 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
20 +++ 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
21 @@ -128,7 +128,7 @@
22 <entry>
23 <base>HOSTNAME_DESCRIPTION</base>
24 <trans>
25 - The hostname must contain only letters, numbers, and hyphens,
26 + The hostname and the comment must contain only letters, numbers, and hyphens,
27 and must start with a letter or number.
28 </trans>
29 </entry>
30 @@ -271,4 +271,18 @@
31 <base>MUST_BE_VALID_HOSTNAME_OR_IP</base>
32 <trans>Must be a valid hostname or IP number</trans>
33 </entry>
34 + <entry>
35 + <base>HOSTNAME_COMMENT_ERROR</base>
36 + <trans>
37 + Error: unexpected characters in the comment of "{$hostname}.{$domain}".
38 + The comment must contain only letters, numbers and hyphens, and must start with a letter or number.
39 + </trans>
40 + </entry>
41 + <entry>
42 + <base>HOSTNAME_VALIDATOR_ERROR</base>
43 + <trans>
44 + Error: unexpected characters in host name: "{$hostname}.{$domain}". The host name should contain only
45 + letters, numbers, and hyphens and must start with a letter or a number.
46 + </trans>
47 + </entry>
48 </lexicon>
49 diff -Nur e-smith-hosts-2.4.0.old8723/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/hostentries.pm e-smith-hosts-2.4.0.bz8723/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/hostentries.pm
50 --- e-smith-hosts-2.4.0.old8723/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/hostentries.pm 2015-01-18 11:25:40.356221775 +0100
51 +++ e-smith-hosts-2.4.0.bz8723/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/hostentries.pm 2015-01-18 12:56:12.236214717 +0100
52 @@ -420,11 +420,17 @@
53 my $hostname = lc $q->param('name');
54 my $domain = lc $q->param('domain');
55 my $fqdn = "$hostname.$domain";
56 + my $comment = lc $q->param('comment');
57 $self->cgi->param(-name=>'name', -value=>$hostname);
58
59 unless ( $hostname =~ /^[a-z0-9][a-z0-9-]*$/ )
60 {
61 - return $self->error('HOSTNAME_DESCRIPTION');
62 + return $self->error('HOSTNAME_VALIDATOR_ERROR');
63 + }
64 +
65 + unless ( $comment =~ /^[a-z0-9][a-z0-9-]*$/ )
66 + {
67 + return $self->error('HOSTNAME_COMMENT_ERROR');
68 }
69 # Look for duplicate hosts.
70 my $hostrec = undef;

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