summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/VyattaConfigOutput.pm24
-rwxr-xr-xscripts/vyatta-output-config.pl1
2 files changed, 25 insertions, 0 deletions
diff --git a/scripts/VyattaConfigOutput.pm b/scripts/VyattaConfigOutput.pm
index a1e999b..861316a 100755
--- a/scripts/VyattaConfigOutput.pm
+++ b/scripts/VyattaConfigOutput.pm
@@ -21,6 +21,13 @@ sub set_show_all {
}
}
+my $hide_password = 0;
+sub set_hide_password {
+ if (shift) {
+ $hide_password = 1;
+ }
+}
+
my $config = undef;
# $0: array ref for path
@@ -34,6 +41,8 @@ sub displayValues {
my $name = $_[2];
my $simple_show = $_[3];
my ($is_multi, $is_text, $default) = $config->parseTmpl(\@cur_path);
+ my $is_password = ($name =~ /^.*password$/);
+ my $HIDE_PASSWORD = '****************';
$config->setLevel(join ' ', @cur_path);
if ($is_multi) {
my @ovals = $config->returnOrigValues('');
@@ -50,12 +59,18 @@ sub displayValues {
@ovals;
if (defined($simple_show)) {
foreach my $oval (@ovals) {
+ if ($is_password && $hide_password) {
+ $oval = $HIDE_PASSWORD;
+ }
print "$prefix$name $oval\n";
}
return;
}
foreach my $del (@dlist) {
if (defined($del)) {
+ if ($is_password && $hide_password) {
+ $del = $HIDE_PASSWORD;
+ }
print "-$prefix$name $del\n";
}
}
@@ -68,6 +83,9 @@ sub displayValues {
$diff = ' ';
}
}
+ if ($is_password && $hide_password) {
+ $nval = $HIDE_PASSWORD;
+ }
print "$diff$prefix$name $nval\n";
}
} else {
@@ -83,6 +101,9 @@ sub displayValues {
}
if (defined($simple_show)) {
if (!defined($default) || $default ne $oval || $show_all) {
+ if ($is_password && $hide_password) {
+ $oval = $HIDE_PASSWORD;
+ }
print "$prefix$name: $oval\n";
}
return;
@@ -101,6 +122,9 @@ sub displayValues {
}
}
if (!defined($default) || $default ne $value || $show_all) {
+ if ($is_password && $hide_password) {
+ $value = $HIDE_PASSWORD;
+ }
print "$diff$prefix$name: $value\n";
}
}
diff --git a/scripts/vyatta-output-config.pl b/scripts/vyatta-output-config.pl
index 8eb0be8..65169f6 100755
--- a/scripts/vyatta-output-config.pl
+++ b/scripts/vyatta-output-config.pl
@@ -10,6 +10,7 @@ if ($ARGV[0] eq '-all') {
}
if ($ARGV[0] eq '-active') {
shift;
+ VyattaConfigOutput::set_hide_password(1);
VyattaConfigOutput::outputActiveConfig(@ARGV);
} else {
VyattaConfigOutput::outputNewConfig(@ARGV);