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 |
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 |
--- 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 |
+++ 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 @@ |
|
|
<entry> |
|
|
<base>HOSTNAME_DESCRIPTION</base> |
|
|
<trans> |
|
|
- 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. |
|
|
</trans> |
|
|
</entry> |
|
18 |
@@ -271,4 +271,18 @@ |
@@ -271,4 +271,18 @@ |
19 |
<base>MUST_BE_VALID_HOSTNAME_OR_IP</base> |
<base>MUST_BE_VALID_HOSTNAME_OR_IP</base> |
20 |
<trans>Must be a valid hostname or IP number</trans> |
<trans>Must be a valid hostname or IP number</trans> |
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 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> |
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-]*$/ ) |
50 |
+ return $self->error('HOSTNAME_VALIDATOR_ERROR'); |
+ return $self->error('HOSTNAME_VALIDATOR_ERROR'); |
51 |
+ } |
+ } |
52 |
+ |
+ |
53 |
+ unless ( $comment =~ /^[a-z0-9][a-z0-9-]*$/ ) |
+ 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 |
} |
} |