@@ -50,6 +50,7 @@ sub update_config_controller {
50
50
$fields2Encrypt {$fieldName } = undef ;
51
51
}
52
52
}
53
+ return if keys (%fields2Encrypt ) == 0;
53
54
54
55
my $cs = $c -> config_store;
55
56
my $ini = $cs -> cachedConfig;
@@ -59,12 +60,15 @@ sub update_config_controller {
59
60
next if (!exists $fields2Encrypt {$param });
60
61
print " Changing $section .$param \n " ;
61
62
my $val = $ini -> val($section , $param );
63
+ next if length ($val ) == 0;
62
64
$val = pf::config::crypt ::pf_encrypt($val );
63
65
$ini -> setval($section , $param , $val );
64
66
$changed |= 1;
65
67
}
66
68
}
69
+
67
70
if ($changed ) {
71
+ $ini -> removeDefaultValues();
68
72
$ini -> RewriteConfig();
69
73
}
70
74
}
@@ -89,16 +93,20 @@ sub update_config_controller_with_subtype {
89
93
$fields2Encrypt {$fieldName } = undef ;
90
94
}
91
95
}
96
+ next if keys (%fields2Encrypt ) == 0;
92
97
for my $param ($ini -> Parameters($section )) {
93
98
next if (!exists $fields2Encrypt {$param });
94
99
my $val = $ini -> val($section , $param );
100
+ next if length ($val ) == 0;
95
101
print " Changing $section .$param \n " ;
96
102
$val = pf::config::crypt ::pf_encrypt($val );
97
103
$ini -> setval($section , $param , $val );
98
104
$changed |= 1;
99
105
}
100
106
}
107
+
101
108
if ($changed ) {
109
+ $ini -> removeDefaultValues();
102
110
$ini -> RewriteConfig();
103
111
}
104
112
}
0 commit comments