From: James Troup Date: Sun, 14 Jul 2002 17:07:45 +0000 (+0000) Subject: check file size as well as md5sum X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c511e48da2f9c0735fa59fa57558816b183a99b2;p=dak check file size as well as md5sum --- diff --git a/TODO b/TODO index ff136adf..b9a5cddd 100644 --- a/TODO +++ b/TODO @@ -19,10 +19,6 @@ Actually Urgent More Urgent ----------- - * Something fucked up. Not sure why the .diff.gz size didn't match the - .changes/.dsc. Not sure why katie didn't reject the upload when it found - that out aswell. - Can't read file.: /org/security.debian.org/queue/accepted/accepted/apache-perl_1.3.9-14.1-1.21.20000309-1_sparc.katie. You assume that the filenames are relative to accepted/, might want to doc or fix that. the orig was in NEW, the changes that caused it to be NEW were pulled out in -2, and we end up with no orig in the archive :( @@ -236,6 +232,8 @@ Less Urgent o Handle the case of 1:1.1 which would overwrite 1.1 (?) o maybe drop -r/--regex in madison, make it the default and implement -e/--exact (a la joey's "elmo") + o dsc files are not checked for existence/perms (only an issue if + they're in the .dsc, but not the .changes.. possible?) * Cleanups & misc: diff --git a/jennifer b/jennifer index a567e1ef..ace63804 100755 --- a/jennifer +++ b/jennifer @@ -2,7 +2,7 @@ # Checks Debian packages from Incoming # Copyright (C) 2000, 2001, 2002 James Troup -# $Id: jennifer,v 1.24 2002-06-22 22:34:35 troup Exp $ +# $Id: jennifer,v 1.25 2002-07-14 17:07:45 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -45,7 +45,7 @@ re_valid_pkg_name = re.compile(r"^[\dA-Za-z][\dA-Za-z\+\-\.]+$"); ################################################################################ # Globals -jennifer_version = "$Revision: 1.24 $"; +jennifer_version = "$Revision: 1.25 $"; Cnf = None; Options = None; @@ -837,16 +837,28 @@ def check_urgency (): ################################################################################ +def md5sum_size_check(file, orig_file): + try: + file_handle = utils.open_file(file); + except utils.cant_open_exc: + return; + + # Check md5sum + if apt_pkg.md5sum(file_handle) != files[file]["md5sum"]: + reject("%s: md5sum check failed." % (file)); + file_handle.close(); + # Check size + actual_size = os.stat(file)[stat.ST_SIZE]; + size = int(files[file]["size"]); + if size != actual_size: + reject("%s: actual file size (%s) does not match size (%s) in %s" + % (file, actual_size, size, orig_file)); + def check_md5sums (): for file in files.keys(): - try: - file_handle = utils.open_file(file); - except utils.cant_open_exc: - pass; - else: - if apt_pkg.md5sum(file_handle) != files[file]["md5sum"]: - reject("md5sum check failed for %s." % (file)); - file_handle.close(); + md5sum_size_check(file, ".changes"); + for file in dsc_files.keys(): + md5sum_size_check(file, ".dsc"); ################################################################################ @@ -1103,9 +1115,9 @@ def process_it (changes_file): while reprocess: check_distributions(); check_files(); - check_md5sums(); check_dsc(); check_diff(); + check_md5sums(); check_urgency(); check_timestamps(); Katie.update_subst(reject_message);