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

Contents 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


Revision 1.3 - (show annotations) (download)
Thu Jan 22 07:40:49 2015 UTC (9 years, 10 months ago) by stephdl
Branch: MAIN
CVS Tags: e-smith-hosts-2_2_0-10_el5_sme
Changes since 1.2: +10 -13 lines
* Wed Jan 21 2014 stephane de Labrusse <stephdl@de-labrusse.fr> 2.2.0-10.sme
- Add a migrate fragment to sanitize the host comment [SME: 8806]
- Code done by  Charlie Brady <charlieb-contribs-bugzilla@budge.apana.org.au>

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

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