]> git.decadent.org.uk Git - dak.git/blob - config/debian/extensions.py
7e418db3231fcf0d64f7eebf1dc23c01205209f1
[dak.git] / config / debian / extensions.py
1 import sys, os
2
3 # This function and its data should move into daklib/extensions.py
4 # or something.
5 replaced_funcs = {}
6 replace_funcs = {}
7 def replace_dak_function(module,name):
8     def x(f):
9         replace_funcs["%s:%s" % (module,name)] = f
10     return x
11
12 @replace_dak_function("process-unchecked", "check_signed_by_key")
13 def check_signed_by_key():
14     changes = dak_module.changes
15     reject = dak_module.reject
16
17     if changes["source"] == "dpkg":
18         fpr = changes["fingerprint"]
19         (uid, uid_name) = dak_module.lookup_uid_from_fingerprint(fpr)
20         if fpr == "5906F687BD03ACAD0D8E602EFCF37657" or uid == "iwj":
21             reject("Upload blocked due to hijack attempt 2008/03/19")
22
23             # NB: 1.15.0, 1.15.2 signed by this key targetted at unstable
24             #     have been made available in the wild, and should not be
25             #     blocked until Debian's dpkg has revved past those version
26             #     numbers
27
28     replaced_funcs["check_signed_by_key"]()
29
30 def init(name):
31     global replaced_funcs
32
33     # This bit should be done automatically too
34     replaced_funcs = {}
35     for f,newfunc in replace_funcs.iteritems():
36         m,f = f.split(":",1)
37         if len(f) > 0 and m == name:
38             replaced_funcs[f] = dak_module.__dict__[f]
39             dak_module.__dict__[f] = newfunc
40