From af0774b9c0ce4907bbdf95e57ffdb534366e19dc Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Fri, 7 Oct 2022 19:02:40 -0500 Subject: [PATCH] Remove version 1.0 compatibility mode --- gatekeeper.pl | 60 +++++++++++---------------------------------------- 1 file changed, 12 insertions(+), 48 deletions(-) diff --git a/gatekeeper.pl b/gatekeeper.pl index 9faa5a7..40b40ea 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -32,10 +32,8 @@ # foo-1.2.tar.gz, the file to upload (could be anything) with no sig. # foo-1.2.tar.gz.sig, detached binary signature (gpg -b) for uploaded file. # -# The directive file must always contain a 'directory', 'version' and -# 'filename' directive, unless when run in compatibility mode ($V1_COMPAT_MODE -# is set), in which case directive files with only a 'directory' directive are -# allowed. +# The directive file in a triplet must always contain 'directory', +# 'version' and 'filename' directives. # # Alternatively, we expect to find only a directive file. This file must have # a name that ends in 'directive.asc', and must contain one or more of these @@ -135,8 +133,6 @@ BEGIN { delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; } -my $V1_COMPAT_ALLOWED = 0; - my $NAME = 'gatekeeper.pl'; my $VERSION = '1.2'; # This is the protocol version my $DATE = '2017/09/14 12:42:38'; @@ -1000,9 +996,6 @@ sub read_directive_file { my $uploaded_file = shift; my $directive_only = shift; - # We default to v1.1 - $info{'v1_compat_mode'} = 0; - # For debugging purposes, see below my $directive_file_contents = ''; my @lines = (); @@ -1136,10 +1129,7 @@ sub read_directive_file { } } - $info{'v1_compat_mode'} = 0; - - if (exists($info{"replace"}) - && (($info{'v1_compat_mode'} == 1) || ($info{"version"} eq '1.1'))) { + if (exists($info{"replace"}) && ($info{"version"} eq '1.1')) { fatal("invalid directive 'replace', not supported prior to version 1.2", 1,$directive_file_contents); } @@ -1165,10 +1155,7 @@ sub read_directive_file { # 1. It exists in the directive file - there is no problem # 2. It doesn't exist in the directive file # In that case, we need to double check a few things. - # This is permitted IF $V1_COMPAT_ALLOWED is true, AND if the only - # directive is a 'directory'. - # (for backwards compatibility with older versions of the script) - # It is also permitted if the directive file contains commands that + # This is permitted if the directive file contains commands that # don't require a filename - currently symlink, rmsymlink, and # archive - and only the directive file was uploaded if (!exists($info{filename})) { @@ -1176,7 +1163,7 @@ sub read_directive_file { foreach (keys %info) { $directory_command_only = 0 if (($_ ne 'directory') && ($_ ne 'package') && ($_ ne 'email') - && ($_ ne 'version') && ($_ ne 'v1_compat_mode')); + && ($_ ne 'version')); } # This is where we would check for commands that require a file. # In this version (1.1), there are none, so all we do is check @@ -1184,22 +1171,10 @@ sub read_directive_file { if (!$directive_only) { # We have three files - # Are we in version 1.0 compatibility mode? - if ($V1_COMPAT_ALLOWED) { - # We're in backwards compatibility mode which means: three files, - # and ONLY a directory directive in the directive file - $info{'v1_compat_mode'} = 1; - if ($directory_command_only == 0) { - fatal("no filename directive specified in $directive_file",1) - } else { - ftp_syslog('info',"running in legacy v1 compatibility mode"); - } - } elsif (!$V1_COMPAT_ALLOWED) { - # This is not allowed - we require a filename directive. No backwards compatibility. - fatal("no filename directive specified in $directive_file. " - ."Upgrade to the latest version! " - ."See http://www.gnu.org/prep/maintain/maintain.html",1) - } + # This is not allowed - we require a filename directive. + fatal("no filename directive specified in $directive_file. " + ."Upgrade to the latest version! " + ."See http://www.gnu.org/prep/maintain/maintain.html",1) } else { # We only have a directive file # Do we have something to do? @@ -1208,8 +1183,6 @@ sub read_directive_file { } $filename_required = 0; } - ftp_syslog('info',"not running in legacy v1 mode") - if (!$info{'v1_compat_mode'}); # Configuration must exist for the package -d $package_config_base . '/' . $info{"package"} @@ -1243,11 +1216,9 @@ sub read_directive_file { if ($directive_file ne "$info{filename}{value}.directive.asc"); } - # They have to specify a version unless we're in 1.0 compatibility mode - if (!$info{'v1_compat_mode'}) { - fatal("no version directive specified in $directive_file",1) - if ! $info{"version"}; - } + # They have to specify a version + fatal("no version directive specified in $directive_file",1) + if ! $info{"version"}; my $retval = verify_keyring($directive_file,$directive_file_contents, @keyrings); @@ -1603,7 +1574,6 @@ sub execute_commands { delete($info{email}); delete($info{package}); delete($info{version}); - delete($info{'v1_compat_mode'}); delete($info{'replace'}); my $destdir = "$destfinal/$originfo{directory}"; @@ -1653,12 +1623,6 @@ sub execute_commands { archive($destdir, $originfo{directory}, $1); } } - - # We're running in v1 mode. - if ($originfo{'v1_compat_mode'}) { - check_files($files,%originfo); - install_files($files,%originfo); - } } -- 2.25.1