View | Details | Raw Unified | Return to bug 15220 | Differences between
and this patch

Collapse All | Expand All

(-)debian/rules (+1 lines)
Lines 69-74 Link Here
69
	install -m 0755 usr/sbin/univention-cyrus-set-foldertype-shared ${D}/usr/sbin/univention-cyrus-set-foldertype-shared
69
	install -m 0755 usr/sbin/univention-cyrus-set-foldertype-shared ${D}/usr/sbin/univention-cyrus-set-foldertype-shared
70
70
71
	install -m 0755 cyrus.py ${D}/usr/lib/univention-directory-listener/system/
71
	install -m 0755 cyrus.py ${D}/usr/lib/univention-directory-listener/system/
72
	install -m 0755 mailMailQuota.py ${D}/usr/lib/univention-directory-listener/system/
72
	install -m 0755 cyrus-sieve.py ${D}/usr/lib/univention-directory-listener/system/
73
	install -m 0755 cyrus-sieve.py ${D}/usr/lib/univention-directory-listener/system/
73
	install -m 0755 cyrus-shared-folder.py ${D}/usr/lib/univention-directory-listener/system/
74
	install -m 0755 cyrus-shared-folder.py ${D}/usr/lib/univention-directory-listener/system/
74
75
(-)mailMailQuota.py (+75 lines)
Line 0 Link Here
1
#!/usr/bin/python2.4
2
# -*- coding: utf-8 -*-
3
#
4
# Univention mailMailQuota
5
#  Univention Listener Module
6
#
7
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Univention GmbH
8
#
9
# http://www.univention.de/
10
#
11
# All rights reserved.
12
#
13
# This program is free software; you can redistribute it and/or modify
14
# it under the terms of the GNU General Public License version 2 as
15
# published by the Free Software Foundation.
16
#
17
# Binary versions of this file provided by Univention to you as
18
# well as other copyrighted, protected or trademarked materials like
19
# Logos, graphics, fonts, specific documentations and configurations,
20
# cryptographic keys etc. are subject to a license agreement between
21
# you and Univention.
22
#
23
# This program is distributed in the hope that it will be useful,
24
# but WITHOUT ANY WARRANTY; without even the implied warranty of
25
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
# GNU General Public License for more details.
27
#
28
# You should have received a copy of the GNU General Public License
29
# along with this program; if not, write to the Free Software
30
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA      02110-1301      USA
31
32
name='mailMailQuota'
33
description='sets MailQuota from LDAP Entry'
34
filter='(objectClass=univentionMail)'
35
attributes=['mailMailQuota', 'mailPrimaryAddress']
36
37
import os, string, pwd, grp, sys, ldap, tempfile, posix
38
import listener
39
import univention_baseconfig
40
import univention.debug
41
42
def handler(dn, new, old):
43
    
44
    mail = new['mailPrimaryAddress'][0]
45
    quota = new['mailMailQuota'][0]
46
    quota = quota + "000"
47
    cyrus_user = 'cyrus'
48
    hostname = 'localhost'
49
50
    baseConfig = univention_baseconfig.baseConfig()
51
    baseConfig.load()
52
53
    try:
54
	if quota != '0':
55
	password=open('/etc/cyrus.secret').read()
56
	if password[-1] == '\n':
57
		password=password[0:-1]
58
59
	if baseConfig.has_key('mail/cyrus/murder/backend/hostname') and baseConfig['mail/cyrus/murder/backend/hostname']:
60
		hostname = baseConfig['mail/cyrus/murder/backend/hostname']
61
62
	child = spawn('/usr/bin/cyradm -u %s %s' % (cyrus_user, hostname))
63
	i=0
64
	while not i == 3:
65
		i = child.expect(['IMAP Password:', '>', 'cyradm: cannot connect to server', EOF], timeout=60)
66
		if i == 0:
67
			child.sendline(password)
68
		elif i == 1:
69
			child.sendline('setquota user/%s %s' % (mail, quota))
70
			child.sendline('disc')
71
			child.sendline('exit')
72
		elif i == 2:
73
			sys.exit(1)
74
    except:
75
	univention.debug.debug(univention.debug.LISTENER, univention.debug.ERROR, "MailQuota could not be set")

Return to bug 15220