diff --git a/Shorewall/Perl/Shorewall/Compiler.pm b/Shorewall/Perl/Shorewall/Compiler.pm index 92a758d97..3f9f11177 100644 --- a/Shorewall/Perl/Shorewall/Compiler.pm +++ b/Shorewall/Perl/Shorewall/Compiler.pm @@ -913,7 +913,7 @@ sub compiler { # # Close, rename and secure the script # - finalize_script ( $export ); + finalize_script ( $export, $test ); # # And generate the auxilary config file # diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index 0a31fec89..3c988a4a6 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -2015,23 +2015,25 @@ sub generate_sha1() { # # Finalize the script file # -sub finalize_script( $ ) { - my $export = $_[0]; +sub finalize_script( $$ ) { + my ( $export, $test ) = @_; close $script; $script = 0; if ( $file ne '-' ) { - my $sha1sum = generate_sha1; - my $sha1sum1 = join( '-', 'sha-lh', substr( $sha1sum, 0, 20 ) ); - my $sha1sum2 = join( '-', 'sha-rh', substr( $sha1sum, -20 ) ); + unless ( $test ) { + my $sha1sum = generate_sha1; + my $sha1sum1 = join( '-', 'sha-lh', substr( $sha1sum, 0, 20 ) ); + my $sha1sum2 = join( '-', 'sha-rh', substr( $sha1sum, -20 ) ); - @ARGV = ( $tempfile ); - $^I = ''; + @ARGV = ( $tempfile ); + $^I = ''; - while ( <> ) { - s/g_sha1sum1=/g_sha1sum1=$sha1sum1/; - s/g_sha1sum2=/g_sha1sum2=$sha1sum2/; - print; + while ( <> ) { + s/g_sha1sum1=/g_sha1sum1=$sha1sum1/; + s/g_sha1sum2=/g_sha1sum2=$sha1sum2/; + print; + } } rename $tempfile, $file or fatal_error "Cannot Rename $tempfile to $file: $!";