]> git.decadent.org.uk Git - dak.git/commitdiff
Merge branch 'master' of ssh://ftp-master.debian.org/srv/ftp.debian.org/git/dak
authorJoerg Jaspert <joerg@debian.org>
Thu, 9 Apr 2009 16:29:37 +0000 (18:29 +0200)
committerJoerg Jaspert <joerg@debian.org>
Thu, 9 Apr 2009 16:29:37 +0000 (18:29 +0200)
* 'master' of ssh://ftp-master.debian.org/srv/ftp.debian.org/git/dak:
  fix undefined cursor
  Fix the is_dm check to deal with the fact we have typing in our DB layer

dak/process_unchecked.py

index 8f9857f411660ec286c3388e76d8e2d3d98aefb6..b2097def91f3982734df160c78815f6956587829 100755 (executable)
@@ -1014,7 +1014,7 @@ def lookup_uid_from_fingerprint(fpr):
     if qs:
         return qs
     else:
-        return (None, None, None)
+        return (None, None, False)
 
 def check_signed_by_key():
     """Ensure the .changes is signed by an authorized uploader."""
@@ -1024,17 +1024,22 @@ def check_signed_by_key():
         uid_name = ""
 
     # match claimed name with actual name:
-    if uid == None:
+    if uid is None:
+        # This is fundamentally broken but need us to refactor how we get
+        # the UIDs/Fingerprints in order for us to fix it properly
         uid, uid_email = changes["fingerprint"], uid
         may_nmu, may_sponsor = 1, 1
         # XXX by default new dds don't have a fingerprint/uid in the db atm,
         #     and can't get one in there if we don't allow nmu/sponsorship
-    elif is_dm is "t":
-        uid_email = uid
-        may_nmu, may_sponsor = 0, 0
-    else:
+    elif is_dm is False:
+        # If is_dm is False, we allow full upload rights
         uid_email = "%s@debian.org" % (uid)
         may_nmu, may_sponsor = 1, 1
+    else:
+        # Assume limited upload rights unless we've discovered otherwise
+        uid_email = uid
+        may_nmu, may_sponsor = 0, 0
+
 
     if uid_email in [changes["maintaineremail"], changes["changedbyemail"]]:
         sponsored = 0
@@ -1053,6 +1058,7 @@ def check_signed_by_key():
     if sponsored and not may_sponsor:
         reject("%s is not authorised to sponsor uploads" % (uid))
 
+    cursor = DBConn().cursor()
     if not sponsored and not may_nmu:
         source_ids = []
         cursor.execute( "SELECT s.id, s.version FROM source s JOIN src_associations sa ON (s.id = sa.source) WHERE s.source = %(source)s AND s.dm_upload_allowed = 'yes'", changes )