You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ra...@apache.org on 2018/09/21 22:42:53 UTC
[trafficcontrol] branch master updated (1a0770f -> 70d8893)
This is an automated email from the ASF dual-hosted git repository.
rawlin pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git.
from 1a0770f flip signed flag when signingAlgorithm is changed. fixes #2836
new e50eeb2 Add sub to validate user input when running postinstall script changes default cdn name to not include an underscore.
new 9ac4099 Altering postinstall cdn name regex to include underscores
new 70d8893 Changing back the default cdn name value
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
traffic_ops/install/lib/InstallUtils.pm | 40 +++++++++++++++++++++++----------
1 file changed, 28 insertions(+), 12 deletions(-)
[trafficcontrol] 03/03: Changing back the default cdn name value
Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rawlin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit 70d8893335b63db006974932341378717c42701c
Author: Dylan Souza <dy...@comcast.com>
AuthorDate: Fri Sep 21 18:11:29 2018 +0000
Changing back the default cdn name value
---
traffic_ops/install/bin/_postinstall | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/traffic_ops/install/bin/_postinstall b/traffic_ops/install/bin/_postinstall
index a0f4edd..586855d 100755
--- a/traffic_ops/install/bin/_postinstall
+++ b/traffic_ops/install/bin/_postinstall
@@ -569,7 +569,7 @@ sub getDefaults {
"config_var" => "tm.url"
},
{
- "Human-readable CDN Name. (No whitespace, please)" => "kabletownCdn",
+ "Human-readable CDN Name. (No whitespace, please)" => "kabletown_cdn",
"config_var" => "cdn_name"
},
{
[trafficcontrol] 02/03: Altering postinstall cdn name regex to
include underscores
Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rawlin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit 9ac409904987ad0b52e3de26b79422b9688bbb8e
Author: Dylan Souza <dy...@comcast.com>
AuthorDate: Fri Sep 21 18:08:14 2018 +0000
Altering postinstall cdn name regex to include underscores
---
traffic_ops/install/bin/input.json | 2 +-
traffic_ops/install/lib/InstallUtils.pm | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/traffic_ops/install/bin/input.json b/traffic_ops/install/bin/input.json
index 9ff17d2..871b139 100644
--- a/traffic_ops/install/bin/input.json
+++ b/traffic_ops/install/bin/input.json
@@ -136,7 +136,7 @@
"config_var":"tm.url"
},
{
- "Human-readable CDN Name. (No whitespace, please)":"kabletownCdn",
+ "Human-readable CDN Name. (No whitespace, please)":"kabletown_cdn",
"config_var":"cdn_name"
},
{
diff --git a/traffic_ops/install/lib/InstallUtils.pm b/traffic_ops/install/lib/InstallUtils.pm
index 738c270..22545f2 100644
--- a/traffic_ops/install/lib/InstallUtils.pm
+++ b/traffic_ops/install/lib/InstallUtils.pm
@@ -131,7 +131,7 @@ sub randomWord {
sub sanitize{
my ($promptString, $userInput) = @_;
if (index($promptString, "Human-readable CDN Name") != -1){
- if ($userInput =~ m/[^-a-zA-Z0-9]/){
+ if ($userInput =~ m/[^-a-zA-Z0-9_.]/){
print "Invalid characters in user input. Try again.\n\n";
return false;
}
[trafficcontrol] 01/03: Add sub to validate user input when running
postinstall script changes default cdn name to not include an underscore.
Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rawlin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit e50eeb2c7f46828cbe1d461288f2d98ccdd4ebaa
Author: Dylan Souza <dy...@comcast.com>
AuthorDate: Tue Sep 11 13:01:07 2018 -0600
Add sub to validate user input when running postinstall script changes default cdn name to not include an underscore.
Resolves: #2747
---
traffic_ops/install/bin/_postinstall | 2 +-
traffic_ops/install/bin/input.json | 2 +-
traffic_ops/install/lib/InstallUtils.pm | 40 +++++++++++++++++++++++----------
3 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/traffic_ops/install/bin/_postinstall b/traffic_ops/install/bin/_postinstall
index 586855d..a0f4edd 100755
--- a/traffic_ops/install/bin/_postinstall
+++ b/traffic_ops/install/bin/_postinstall
@@ -569,7 +569,7 @@ sub getDefaults {
"config_var" => "tm.url"
},
{
- "Human-readable CDN Name. (No whitespace, please)" => "kabletown_cdn",
+ "Human-readable CDN Name. (No whitespace, please)" => "kabletownCdn",
"config_var" => "cdn_name"
},
{
diff --git a/traffic_ops/install/bin/input.json b/traffic_ops/install/bin/input.json
index 871b139..9ff17d2 100644
--- a/traffic_ops/install/bin/input.json
+++ b/traffic_ops/install/bin/input.json
@@ -136,7 +136,7 @@
"config_var":"tm.url"
},
{
- "Human-readable CDN Name. (No whitespace, please)":"kabletown_cdn",
+ "Human-readable CDN Name. (No whitespace, please)":"kabletownCdn",
"config_var":"cdn_name"
},
{
diff --git a/traffic_ops/install/lib/InstallUtils.pm b/traffic_ops/install/lib/InstallUtils.pm
index a7df222..738c270 100644
--- a/traffic_ops/install/lib/InstallUtils.pm
+++ b/traffic_ops/install/lib/InstallUtils.pm
@@ -23,9 +23,9 @@ package InstallUtils;
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -127,24 +127,40 @@ sub randomWord {
return $secret;
}
+# Any checks to user input configurations can be implemented in this functions.
+sub sanitize{
+ my ($promptString, $userInput) = @_;
+ if (index($promptString, "Human-readable CDN Name") != -1){
+ if ($userInput =~ m/[^-a-zA-Z0-9]/){
+ print "Invalid characters in user input. Try again.\n\n";
+ return false;
+ }
+ }
+ return true;
+}
+
sub promptUser {
my ( $promptString, $defaultValue, $noEcho ) = @_;
- if ($defaultValue) {
- print $promptString, " [", $defaultValue, "]: ";
- }
- else {
- print $promptString, ": ";
- }
-
if ( defined $noEcho && $noEcho ) {
# Set echo mode to off via ReadMode 2
ReadMode 2;
}
- $| = 1;
- $_ = <STDIN>;
- chomp;
+ # Check user input for invalid characters
+ my $sanitized = false;
+ while ($sanitized eq false){
+ if ($defaultValue) {
+ print $promptString, " [", $defaultValue, "]: ";
+ }
+ else {
+ print $promptString, ": ";
+ }
+ $| = 1;
+ $_ = <STDIN>;
+ chomp;
+ $sanitized = sanitize($promptString, $_)
+ }
if ( defined $noEcho && $noEcho ) {
# Set echo mode to on via ReadMode 1