X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-mailgate;h=073ee4f823af598019db99088252889e9e69d02b;hb=c61076ac9d401f7abf65d5e1eac7f5a666a32ba4;hp=0d6d330212a14d9fc29ae4c6fc82eaa8e51294da;hpb=8a552664fb81b23f7e6ad23864f1b031a2592b47;p=mirror%2Fuserdir-ldap.git diff --git a/ud-mailgate b/ud-mailgate index 0d6d330..073ee4f 100755 --- a/ud-mailgate +++ b/ud-mailgate @@ -331,10 +331,11 @@ def DoSSH(Str, Attrs, badkeys, uid): Subst["__ERROR__"] = "SSH key with fingerprint %s known as bad key" % (g[1]) ErrReply = TemplateSubst(Subst, open(TemplatesDir + "admin-info", "r").read()) - Child = os.popen("/usr/sbin/sendmail -t", "w") - Child.write(ErrReplyHead) - Child.write(ErrReply) - if Child.close() is not None: + Child = subprocess.Popen(['/usr/sbin/sendmail', '-t'], stdin=subprocess.PIPE) + Child.stdin.write(ErrReplyHead) + Child.stdin.write(ErrReply) + Child.stdin.close() + if Child.wait() != 0: raise UDExecuteError("Sendmail gave a non-zero return code") except Exception: sys.exit(EX_TEMPFAIL) @@ -371,6 +372,10 @@ def DoDNS(Str, Attrs, DnRecord): aaaarecord is None: return None + # Check for punycode. We ought to validate it before we allow it in our zone. + if Str.lower().startswith('xn--'): + return "Punycode not allowed: " + Str + # Check if the name is already taken G = re.match(r'^([-\w+]+)\s', Str) if G is None: