14 commits - bin/kolab_parse_telemetry.py bin/kolab_smtp_access_policy.py configure.ac conf.py kolabd/__init__.py kolabd.py kolab.py kolabtest.py Makefile.am pykolab/auth pykolab/cli pykolab/conf pykolab/errors.py pykolab/imap pykolab/__init__.py pykolab/logger.py pykolab/Makefile.am pykolab/plugins pykolab/setup pykolab.spec.in pykolab/telemetry.py pykolab/tests pykolab/translate.py pykolab/utils.py saslauthd/__init__.py saslauthd.py setup-kolab.py
Jeroen van Meeuwen
vanmeeuwen at kolabsys.com
Sat Feb 11 14:43:37 CET 2012
Makefile.am | 7
bin/kolab_parse_telemetry.py | 9
bin/kolab_smtp_access_policy.py | 2
conf.py | 2
configure.ac | 12
kolab.py | 2
kolabd.py | 2
kolabd/__init__.py | 2
kolabtest.py | 2
pykolab.spec.in | 12
pykolab/Makefile.am | 6
pykolab/__init__.py | 2
pykolab/auth/__init__.py | 4
pykolab/auth/ldap/__init__.py | 2
pykolab/cli/__init__.py | 2
pykolab/cli/cmd_create_mailbox.py | 2
pykolab/cli/cmd_delete_mailbox.py | 2
pykolab/cli/cmd_export_mailbox.py | 2
pykolab/cli/cmd_list_deleted_mailboxes.py | 2
pykolab/cli/cmd_list_domains.py | 2
pykolab/cli/cmd_list_mailboxes.py | 2
pykolab/cli/cmd_sync.py | 2
pykolab/cli/cmd_undelete_mailbox.py | 2
pykolab/cli/commands.py | 2
pykolab/cli/telemetry/cmd_examine_command_issue.py | 2
pykolab/cli/telemetry/cmd_examine_session.py | 2
pykolab/cli/telemetry/cmd_expire_sessions.py | 2
pykolab/cli/telemetry/cmd_list_sessions.py | 2
pykolab/conf/__init__.py | 18 +
pykolab/conf/defaults.py | 2
pykolab/conf/entitlement.py | 265 +++++++++++++++++++++
pykolab/errors.py | 2
pykolab/imap/__init__.py | 5
pykolab/imap/cyrus.py | 2
pykolab/logger.py | 2
pykolab/plugins/__init__.py | 7
pykolab/plugins/defaultfolders/__init__.py | 2
pykolab/plugins/dynamicquota/__init__.py | 3
pykolab/plugins/recipientpolicy/__init__.py | 2
pykolab/setup/__init__.py | 2
pykolab/setup/components.py | 2
pykolab/setup/ldap_setup.py | 2
pykolab/setup/setup_ldap.py | 2
pykolab/telemetry.py | 15 -
pykolab/tests/__init__.py | 2
pykolab/tests/calendar.py | 2
pykolab/tests/constants.py | 2
pykolab/tests/contacts.py | 2
pykolab/tests/create-contacts.py | 2
pykolab/tests/mail.py | 2
pykolab/tests/zpush/__init__.py | 2
pykolab/tests/zpush/test_000_000.py | 2
pykolab/tests/zpush/test_000_001.py | 2
pykolab/translate.py | 2
pykolab/utils.py | 3
saslauthd.py | 2
saslauthd/__init__.py | 2
setup-kolab.py | 2
58 files changed, 386 insertions(+), 70 deletions(-)
New commits:
commit c62ce1d095ef694de120867555de692a54b5acd6
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Feb 11 14:43:17 2012 +0100
Add user parameter to be passed to the dynamicquota plugin
diff --git a/pykolab/plugins/dynamicquota/__init__.py b/pykolab/plugins/dynamicquota/__init__.py
index 549f144..d19a811 100644
--- a/pykolab/plugins/dynamicquota/__init__.py
+++ b/pykolab/plugins/dynamicquota/__init__.py
@@ -42,6 +42,7 @@ class KolabDynamicquota(object):
- used (integer, in KB)
- current quota (integer, in KB)
- quota (integer, in KB)
+ - user
"""
for keyword in [ 'used', 'current_quota', 'new_quota', 'default_quota' ]:
commit 57a618ec992e77e83aa4894fcc3431f83db119c8
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Feb 11 14:42:47 2012 +0100
Always return a return value, by default None, and only after all plugins have run
diff --git a/pykolab/plugins/__init__.py b/pykolab/plugins/__init__.py
index 6bfd627..2dff5b8 100644
--- a/pykolab/plugins/__init__.py
+++ b/pykolab/plugins/__init__.py
@@ -211,6 +211,8 @@ class KolabPlugins(object):
def exec_hook(self, hook, plugins=[], kw={}, args=()):
"""Execute a hook"""
+ retval = None
+
if len(plugins) < 1:
plugins = self.plugins.keys()
@@ -225,13 +227,14 @@ class KolabPlugins(object):
if hasattr(getattr(self,plugin),hook):
try:
log.debug(_("Executing hook %s for plugin %s") %(hook,plugin), level=8)
+ print "retval = self.%s.%s(%r, %r)" %(plugin,hook, args, kw)
exec("retval = self.%s.%s(*args, **kw)" %(plugin,hook))
except TypeError, e:
log.error(_("Cannot execute hook %s for plugin %s: %s") %(hook,plugin,e))
except AttributeError, e:
log.error(_("Cannot execute hook %s for plugin %s: %s") %(hook,plugin,e))
- return retval
+ return retval
def return_true_boolean_from_plugins(self, bool, plugins=[]):
"""Given the name of a boolean, walks all specified plugins, or all available plugins, and returns True if a plugin has it set to true"""
commit b81fd0b37408891a312483242d90ac82e112ce04
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Feb 11 14:41:48 2012 +0100
Pass the user along with the dynamicquota plugin, so it can recognize policies based on roles
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index d95b29f..da592c4 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -402,7 +402,8 @@ class IMAP(object):
'used': used,
'current_quota': current_quota,
'new_quota': (int)(quota),
- 'default_quota': (int)(default_quota)
+ 'default_quota': (int)(default_quota),
+ 'user': user
}
)
commit 159ec790e8fb0870f07a245bc36342feb57f22aa
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Feb 11 14:41:05 2012 +0100
Set the return value for "no setting" to None, not an arbitrary default value
diff --git a/pykolab/conf/__init__.py b/pykolab/conf/__init__.py
index 8010948..e6db94e 100644
--- a/pykolab/conf/__init__.py
+++ b/pykolab/conf/__init__.py
@@ -463,12 +463,12 @@ class Conf(object):
setting = self.get_raw(section, key)
if setting == None:
- return self.defaults.address_search_attrs
+ return None
raw_values = setting.split(',')
if raw_values == None:
- return self.defaults.address_search_attrs
+ return None
for raw_value in raw_values:
untrimmed_values.extend(raw_value.split(' '))
commit 01efa922ba167e930ed426c610d30ff3cfd4ae6f
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Feb 11 14:38:26 2012 +0100
Test for self._auth, but not as a dictionary
diff --git a/pykolab/auth/__init__.py b/pykolab/auth/__init__.py
index 8ca0863..2aee830 100644
--- a/pykolab/auth/__init__.py
+++ b/pykolab/auth/__init__.py
@@ -139,7 +139,7 @@ class Auth(object):
else:
section = domain
- if not self._auth.has_key(section) or self._auth == None:
+ if not self._auth or self._auth == None:
return
self._auth._disconnect()
commit 0424098e4173f44bd206ccb89c24e62545977f7c
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Feb 11 14:36:04 2012 +0100
Correct indentation to match check on whether attribute on self exists
diff --git a/pykolab/telemetry.py b/pykolab/telemetry.py
index 0b95da8..6dffefa 100644
--- a/pykolab/telemetry.py
+++ b/pykolab/telemetry.py
@@ -359,9 +359,9 @@ class TelemetryLog(object):
continue
- self.server_response[self.command_issue].append(
- server_response_line
- )
+ self.server_response[self.command_issue].append(
+ server_response_line
+ )
continue
commit 65b0905032e99caa7a16866f6b6a1f89400b0dc6
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Feb 11 14:33:28 2012 +0100
Flush stdout/stderr
diff --git a/pykolab/utils.py b/pykolab/utils.py
index a35c352..bd94a02 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -88,6 +88,7 @@ def ask_confirmation(question, default="y", all_inclusive_no=True):
else:
answer = False
print >> sys.stderr, _("Please answer 'yes' or 'no'.")
+ sys.stderr.flush()
def normalize(_object):
if type(_object) == list:
commit 94dc3f68914a9aaf3d2441f90b2577afde05cf4b
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Feb 11 14:33:01 2012 +0100
Catch sqlalchemy API incompatibility
diff --git a/bin/kolab_parse_telemetry.py b/bin/kolab_parse_telemetry.py
index cb447e8..ea4da25 100755
--- a/bin/kolab_parse_telemetry.py
+++ b/bin/kolab_parse_telemetry.py
@@ -41,7 +41,12 @@ from sqlalchemy import Text
from sqlalchemy import create_engine
from sqlalchemy.orm import mapper
-from sqlalchemy.orm import relationship
+
+try:
+ from sqlalchemy.orm import relationship
+except:
+ from sqlalchemy.orm import relation as relationship
+
try:
from sqlalchemy.orm import sessionmaker
except:
diff --git a/pykolab/telemetry.py b/pykolab/telemetry.py
index 345e49c..0b95da8 100644
--- a/pykolab/telemetry.py
+++ b/pykolab/telemetry.py
@@ -41,7 +41,12 @@ from sqlalchemy.interfaces import PoolListener
from sqlalchemy import create_engine
from sqlalchemy.orm import mapper
-from sqlalchemy.orm import relationship
+
+try:
+ from sqlalchemy.orm import relationship
+except:
+ from sqlalchemy.orm import relation as relationship
+
try:
from sqlalchemy.orm import sessionmaker
except:
commit 5fa5c3d1cf2cb04e96d47efa4bfcfcc0104e6834
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Feb 11 12:39:20 2012 +0100
Add stub imap_setup.py
diff --git a/pykolab/setup/imap_setup.py b/pykolab/setup/imap_setup.py
new file mode 100644
index 0000000..e69de29
commit 60fdb600d147557cd6c0fc2a530e9c54dd22f05b
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Feb 11 12:37:10 2012 +0100
Bump prerelease
diff --git a/configure.ac b/configure.ac
index 209f138..47a49fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_INIT([pykolab], 0.3)
-AC_SUBST([RELEASE], 0.13)
+AC_SUBST([RELEASE], 0.14)
AC_CONFIG_SRCDIR(pykolab/constants.py.in)
commit 2b94311d874a35a78acc44a0546fea50b62e2c7c
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Feb 11 12:36:42 2012 +0100
Add kolab-cli package contents
diff --git a/pykolab.spec.in b/pykolab.spec.in
index 7130e3b..7b408b6 100644
--- a/pykolab.spec.in
+++ b/pykolab.spec.in
@@ -25,7 +25,8 @@ URL: http://kolab.org/
Source0: http://files.kolab.org/releases/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildArch: noarch
-Requires: python-ldap
+Requires: kolab-cli = %{version}-%{release}
+Requires: python-ldap >= 2.4
Requires(pre): /usr/sbin/useradd
Requires(pre): /usr/sbin/usermod
Requires(pre): /usr/sbin/groupadd
@@ -179,9 +180,6 @@ rm -rf %{buildroot}
%files -f pykolab.lang
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING README README.tests
-%{_bindir}/*
-%{_sbindir}/kolab
-%{_sbindir}/kolab-conf
%attr(0640,root,kolab) %config(noreplace) %{_sysconfdir}/kolab/kolab.conf
%dir %{python_sitelib}/pykolab/
%exclude %{python_sitelib}/pykolab/telemetry.*
@@ -219,6 +217,12 @@ rm -rf %{buildroot}
%{python_sitelib}/pykolab/telemetry.*
%{python_sitelib}/pykolab/cli/telemetry/
+%files -n kolab-cli
+%defattr(-,root,root,-)
+%{_bindir}/*
+%{_sbindir}/kolab
+%{_sbindir}/kolab-conf
+
%files -n kolab-saslauthd
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING
commit adc24c02eb542c3032e072e09ed5c20cc0db94d1
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Wed Jan 4 13:14:50 2012 +0100
Update copyright
diff --git a/bin/kolab_parse_telemetry.py b/bin/kolab_parse_telemetry.py
index 546b10e..cb447e8 100755
--- a/bin/kolab_parse_telemetry.py
+++ b/bin/kolab_parse_telemetry.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/bin/kolab_smtp_access_policy.py b/bin/kolab_smtp_access_policy.py
index 5005455..a74d506 100755
--- a/bin/kolab_smtp_access_policy.py
+++ b/bin/kolab_smtp_access_policy.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/conf.py b/conf.py
index 08169ed..c0804d8 100755
--- a/conf.py
+++ b/conf.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/kolab.py b/kolab.py
index ca16b40..fd2c84d 100755
--- a/kolab.py
+++ b/kolab.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/kolabd.py b/kolabd.py
index 2c62e9a..ec77767 100755
--- a/kolabd.py
+++ b/kolabd.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/kolabd/__init__.py b/kolabd/__init__.py
index 95ef85a..47175e4 100644
--- a/kolabd/__init__.py
+++ b/kolabd/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/kolabtest.py b/kolabtest.py
index 504e493..6a348e8 100755
--- a/kolabtest.py
+++ b/kolabtest.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/__init__.py b/pykolab/__init__.py
index 9a36ef8..22bf88e 100644
--- a/pykolab/__init__.py
+++ b/pykolab/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/auth/__init__.py b/pykolab/auth/__init__.py
index 33084d4..8ca0863 100644
--- a/pykolab/auth/__init__.py
+++ b/pykolab/auth/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 202188e..c0cd60a 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/cli/__init__.py b/pykolab/cli/__init__.py
index a115271..cf2747c 100644
--- a/pykolab/cli/__init__.py
+++ b/pykolab/cli/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/cli/cmd_create_mailbox.py b/pykolab/cli/cmd_create_mailbox.py
index 5e0fb80..cd4655e 100644
--- a/pykolab/cli/cmd_create_mailbox.py
+++ b/pykolab/cli/cmd_create_mailbox.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/cli/cmd_delete_mailbox.py b/pykolab/cli/cmd_delete_mailbox.py
index e1bd11f..6b26372 100644
--- a/pykolab/cli/cmd_delete_mailbox.py
+++ b/pykolab/cli/cmd_delete_mailbox.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/cli/cmd_export_mailbox.py b/pykolab/cli/cmd_export_mailbox.py
index eaca347..eab89d0 100644
--- a/pykolab/cli/cmd_export_mailbox.py
+++ b/pykolab/cli/cmd_export_mailbox.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/cli/cmd_list_deleted_mailboxes.py b/pykolab/cli/cmd_list_deleted_mailboxes.py
index 3ca6991..f62bb3c 100644
--- a/pykolab/cli/cmd_list_deleted_mailboxes.py
+++ b/pykolab/cli/cmd_list_deleted_mailboxes.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/cli/cmd_list_domains.py b/pykolab/cli/cmd_list_domains.py
index 7018445..7a2bfd8 100644
--- a/pykolab/cli/cmd_list_domains.py
+++ b/pykolab/cli/cmd_list_domains.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/cli/cmd_list_mailboxes.py b/pykolab/cli/cmd_list_mailboxes.py
index f6f6e10..ae0444e 100644
--- a/pykolab/cli/cmd_list_mailboxes.py
+++ b/pykolab/cli/cmd_list_mailboxes.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/cli/cmd_sync.py b/pykolab/cli/cmd_sync.py
index ebb9cf3..14dd87d 100644
--- a/pykolab/cli/cmd_sync.py
+++ b/pykolab/cli/cmd_sync.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/cli/cmd_undelete_mailbox.py b/pykolab/cli/cmd_undelete_mailbox.py
index e4dec3a..1440943 100644
--- a/pykolab/cli/cmd_undelete_mailbox.py
+++ b/pykolab/cli/cmd_undelete_mailbox.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/cli/commands.py b/pykolab/cli/commands.py
index 2173ce0..ea083ed 100644
--- a/pykolab/cli/commands.py
+++ b/pykolab/cli/commands.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/cli/telemetry/cmd_examine_command_issue.py b/pykolab/cli/telemetry/cmd_examine_command_issue.py
index cceb5fe..f4248a0 100644
--- a/pykolab/cli/telemetry/cmd_examine_command_issue.py
+++ b/pykolab/cli/telemetry/cmd_examine_command_issue.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/cli/telemetry/cmd_examine_session.py b/pykolab/cli/telemetry/cmd_examine_session.py
index f36c0a9..a1273fd 100644
--- a/pykolab/cli/telemetry/cmd_examine_session.py
+++ b/pykolab/cli/telemetry/cmd_examine_session.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/cli/telemetry/cmd_expire_sessions.py b/pykolab/cli/telemetry/cmd_expire_sessions.py
index 2da1d3f..2066106 100644
--- a/pykolab/cli/telemetry/cmd_expire_sessions.py
+++ b/pykolab/cli/telemetry/cmd_expire_sessions.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/cli/telemetry/cmd_list_sessions.py b/pykolab/cli/telemetry/cmd_list_sessions.py
index d2c5293..1f6503e 100644
--- a/pykolab/cli/telemetry/cmd_list_sessions.py
+++ b/pykolab/cli/telemetry/cmd_list_sessions.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/conf/__init__.py b/pykolab/conf/__init__.py
index 69d592e..8010948 100644
--- a/pykolab/conf/__init__.py
+++ b/pykolab/conf/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/conf/defaults.py b/pykolab/conf/defaults.py
index e9c4088..22e8cc4 100644
--- a/pykolab/conf/defaults.py
+++ b/pykolab/conf/defaults.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/conf/entitlement.py b/pykolab/conf/entitlement.py
index 34c6353..6a85711 100644
--- a/pykolab/conf/entitlement.py
+++ b/pykolab/conf/entitlement.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/errors.py b/pykolab/errors.py
index 4df324f..d6547df 100644
--- a/pykolab/errors.py
+++ b/pykolab/errors.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index c22c370..d95b29f 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/imap/cyrus.py b/pykolab/imap/cyrus.py
index d072428..8141dce 100644
--- a/pykolab/imap/cyrus.py
+++ b/pykolab/imap/cyrus.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/logger.py b/pykolab/logger.py
index e154558..2a517a8 100644
--- a/pykolab/logger.py
+++ b/pykolab/logger.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/plugins/__init__.py b/pykolab/plugins/__init__.py
index 7844d95..6bfd627 100644
--- a/pykolab/plugins/__init__.py
+++ b/pykolab/plugins/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/plugins/defaultfolders/__init__.py b/pykolab/plugins/defaultfolders/__init__.py
index 43ff063..1d53406 100644
--- a/pykolab/plugins/defaultfolders/__init__.py
+++ b/pykolab/plugins/defaultfolders/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/plugins/dynamicquota/__init__.py b/pykolab/plugins/dynamicquota/__init__.py
index 2343ce2..549f144 100644
--- a/pykolab/plugins/dynamicquota/__init__.py
+++ b/pykolab/plugins/dynamicquota/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/plugins/recipientpolicy/__init__.py b/pykolab/plugins/recipientpolicy/__init__.py
index fd04e39..89f05d0 100644
--- a/pykolab/plugins/recipientpolicy/__init__.py
+++ b/pykolab/plugins/recipientpolicy/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/setup/__init__.py b/pykolab/setup/__init__.py
index df9bd07..74d410b 100644
--- a/pykolab/setup/__init__.py
+++ b/pykolab/setup/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/setup/components.py b/pykolab/setup/components.py
index 87f4e85..d13e21a 100644
--- a/pykolab/setup/components.py
+++ b/pykolab/setup/components.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/setup/ldap_setup.py b/pykolab/setup/ldap_setup.py
index 8e3bf7f..8349b16 100644
--- a/pykolab/setup/ldap_setup.py
+++ b/pykolab/setup/ldap_setup.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index e7ccb8a..59672c5 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/telemetry.py b/pykolab/telemetry.py
index 80959f3..345e49c 100644
--- a/pykolab/telemetry.py
+++ b/pykolab/telemetry.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/tests/__init__.py b/pykolab/tests/__init__.py
index cee3674..9b902be 100644
--- a/pykolab/tests/__init__.py
+++ b/pykolab/tests/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/tests/calendar.py b/pykolab/tests/calendar.py
index 99a79e6..f5b8f68 100644
--- a/pykolab/tests/calendar.py
+++ b/pykolab/tests/calendar.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/tests/constants.py b/pykolab/tests/constants.py
index 0a85299..6a9853f 100644
--- a/pykolab/tests/constants.py
+++ b/pykolab/tests/constants.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/tests/contacts.py b/pykolab/tests/contacts.py
index bc60bbd..156253c 100644
--- a/pykolab/tests/contacts.py
+++ b/pykolab/tests/contacts.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/tests/create-contacts.py b/pykolab/tests/create-contacts.py
index 6837f00..8b09a25 100644
--- a/pykolab/tests/create-contacts.py
+++ b/pykolab/tests/create-contacts.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Paul James Adams <adams a kolabsys.com>
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
diff --git a/pykolab/tests/mail.py b/pykolab/tests/mail.py
index a9888f8..4304149 100644
--- a/pykolab/tests/mail.py
+++ b/pykolab/tests/mail.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/tests/zpush/__init__.py b/pykolab/tests/zpush/__init__.py
index 62783f5..d0af89e 100644
--- a/pykolab/tests/zpush/__init__.py
+++ b/pykolab/tests/zpush/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/tests/zpush/test_000_000.py b/pykolab/tests/zpush/test_000_000.py
index 7cc2f62..d5197a3 100644
--- a/pykolab/tests/zpush/test_000_000.py
+++ b/pykolab/tests/zpush/test_000_000.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/tests/zpush/test_000_001.py b/pykolab/tests/zpush/test_000_001.py
index 204aba3..cadd9e5 100644
--- a/pykolab/tests/zpush/test_000_001.py
+++ b/pykolab/tests/zpush/test_000_001.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/translate.py b/pykolab/translate.py
index c4d5506..76f50b3 100644
--- a/pykolab/translate.py
+++ b/pykolab/translate.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/pykolab/utils.py b/pykolab/utils.py
index 284ccd1..a35c352 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/saslauthd.py b/saslauthd.py
index 40194c2..b24e0e3 100755
--- a/saslauthd.py
+++ b/saslauthd.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/saslauthd/__init__.py b/saslauthd/__init__.py
index 5b0e65f..1fa5e63 100644
--- a/saslauthd/__init__.py
+++ b/saslauthd/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
diff --git a/setup-kolab.py b/setup-kolab.py
index f8f9083..bbbb445 100755
--- a/setup-kolab.py
+++ b/setup-kolab.py
@@ -1,7 +1,7 @@
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
#
-# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
commit 6570fb06a787f3b3bf59d40e412105c0a9f4eedc
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Wed Jan 4 12:29:49 2012 +0100
Don't forget to try/except importing the Entitlements class, and then only fail afterwards
diff --git a/pykolab/conf/__init__.py b/pykolab/conf/__init__.py
index b078162..69d592e 100644
--- a/pykolab/conf/__init__.py
+++ b/pykolab/conf/__init__.py
@@ -48,14 +48,15 @@ class Conf(object):
self.entitlement = None
- from pykolab.conf.entitlement import Entitlement
- self.entitlement = Entitlement().get()
-
- #try:
- #from pykolab.conf.entitlement import Entitlement
- #self.entitlement = Entitlement().get()
- #except:
- #pass
+ try:
+ from pykolab.conf.entitlement import Entitlement
+ entitlements = True
+ except:
+ entitlements = False
+ pass
+
+ if entitlements:
+ self.entitlement = Entitlement().get()
self.plugins = None
commit 84b58bf324226ac321cee8726bb46d864318cb9e
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Wed Jan 4 12:17:26 2012 +0100
Add the framework for entitlements (there's no enforcement yet, but initialization fails if data does not check out)
diff --git a/Makefile.am b/Makefile.am
index 1e3db21..0fbe791 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -157,10 +157,15 @@ clean:
execdir = $(sbindir)
install-exec-local:
- mkdir -p $(DESTDIR)/$(sbindir) $(DESTDIR)/$(bindir) \
+ mkdir -p $(DESTDIR)/$(sbindir) \
+ $(DESTDIR)/$(bindir) \
+ $(DESTDIR)/$(sysconfdir)/kolab \
$(DESTDIR)/$(libexecdir)/postfix \
$(DESTDIR)/$(localstatedir)/lib/kolab \
$(DESTDIR)/$(localstatedir)/log/kolab
+if ENTERPRISE
+ mkdir -p $(DESTDIR)/$(sysconfdir)/kolab/entitlement.d
+endif
$(INSTALL) -p -m 755 conf.py $(DESTDIR)/$(sbindir)/kolab-conf
$(INSTALL) -p -m 755 kolab.py $(DESTDIR)/$(sbindir)/kolab
$(INSTALL) -p -m 755 kolabd.py $(DESTDIR)/$(sbindir)/kolabd
diff --git a/configure.ac b/configure.ac
index 8d219fe..209f138 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,6 +15,16 @@ AM_GLIB_GNU_GETTEXT
AC_PROG_INTLTOOL
AC_PROG_LN_S
+AC_ARG_ENABLE([enterprise],
+ [ --enable-enterprise Turn on entitlements, compile binary blob],
+ [case "${enableval}" in
+ yes) enterprise=true ;;
+ no) enterprise=false ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enterprise]) ;;
+ esac], [enterprise=false])
+
+AM_CONDITIONAL([ENTERPRISE], [test "${enterprise}" = "true"])
+
AC_SUBST(DATESTAMP,`date +"%a %b %d %Y"`)
AC_CONFIG_FILES([
diff --git a/pykolab/Makefile.am b/pykolab/Makefile.am
index 97fdec7..83a4ec3 100644
--- a/pykolab/Makefile.am
+++ b/pykolab/Makefile.am
@@ -22,6 +22,10 @@ pykolab_conf_PYTHON = \
conf/defaults.py \
conf/__init__.py
+if ENTERPRISE
+pykolab_conf_PYTHON += conf/entitlement.py
+endif
+
pykolab_imapdir = $(pythondir)/$(PACKAGE)/imap
pykolab_imap_PYTHON = \
imap/__init__.py \
@@ -50,7 +54,7 @@ pykolab_setup_PYTHON = \
setup/ldap_setup.py
pykolab_testsdir = $(pythondir)/$(PACKAGE)/tests
-pykolab_setup_PYTHON = \
+pykolab_tests_PYTHON = \
tests/calendar.py \
tests/constants.py \
tests/contacts.py \
diff --git a/pykolab/conf/__init__.py b/pykolab/conf/__init__.py
index 1e4c82a..b078162 100644
--- a/pykolab/conf/__init__.py
+++ b/pykolab/conf/__init__.py
@@ -46,6 +46,17 @@ class Conf(object):
self.cli_args = None
self.cli_keywords = None
+ self.entitlement = None
+
+ from pykolab.conf.entitlement import Entitlement
+ self.entitlement = Entitlement().get()
+
+ #try:
+ #from pykolab.conf.entitlement import Entitlement
+ #self.entitlement = Entitlement().get()
+ #except:
+ #pass
+
self.plugins = None
# The location where our configuration parser is going to end up
diff --git a/pykolab/conf/entitlement.py b/pykolab/conf/entitlement.py
new file mode 100644
index 0000000..34c6353
--- /dev/null
+++ b/pykolab/conf/entitlement.py
@@ -0,0 +1,265 @@
+# -*- coding: utf-8 -*-
+# Copyright 2010-2011 Kolab Systems AG (http://www.kolabsys.com)
+#
+# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 3 or, at your option, any later version
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+from ConfigParser import ConfigParser
+import hashlib
+import OpenSSL
+import os
+import StringIO
+import subprocess
+import sys
+
+from pykolab.translate import _
+
+import pykolab
+log = pykolab.getLogger('pykolab.conf')
+
+class Entitlement(object):
+ def __init__(self, *args, **kw):
+ self.entitlement = {}
+
+ self.entitlement_files = []
+
+ ca_cert_file = '/etc/pki/tls/certs/mirror.kolabsys.com.ca.cert'
+ customer_cert_file = '/etc/pki/tls/private/mirror.kolabsys.com.client.pem'
+ customer_key_file = '/etc/pki/tls/private/mirror.kolabsys.com.client.pem'
+
+ # Licence lock and key verification.
+ self.entitlement_verification = [
+ 'f700660f456a60c92ab2f00d0f1968230920d89829d42aa27d30f678',
+ '95783ba5521ea54aa3a32b7949f145aa5015a4c9e92d12b9e4c95c14'
+ ]
+
+ if os.access(ca_cert_file, os.R_OK):
+ # Verify /etc/kolab/mirror_ca.crt
+ ca_cert = OpenSSL.crypto.load_certificate(
+ OpenSSL.SSL.FILETYPE_PEM,
+ open(ca_cert_file).read()
+ )
+
+ if (bool)(ca_cert.has_expired()):
+ raise Exception, _("Invalid entitlement verification " + \
+ "certificate at %s" %(ca_cert_file))
+
+ # TODO: Check validity and warn ~1-2 months in advance.
+
+ ca_cert_issuer = ca_cert.get_issuer()
+ ca_cert_subject = ca_cert.get_subject()
+
+ ca_cert_issuer_hash = subprocess.Popen(
+ [
+ 'openssl',
+ 'x509',
+ '-in',
+ ca_cert_file,
+ '-noout',
+ '-issuer_hash'
+ ],
+ stdout=subprocess.PIPE
+ ).communicate()[0].strip()
+
+ ca_cert_issuer_hash_digest = hashlib.sha224(ca_cert_issuer_hash).hexdigest()
+
+ if not ca_cert_issuer_hash_digest in self.entitlement_verification:
+ raise Exception, _("Invalid entitlement verification " + \
+ "certificate at %s") %(ca_cert_file)
+
+ ca_cert_subject_hash = subprocess.Popen(
+ [
+ 'openssl',
+ 'x509',
+ '-in',
+ ca_cert_file,
+ '-noout',
+ '-subject_hash'
+ ],
+ stdout=subprocess.PIPE
+ ).communicate()[0].strip()
+
+ ca_cert_subject_hash_digest = hashlib.sha224(ca_cert_subject_hash).hexdigest()
+
+ if not ca_cert_subject_hash_digest in self.entitlement_verification:
+ raise Exception, _("Invalid entitlement verification " + \
+ "certificate at %s") %(ca_cert_file)
+
+ customer_cert_issuer_hash = subprocess.Popen(
+ [
+ 'openssl',
+ 'x509',
+ '-in',
+ customer_cert_file,
+ '-noout',
+ '-issuer_hash'
+ ],
+ stdout=subprocess.PIPE
+ ).communicate()[0].strip()
+
+ customer_cert_issuer_hash_digest = hashlib.sha224(customer_cert_issuer_hash).hexdigest()
+
+ if not customer_cert_issuer_hash_digest in self.entitlement_verification:
+ raise Exception, _("Invalid entitlement verification " + \
+ "certificate at %s") %(customer_cert_file)
+
+ if not ca_cert_issuer.countryName == ca_cert_subject.countryName:
+ raise Exception, _("Invalid entitlement certificate")
+
+ if not ca_cert_issuer.organizationName == ca_cert_subject.organizationName:
+ raise Exception, _("Invalid entitlement certificate")
+
+ if os.path.isdir('/etc/kolab/entitlement.d/') and \
+ os.access('/etc/kolab/entitlement.d/', os.R_OK):
+
+ for root, dirs, files in os.walk('/etc/kolab/entitlement.d/'):
+ if not root == '/etc/kolab/entitlement.d/':
+ continue
+ for entitlement_file in files:
+ log.debug(_("Parsing entitlement file %s") %(entitlement_file), level=8)
+
+ if os.access(os.path.join(root, entitlement_file), os.R_OK):
+ self.entitlement_files.append(
+ os.path.join(root, entitlement_file)
+ )
+
+ else:
+ print >> sys.stderr, \
+ _("License file %s not readable!") %(
+ os.path.join(root, entitlement_file)
+ )
+
+ else:
+ print >> sys.stderr, _("No entitlement directory found")
+
+ for entitlement_file in self.entitlement_files:
+
+ decrypt_command = [
+ 'openssl',
+ 'smime',
+ '-decrypt',
+ '-recip',
+ customer_cert_file,
+ '-in',
+ entitlement_file
+ ]
+
+ decrypt_process = subprocess.Popen(
+ decrypt_command,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE
+ )
+
+ verify_command = [
+ 'openssl',
+ 'smime',
+ '-verify',
+ '-certfile',
+ ca_cert_file,
+ '-CAfile',
+ ca_cert_file,
+ '-inform',
+ 'DER'
+ ]
+
+ verify_process = subprocess.Popen(
+ verify_command,
+ stdin=decrypt_process.stdout,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE
+ )
+
+ (stdout, stderr) = verify_process.communicate()
+ license = License(stdout, self.entitlement)
+ license.verify_certificate(customer_cert_file)
+ self.entitlement = license.get()
+
+ else:
+ print "Error reading entitlement certificate authority file"
+
+ def get(self):
+ if len(self.entitlement.keys()) == 0:
+ return None
+ else:
+ return self.entitlement
+
+class License(object):
+ entitlement = {}
+
+ def __init__(self, new_entitlement, existing_entitlement):
+ self.parser = ConfigParser()
+ fp = StringIO.StringIO(new_entitlement)
+ self.parser.readfp(fp)
+
+ self.entitlement['users'] = self.parser.get('kolab_entitlements', 'users')
+ self.entitlement['margin'] = self.parser.get('kolab_entitlements', 'margin')
+
+ def verify_certificate(self, customer_cert_file):
+ # Verify the certificate section as well.
+ cert_serial = self.parser.get('mirror_ca', 'serial_number')
+ cert_issuer_hash = self.parser.get('mirror_ca', 'issuer_hash')
+ cert_subject_hash = self.parser.get('mirror_ca', 'subject_hash')
+
+ customer_cert_serial = subprocess.Popen(
+ [
+ 'openssl',
+ 'x509',
+ '-in',
+ customer_cert_file,
+ '-noout',
+ '-serial'
+ ],
+ stdout=subprocess.PIPE
+ ).communicate()[0].strip().split('=')[1]
+
+ if not customer_cert_serial == cert_serial:
+ raise Exception, _("Invalid entitlement verification " + \
+ "certificate at %s") %(customer_cert_file)
+
+ customer_cert_issuer_hash = subprocess.Popen(
+ [
+ 'openssl',
+ 'x509',
+ '-in',
+ customer_cert_file,
+ '-noout',
+ '-issuer_hash'
+ ],
+ stdout=subprocess.PIPE
+ ).communicate()[0].strip()
+
+ if not customer_cert_issuer_hash == cert_issuer_hash:
+ raise Exception, _("Invalid entitlement verification " + \
+ "certificate at %s") %(customer_cert_file)
+
+ customer_cert_subject_hash = subprocess.Popen(
+ [
+ 'openssl',
+ 'x509',
+ '-in',
+ customer_cert_file,
+ '-noout',
+ '-subject_hash'
+ ],
+ stdout=subprocess.PIPE
+ ).communicate()[0].strip()
+
+ if not customer_cert_subject_hash == cert_subject_hash:
+ raise Exception, _("Invalid entitlement verification " + \
+ "certificate at %s") %(customer_cert_file)
+
+ def get(self):
+ return self.entitlement
More information about the commits
mailing list