Branch 'pykolab-0.5' - 18 commits - configure.ac .gitignore pykolab/auth pykolab/cli pykolab/imap pykolab/setup pykolab/utils.py
Jeroen van Meeuwen
vanmeeuwen at kolabsys.com
Fri Nov 23 18:10:55 CET 2012
.gitignore | 2
configure.ac | 2
pykolab/auth/ldap/__init__.py | 11 ++++
pykolab/auth/ldap/cache.py | 4 +
pykolab/cli/__init__.py | 9 +++
pykolab/cli/cmd_list_mailbox_acls.py | 2
pykolab/cli/cmd_list_mailbox_metadata.py | 30 +++++++++++
pykolab/cli/cmd_set_mailbox_metadata.py | 28 ++++++++++
pykolab/cli/commands.py | 10 +++
pykolab/imap/__init__.py | 7 ++
pykolab/setup/components.py | 3 +
pykolab/setup/setup_imap.py | 16 +++---
pykolab/setup/setup_mysql.py | 80 +++++++++++++++++++------------
pykolab/utils.py | 46 +++++++++++++++++
14 files changed, 208 insertions(+), 42 deletions(-)
New commits:
commit 2dc7ba51c66cd90d0f5248a44c4a0fce36aa003e
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Fri Nov 23 17:10:11 2012 +0000
Set version to 0.5.7
diff --git a/configure.ac b/configure.ac
index 425ae8f..f4cfd3d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([pykolab], 0.5.6)
+AC_INIT([pykolab], 0.5.7)
AC_SUBST([RELEASE], 1)
AC_CONFIG_SRCDIR(pykolab/constants.py.in)
commit 665a63e301135eda680f8904c7d211aef96284dc
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Thu Nov 22 09:29:54 2012 +0000
Provide a mechanism to select a process in which an existing MySQL server is used (#1177)
diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py
index 0536304..8d419ad 100644
--- a/pykolab/setup/setup_mysql.py
+++ b/pykolab/setup/setup_mysql.py
@@ -58,33 +58,54 @@ def execute(*args, **kw):
log.error(_("Could not configure to start on boot, the " + \
"MySQL database service."))
- print >> sys.stderr, utils.multiline_message(
- _("""
- Please supply a root password for MySQL. This password will
- be the administrative user for this MySQL server, and it
- should be kept a secret. After this setup process has
- completed, Kolab is going to discard and forget about this
- password, but you will need it for administrative tasks in
- MySQL.
- """)
- )
-
- mysql_root_password = utils.ask_question(
- _("MySQL root password"),
- default=utils.generate_password(),
- password=True,
- confirm=True
- )
-
- p1 = subprocess.Popen(['echo', 'UPDATE mysql.user SET Password=PASSWORD(\'%s\') WHERE User=\'root\';' % (mysql_root_password)], stdout=subprocess.PIPE)
- p2 = subprocess.Popen(['mysql'], stdin=p1.stdout)
- p1.stdout.close()
- p2.communicate()
-
- p1 = subprocess.Popen(['echo', 'FLUSH PRIVILEGES;'], stdout=subprocess.PIPE)
- p2 = subprocess.Popen(['mysql'], stdin=p1.stdout)
- p1.stdout.close()
- p2.communicate()
+ options = {
+ 1: "Existing MySQL server (with root password already set).",
+ 2: "New MySQL server (needs to be initialized)."
+ }
+
+ answer = utils.ask_menu(_("What MySQL server are we setting up?"), options)
+
+ if answer == "1" or answer == 1:
+ print >> sys.stderr, utils.multiline_message(
+ _("""
+ Please supply the root password for MySQL, so we can set
+ up user accounts for other components that use MySQL.
+ """)
+ )
+
+ mysql_root_password = utils.ask_question(
+ _("MySQL root password"),
+ password=True
+ )
+
+ else:
+ print >> sys.stderr, utils.multiline_message(
+ _("""
+ Please supply a root password for MySQL. This password
+ will be the administrative user for this MySQL server,
+ and it should be kept a secret. After this setup process
+ has completed, Kolab is going to discard and forget
+ about this password, but you will need it for
+ administrative tasks in MySQL.
+ """)
+ )
+
+ mysql_root_password = utils.ask_question(
+ _("MySQL root password"),
+ default=utils.generate_password(),
+ password=True,
+ confirm=True
+ )
+
+ p1 = subprocess.Popen(['echo', 'UPDATE mysql.user SET Password=PASSWORD(\'%s\') WHERE User=\'root\';' % (mysql_root_password)], stdout=subprocess.PIPE)
+ p2 = subprocess.Popen(['mysql'], stdin=p1.stdout)
+ p1.stdout.close()
+ p2.communicate()
+
+ p1 = subprocess.Popen(['echo', 'FLUSH PRIVILEGES;'], stdout=subprocess.PIPE)
+ p2 = subprocess.Popen(['mysql'], stdin=p1.stdout)
+ p1.stdout.close()
+ p2.communicate()
data = """
[mysql]
diff --git a/pykolab/utils.py b/pykolab/utils.py
index 61fed07..448aaba 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -123,6 +123,32 @@ def ask_confirmation(question, default="y", all_inclusive_no=True):
else:
return True
+def ask_menu(question, options={}):
+ print question
+ answer_correct = False
+ max_key_length = 0
+
+ keys = options.keys()
+ keys.sort()
+
+ while not answer_correct:
+ for key in keys:
+ key_length = len("%s" % key)
+ if key_length > max_key_length:
+ max_key_length = key_length
+
+ str_format = "%%%ds" % max_key_length
+
+ for key in keys:
+ print " - " + eval("str_format % key") + ": " + options[key]
+
+ answer = raw_input(_("Choice") + ": ")
+
+ if answer in [str(x) for x in options.keys()]:
+ answer_correct = True
+
+ return answer
+
def ensure_directory(_dir, _user='root', _group='root'):
if not os.path.isdir(_dir):
os.makedirs(_dir)
commit 1c1639f08e1ead98a39de35459c448d232ba1c05
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Thu Nov 22 08:59:13 2012 +0000
Remove /tmp/kolab-setup-my.cnf after setup, and chmod it 0600 before writing out anything relevant.
diff --git a/pykolab/setup/components.py b/pykolab/setup/components.py
index f12fe84..d280372 100644
--- a/pykolab/setup/components.py
+++ b/pykolab/setup/components.py
@@ -201,6 +201,9 @@ def execute(component_name, *args, **kw):
components[component_name]['function'](conf.cli_args, kw)
+ if os.path.exists('/tmp/kolab-setup-my.cnf'):
+ os.unlink('/tmp/kolab-setup-my.cnf')
+
def register_group(dirname, module):
components_base_path = os.path.join(os.path.dirname(__file__), module)
diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py
index c956eeb..0536304 100644
--- a/pykolab/setup/setup_mysql.py
+++ b/pykolab/setup/setup_mysql.py
@@ -56,8 +56,8 @@ def execute(*args, **kw):
subprocess.call(['/usr/sbin/update-rc.d', 'mysql', 'defaults'])
else:
log.error(_("Could not configure to start on boot, the " + \
- "MySQL database service."))
-
+ "MySQL database service."))
+
print >> sys.stderr, utils.multiline_message(
_("""
Please supply a root password for MySQL. This password will
@@ -93,6 +93,7 @@ password='%s'
""" % (mysql_root_password)
fp = open('/tmp/kolab-setup-my.cnf', 'w')
+ os.chmod('/tmp/kolab-setup-my.cnf', 0600)
fp.write(data)
fp.close()
commit d9092312a66776a4480c11f63f6559c5c934d428
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Wed Nov 21 13:50:29 2012 +0000
Add an option --user to allow list-mailbox-metadata and set-mailbox-metadata to be performed on behalf of the user (thus includes private annotations)
diff --git a/pykolab/cli/cmd_list_mailbox_metadata.py b/pykolab/cli/cmd_list_mailbox_metadata.py
index 87fe1b0..b430896 100644
--- a/pykolab/cli/cmd_list_mailbox_metadata.py
+++ b/pykolab/cli/cmd_list_mailbox_metadata.py
@@ -17,6 +17,8 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
+import sys
+
import commands
import pykolab
@@ -31,6 +33,17 @@ conf = pykolab.getConf()
def __init__():
commands.register('list_mailbox_metadata', execute, description=description())
+def cli_options():
+ my_option_group = conf.add_cli_parser_option_group(_("CLI Options"))
+ my_option_group.add_option(
+ '--user',
+ dest = "user",
+ action = "store",
+ default = None,
+ metavar = "USER",
+ help = _("List annotations as user USER")
+ )
+
def description():
return """Obtain a list of metadata entries on a folder."""
@@ -42,11 +55,26 @@ def execute(*args, **kw):
if len(folder.split('@')) > 1:
domain = folder.split('@')[1]
+ elif not conf.user == None and len(conf.user.split('@')) > 1:
+ domain = conf.user.split('@')[1]
else:
domain = conf.get('kolab', 'primary_domain')
imap = IMAP()
- imap.connect(domain=domain)
+
+ if not conf.user == None:
+ imap.connect(domain=domain, login=False)
+
+ backend = conf.get(domain, 'imap_backend')
+ if backend == None:
+ backend = conf.get('kolab', 'imap_backend')
+
+ admin_login = conf.get(backend, 'admin_login')
+ admin_password = conf.get(backend, 'admin_password')
+
+ imap.login_plain(admin_login, admin_password, conf.user)
+ else:
+ imap.connect(domain=domain)
if not imap.has_folder(folder):
print >> sys.stderr, _("No such folder %r") % (folder)
diff --git a/pykolab/cli/cmd_set_mailbox_metadata.py b/pykolab/cli/cmd_set_mailbox_metadata.py
index 9aa9b4e..2cade85 100644
--- a/pykolab/cli/cmd_set_mailbox_metadata.py
+++ b/pykolab/cli/cmd_set_mailbox_metadata.py
@@ -33,6 +33,17 @@ conf = pykolab.getConf()
def __init__():
commands.register('set_mailbox_metadata', execute, description=description())
+def cli_options():
+ my_option_group = conf.add_cli_parser_option_group(_("CLI Options"))
+ my_option_group.add_option(
+ '--user',
+ dest = "user",
+ action = "store",
+ default = None,
+ metavar = "USER",
+ help = _("Set annotation as user USER")
+ )
+
def description():
return """Set an metadata entry on a folder."""
@@ -57,11 +68,26 @@ def execute(*args, **kw):
if len(folder.split('@')) > 1:
domain = folder.split('@')[1]
+ elif not conf.user == None and len(conf.user.split('@')) > 1:
+ domain = conf.user.split('@')[1]
else:
domain = conf.get('kolab', 'primary_domain')
imap = IMAP()
- imap.connect(domain=domain)
+
+ if not conf.user == None:
+ imap.connect(domain=domain, login=False)
+
+ backend = conf.get(domain, 'imap_backend')
+ if backend == None:
+ backend = conf.get('kolab', 'imap_backend')
+
+ admin_login = conf.get(backend, 'admin_login')
+ admin_password = conf.get(backend, 'admin_password')
+
+ imap.login_plain(admin_login, admin_password, conf.user)
+ else:
+ imap.connect(domain=domain)
if not imap.has_folder(folder):
print >> sys.stderr, _("No such folder %r") % (folder)
commit bae001371d7af80a1c1a432cb4f7111fcd9d6348
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Tue Nov 20 14:18:19 2012 +0000
Ignore *.orig and *.rej
diff --git a/.gitignore b/.gitignore
index a697154..3789b55 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,8 +3,10 @@ Makefile.in
*~
*.kate-swp
*.log
+*.orig
*.pyc
*.pyo
+*.rej
*.spec
*.tar.gz
aclocal.m4
commit 0e813970edc8e2c92ace7076db24a1ce8a0386f2
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Wed Nov 21 13:47:37 2012 +0000
Restart the Kolab SASL Authentication daemon before restarting the Cyrus IMAP daemon
diff --git a/pykolab/setup/setup_imap.py b/pykolab/setup/setup_imap.py
index 4cf883d..9862320 100644
--- a/pykolab/setup/setup_imap.py
+++ b/pykolab/setup/setup_imap.py
@@ -137,29 +137,29 @@ def execute(*args, **kw):
myaugeas.set(setting,'yes')
myaugeas.save()
myaugeas.close()
-
+
if os.path.isfile('/bin/systemctl'):
- subprocess.call(['systemctl', 'restart', 'cyrus-imapd.service'])
subprocess.call(['systemctl', 'restart', 'kolab-saslauthd.service'])
+ subprocess.call(['systemctl', 'restart', 'cyrus-imapd.service'])
elif os.path.isfile('/sbin/service'):
- subprocess.call(['service', 'cyrus-imapd', 'restart'])
subprocess.call(['service', 'kolab-saslauthd', 'restart'])
+ subprocess.call(['service', 'cyrus-imapd', 'restart'])
elif os.path.isfile('/usr/sbin/service'):
- subprocess.call(['/usr/sbin/service','cyrus-imapd','restart'])
subprocess.call(['/usr/sbin/service','kolab-saslauthd','restart'])
+ subprocess.call(['/usr/sbin/service','cyrus-imapd','restart'])
else:
log.error(_("Could not start the cyrus-imapd and kolab-saslauthd services."))
if os.path.isfile('/bin/systemctl'):
- subprocess.call(['systemctl', 'enable', 'cyrus-imapd.service'])
subprocess.call(['systemctl', 'enable', 'kolab-saslauthd.service'])
+ subprocess.call(['systemctl', 'enable', 'cyrus-imapd.service'])
elif os.path.isfile('/sbin/chkconfig'):
- subprocess.call(['chkconfig', 'cyrus-imapd', 'on'])
subprocess.call(['chkconfig', 'kolab-saslauthd', 'on'])
+ subprocess.call(['chkconfig', 'cyrus-imapd', 'on'])
elif os.path.isfile('/usr/sbin/update-rc.d'):
- subprocess.call(['/usr/sbin/update-rc.d', 'cyrus-imapd', 'defaults'])
subprocess.call(['/usr/sbin/update-rc.d', 'kolab-saslauthd', 'defaults'])
subprocess.call(['/usr/sbin/update-rc.d', 'saslauthd', 'disable'])
+ subprocess.call(['/usr/sbin/update-rc.d', 'cyrus-imapd', 'defaults'])
else:
log.error(_("Could not configure to start on boot, the " + \
- "cyrus-imapd and kolab-saslauthd services."))
+ "cyrus-imapd and kolab-saslauthd services."))
commit 45ef0a03924aa756075a92a6f0ce15c1f0ca8bff
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Wed Nov 21 10:13:11 2012 +0000
Ensure the mailbox name is lower-cased upon creation
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 391714d..68f0c78 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -347,6 +347,13 @@ class IMAP(object):
Returns the full path to the new mailbox folder.
"""
+ # TODO: Whether or not to lowercase the mailbox name is really up to the
+ # IMAP server setting username_tolower (normalize_uid, lmtp_downcase_rcpt).
+
+ if not mailbox_base_name == mailbox_base_name.lower():
+ log.warning(_("Downcasing mailbox name %r") % (mailbox_base_name))
+ mailbox_base_name = mailbox_base_name.lower()
+
folder_name = "user%s%s" % (self.imap.separator, mailbox_base_name)
log.info(_("Creating new mailbox for user %s") %(mailbox_base_name))
commit c5fccafe358a47029a074dae2c64987fa633b234
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Tue Nov 20 14:17:13 2012 +0000
import sys (#1317)
diff --git a/pykolab/cli/cmd_list_mailbox_acls.py b/pykolab/cli/cmd_list_mailbox_acls.py
index 7f4a9fc..62bac4f 100644
--- a/pykolab/cli/cmd_list_mailbox_acls.py
+++ b/pykolab/cli/cmd_list_mailbox_acls.py
@@ -17,6 +17,8 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
+import sys
+
import commands
import pykolab
commit 51adf1dc6680802eda24bd077f314ee60c7c96b2
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Tue Nov 13 12:25:55 2012 +0000
pop the correctly indexed argument off the list
diff --git a/pykolab/cli/__init__.py b/pykolab/cli/__init__.py
index 9c5f4b5..aa054c0 100644
--- a/pykolab/cli/__init__.py
+++ b/pykolab/cli/__init__.py
@@ -59,7 +59,7 @@ class Cli(object):
to_execute.append(sys.argv[arg_num].replace('-','_'))
for cmd_component in to_execute:
- sys.argv.pop(sys.argv.index(cmd_component))
+ sys.argv.pop(sys.argv.index(cmd_component.replace('_','-')))
commands.execute('_'.join(to_execute))
commit ce7282b78e4784faff9fb4df2a5ebe3077915db6
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Mon Nov 12 12:10:45 2012 +0000
No looking at conf.cli_args for command components anymore
diff --git a/pykolab/cli/commands.py b/pykolab/cli/commands.py
index d2f6d82..c559ac0 100644
--- a/pykolab/cli/commands.py
+++ b/pykolab/cli/commands.py
@@ -139,7 +139,6 @@ def execute(cmd_name, *args, **kw):
pass
conf.finalize_conf()
- _cmd_name = conf.cli_args.pop(0)
commands[cmd_name]['function'](conf.cli_args, kw)
def register_group(dirname, module):
commit 32c5a63c26e625cbcbddc54ea59042bb44a2579b
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Mon Nov 12 12:10:26 2012 +0000
Eject the cli components from sys.argv
diff --git a/pykolab/cli/__init__.py b/pykolab/cli/__init__.py
index 5860fd9..9c5f4b5 100644
--- a/pykolab/cli/__init__.py
+++ b/pykolab/cli/__init__.py
@@ -58,6 +58,9 @@ class Cli(object):
to_execute.append(sys.argv[arg_num].replace('-','_'))
+ for cmd_component in to_execute:
+ sys.argv.pop(sys.argv.index(cmd_component))
+
commands.execute('_'.join(to_execute))
def run(self):
commit 62559e19643cfeccc1088a30b652b462bbf7b405
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Nov 10 17:03:32 2012 +0000
Supply your very basic "does this value represent True or False?" function
diff --git a/pykolab/utils.py b/pykolab/utils.py
index c74759b..61fed07 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -369,6 +369,26 @@ def translate(mystring, locale_name='en_US'):
return result
+def true_or_false(val):
+ if val == None:
+ return False
+
+ if isinstance(val, bool):
+ return val
+
+ if isinstance(val, basestring) or isinstance(val, str):
+ val = val.lower()
+ if val in [ "true", "yes", "y" ]:
+ return True
+ else:
+ return False
+
+ if isinstance(val, int) or isinstance(val, float):
+ if val >= 1:
+ return True
+ else:
+ return False
+
def is_service(services):
"""
Checks each item in list services to see if it has a RC script in
commit 8ce72466d98609702d33c7dfa257e9dc384009ed
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Nov 10 17:02:40 2012 +0000
Allow a grouped command to be executed like so:
$ kolab sieve list
diff --git a/pykolab/cli/__init__.py b/pykolab/cli/__init__.py
index a51a3aa..5860fd9 100644
--- a/pykolab/cli/__init__.py
+++ b/pykolab/cli/__init__.py
@@ -51,6 +51,12 @@ class Cli(object):
if not arg.startswith('-') and len(sys.argv) >= arg_num:
if commands.commands.has_key(sys.argv[arg_num].replace('-','_')):
to_execute.append(sys.argv[arg_num].replace('-','_'))
+
+ if commands.commands.has_key("%s_%s" % (
+ '_'.join(to_execute),sys.argv[arg_num].replace('-','_')
+ )):
+
+ to_execute.append(sys.argv[arg_num].replace('-','_'))
commands.execute('_'.join(to_execute))
commit adb0fdbb232381df04303681b1474c501c2354af
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Nov 10 16:26:03 2012 +0000
Display help if an unknown command is specified (and do not bail out on --help).
Fix typo
diff --git a/pykolab/cli/commands.py b/pykolab/cli/commands.py
index 7376234..d2f6d82 100644
--- a/pykolab/cli/commands.py
+++ b/pykolab/cli/commands.py
@@ -108,6 +108,10 @@ def list_commands(*args, **kw):
print "%-4s%-21s" % ('',__command.replace('_','-'))
def execute(cmd_name, *args, **kw):
+ if cmd_name == "":
+ execute("help")
+ sys.exit(0)
+
if not commands.has_key(cmd_name):
log.error(_("No such command."))
sys.exit(1)
@@ -190,7 +194,7 @@ def register(cmd_name, func, group=None, description=None, aliases=[]):
commands[alias] = {
'cmd_name': cmd_name,
'function': func,
- 'description': _("Alias for %s") % (cmd_name,replace('_','-'))
+ 'description': _("Alias for %s") % (cmd_name.replace('_','-'))
}
##
commit 62b1fc94377f6ff303d51d18974bf088460412e4
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Nov 10 16:24:32 2012 +0000
Exclude group commands from the upper-level list of commands.
diff --git a/pykolab/cli/commands.py b/pykolab/cli/commands.py
index 21c2bb4..7376234 100644
--- a/pykolab/cli/commands.py
+++ b/pykolab/cli/commands.py
@@ -85,6 +85,9 @@ def list_commands(*args, **kw):
_commands.sort()
for _command in _commands:
+ if __commands[_command].has_key('group'):
+ continue
+
if __commands[_command].has_key('function'):
# This is a top-level command
if not __commands[_command]['description'] == None:
commit f171957f373c1dc316389f99635145135f58369b
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Nov 10 16:23:32 2012 +0000
Fix names of commands referred to in the description of alias commands.
diff --git a/pykolab/cli/commands.py b/pykolab/cli/commands.py
index 6dedc6c..21c2bb4 100644
--- a/pykolab/cli/commands.py
+++ b/pykolab/cli/commands.py
@@ -187,7 +187,7 @@ def register(cmd_name, func, group=None, description=None, aliases=[]):
commands[alias] = {
'cmd_name': cmd_name,
'function': func,
- 'description': _("Alias for %s") % (cmd_name)
+ 'description': _("Alias for %s") % (cmd_name,replace('_','-'))
}
##
commit 9163470b761af3c3f046176226b9400dcb42d00e
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Nov 10 01:57:01 2012 +0000
Make sure the result_attribute dict key exists
diff --git a/pykolab/auth/ldap/cache.py b/pykolab/auth/ldap/cache.py
index 8bdeebe..503c3c5 100644
--- a/pykolab/auth/ldap/cache.py
+++ b/pykolab/auth/ldap/cache.py
@@ -107,6 +107,10 @@ def get_entry(domain, entry):
if _entry == None:
log.debug(_("Inserting cache entry %r") % (entry['id']), level=8)
+
+ if not entry.has_key(result_attribute):
+ entry[result_attribute] = ''
+
db.add(
Entry(
entry['id'],
commit 63196ecfd572970595e8d7853388a59de60267ad
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sat Nov 10 01:56:45 2012 +0000
Bind the new connection before operating against it
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 67657f5..620c5ef 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1992,6 +1992,11 @@ class LDAP(pykolab.base.Base):
callback=self._synchronize_callback
)
+ bind_dn = self.config_get('bind_dn')
+ bind_pw = self.config_get('bind_pw')
+
+ ldap_sync_conn.simple_bind_s(bind_dn, bind_pw)
+
msgid = ldap_sync_conn.syncrepl_search(
base_dn,
scope,
@@ -2082,6 +2087,12 @@ class LDAP(pykolab.base.Base):
if SUPPORTED_LDAP_CONTROLS[control_num]['oid'] in \
supported_controls:
+ log.debug(_("Found support for %s") % (
+ SUPPORTED_LDAP_CONTROLS[control_num]['desc'],
+ ),
+ level=8
+ )
+
self.ldap.supported_controls.append(
SUPPORTED_LDAP_CONTROLS[control_num]['func']
)
More information about the commits
mailing list