[sysadmin-bin] Be more strict in allowing an oldversion in the filename



commit 94488ad398ef4293b80914c48d1321062ff1ca12
Author: Olav Vitters <olav vitters nl>
Date:   Mon May 25 22:59:52 2015 +0200

    Be more strict in allowing an oldversion in the filename
    
    ftpadmin allows things like:
    $MODULE-$OLDVERSION-$NEWVERSION.$EXTENSION
    
    but that breaks with gnome-2048
    
    fix it by requiring that any $OLDVERSION has at least a - or a .
    
    Fixes bug 748789

 ftpadmin |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/ftpadmin b/ftpadmin
index 3197a2c..4fb671d 100755
--- a/ftpadmin
+++ b/ftpadmin
@@ -46,11 +46,11 @@ DEBUG=True
 BUGZILLARPC=True
 
 # Protection, only ovitters should be using debug mode:
-if os.environ['USER'] != 'ovitters':
+if not os.environ['USER'] in ('ovitters', 'olav'):
     DEBUG=False
 
 GROUP='ftpadmin'
-re_file = 
re.compile(r'^(?P<module>.*?)[_-](?:(?P<oldversion>([0-9]+[\.])*[0-9]+)-)?(?P<version>([0-9]+[\.\-])*[0-9]+)\.(?P<format>(?:tar\.|diff\.)?[a-z][a-z0-9]*)$')
+re_file = 
re.compile(r'^(?P<module>.*?)[_-](?:(?P<oldversion>([0-9]+[\.])+[0-9]+)-)?(?P<version>([0-9]+[\.\-])*[0-9]+)\.(?P<format>(?:tar\.|diff\.)?[a-z][a-z0-9]*)$')
 re_majmin = re.compile(r'^([0-9]+\.[0-9]+).*')
 re_version = re.compile(r'([-.]|\d+|[^-.\d]+)')
 re_who = re.compile(r' <[^>]+>$')
@@ -1737,12 +1737,16 @@ def main():
     except KeyError:
         print >>sys.stderr, 'FATAL: Group %s does NOT exist!' % GROUP
         print >>sys.stderr, 'FATAL: Please inform gnome-sysadmin gnome org!'
-        sys.exit(1)
+        if not DEBUG:
+            sys.exit(1)
+        groupid = None
 
     if groupid is None or (os.getgid() != groupid and groupid not in os.getgroups()):
         print 'FATAL: Script requires membership of the %s group' % GROUP
-        sys.exit(1)
-    BasicInfo.GROUPID = groupid
+        if not DEBUG:
+            sys.exit(1)
+    else:
+        BasicInfo.GROUPID = groupid
 
     description = """Install new tarball(s) to GNOME FTP master and make it available on the mirrors."""
     epilog="""Report bugs to https://bugzilla.gnome.org/enter_bug.cgi?product=sysadmin""";


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]