summaryrefslogtreecommitdiffstats
path: root/fooconf-postfix-mailbox-domains
blob: 35cc6d61c573d66cce5b93539d4e4a5d1ca68552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python
# Hey Emacs, this is -*-python-*- code!

from fooconflib import *

def generatePostfixMailboxDomainsFragment(ctx = FooConfContext()):
    cursor = ctx.db.cursor()

    cursor.execute("SELECT domain.name AS name "+
                   "FROM domain, account "+
                   "WHERE domain.owner = account.id "+
                   "AND account.enabled = \"t\"")

    while 1:
        row = cursor.fetchone()
        if row is None: break

        print "%s any" % row["name"]

if __name__ == "__main__":
    generatePostfixMailboxDomainsFragment()