From c279afcedf5878810de6280d3cb45c62e04c416d Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Thu, 14 Mar 2002 14:12:04 +0000 Subject: [PATCH] * crypto-in-main changes.* utils.py (move, copy): add an optional perms= parameter to let you set the resulting permissions of the moved/copied file* katie.py (force_move): rejected/morgued files should be unreadable* jennifer (do_byhand, acknowledge_new): pending new and byhand files should be unreadable. --- jennifer | 10 +++++----- katie.py | 7 ++++--- shania | 4 ++-- utils.py | 10 +++++----- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/jennifer b/jennifer index 7667d56f..96077d36 100755 --- a/jennifer +++ b/jennifer @@ -2,7 +2,7 @@ # Checks Debian packages from Incoming # Copyright (C) 2000, 2001 James Troup -# $Id: jennifer,v 1.8 2002-02-25 15:38:06 troup Exp $ +# $Id: jennifer,v 1.9 2002-03-14 14:12:04 ajt 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 @@ -44,7 +44,7 @@ re_is_changes = re.compile (r"(.+?)_(.+?)_(.+?)\.changes$"); ################################################################################ # Globals -jennifer_version = "$Revision: 1.8 $"; +jennifer_version = "$Revision: 1.9 $"; Cnf = None; Options = None; @@ -967,10 +967,10 @@ def do_byhand (summary): file_keys = files.keys(); - # Move all the files into the accepted directory + # Move all the files into the byhand directory utils.move (pkg.changes_file, Cnf["Dir::QueueByhandDir"]); for file in file_keys: - utils.move (file, Cnf["Dir::QueueByhandDir"]); + utils.move (file, Cnf["Dir::QueueByhandDir"], perms=0660); # Check for override disparities if not Cnf["Dinstall::Options::No-Mail"]: @@ -998,7 +998,7 @@ def acknowledge_new (summary): # Move all the files into the accepted directory utils.move (pkg.changes_file, Cnf["Dir::QueueNewDir"]); for file in file_keys: - utils.move (file, Cnf["Dir::QueueNewDir"]); + utils.move (file, Cnf["Dir::QueueNewDir"], perms=0660); if not Options["No-Mail"]: print "Sending new ack."; diff --git a/katie.py b/katie.py index 029c889e..876e2f37 100644 --- a/katie.py +++ b/katie.py @@ -2,7 +2,7 @@ # Utility functions for katie # Copyright (C) 2001 James Troup -# $Id: katie.py,v 1.10 2002-03-06 07:39:24 rmurray Exp $ +# $Id: katie.py,v 1.11 2002-03-14 14:12:04 ajt 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 @@ -416,7 +416,7 @@ class Katie: # someone is trying to exploit us. utils.warn("**WARNING** failed to move %s from the reject directory to the morgue." % (file)); return; - utils.move(dest_file, morgue_file); + utils.move(dest_file, morgue_file, perms=0660); try: os.open(dest_file, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0644); except OSError, e: @@ -427,7 +427,8 @@ class Katie: raise; # If we got here, we own the destination file, so we can # safely overwrite it. - utils.move(file, dest_file, 1); + utils.move(file, dest_file, 1, perms=0660); + ########################################################################### diff --git a/shania b/shania index 5cd8ad7a..e3423d68 100755 --- a/shania +++ b/shania @@ -2,7 +2,7 @@ # Clean incoming of old unused files # Copyright (C) 2000, 2001 James Troup -# $Id: shania,v 1.12 2002-02-12 22:14:38 troup Exp $ +# $Id: shania,v 1.13 2002-03-14 14:12:04 ajt 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 @@ -91,7 +91,7 @@ def remove (file): # If the destination file exists; try to find another filename to use if os.path.exists(dest_filename): dest_filename = utils.find_next_free(dest_filename, 10); - utils.move(file, dest_filename); + utils.move(file, dest_filename, 0660); else: utils.warn("skipping '%s', permission denied." % (os.path.basename(file))); diff --git a/utils.py b/utils.py index cc967235..96c61dbf 100644 --- a/utils.py +++ b/utils.py @@ -1,6 +1,6 @@ # Utility functions # Copyright (C) 2000, 2001 James Troup -# $Id: utils.py,v 1.39 2002-02-22 02:19:26 troup Exp $ +# $Id: utils.py,v 1.40 2002-03-14 14:12:04 ajt 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 @@ -301,7 +301,7 @@ def poolify (source, component): ###################################################################################### -def move (src, dest, overwrite = 0): +def move (src, dest, overwrite = 0, perms = 0664): if os.path.exists(dest) and os.path.isdir(dest): dest_dir = dest; else: @@ -321,10 +321,10 @@ def move (src, dest, overwrite = 0): if not os.access(dest, os.W_OK): raise cant_overwrite_exc shutil.copy2(src, dest); - os.chmod(dest, 0664); + os.chmod(dest, perms); os.unlink(src); -def copy (src, dest, overwrite = 0): +def copy (src, dest, overwrite = 0, perms = 0664): if os.path.exists(dest) and os.path.isdir(dest): dest_dir = dest; else: @@ -344,7 +344,7 @@ def copy (src, dest, overwrite = 0): if not os.access(dest, os.W_OK): raise cant_overwrite_exc shutil.copy2(src, dest); - os.chmod(dest, 0664); + os.chmod(dest, perms); ###################################################################################### -- 2.39.2