From 8ad91b74b6c4b8a9cc3605bbe26aba1324d8270e Mon Sep 17 00:00:00 2001 From: System User Date: Thu, 2 Dec 2010 17:58:56 +0100 Subject: [PATCH] cn => dn Default configuration --- config | 19 ++++++++++++++++++- radicale/acl/authLdap.py | 9 +++++---- radicale/config.py | 10 +++++++++- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/config b/config index d04b3da..36df1fa 100644 --- a/config +++ b/config @@ -27,7 +27,7 @@ stock = utf-8 [acl] # Access method -# Value: fake | htpasswd +# Value: fake | htpasswd | authLdap type = fake # Personal calendars only available for logged in users (if needed) personal = False @@ -37,9 +37,26 @@ filename = /etc/radicale/users # Value: plain | sha1 | crypt encryption = crypt +[authLdap] +#LDAP Host +LDAPServer = 127.0.0.1 +#Fields to create a LDAP bind +#Value to add before the user name in a LDAP bind +LDAPPrepend = uid= +#Value to add after the user name in a LDAP bind +LDAPAppend = ou=users,dc=exmaple,dc=dom +#=> uid=corentin,ou=users,dc=exmaple,dc=dom + [storage] # Folder for storing local calendars, # created if not present folder = ~/.config/radicale/calendars +[logging] +# Full path of logfile +file = ~/.config/radicale/radicale.log +# Logging messages which are less severe than level will be ignored +# Log level are (debug, info, warning, error, critical) +level = error + # vim:ft=cfg diff --git a/radicale/acl/authLdap.py b/radicale/acl/authLdap.py index d7c08e6..385528b 100644 --- a/radicale/acl/authLdap.py +++ b/radicale/acl/authLdap.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -import sys, ldap +import sys, ldap, syslog -from radicale import config +from radicale import config, log def has_right(owner, user, password): if user == None: @@ -13,10 +13,11 @@ def has_right(owner, user, password): return False try: l=ldap.open(LDAPSERVER, 389) - cn="%s%s,%s" % (LDAPPREPEND, user, LDAPAPPEND) - l.simple_bind_s(cn, password); + dn="%s%s,%s" % (LDAPPREPEND, user, LDAPAPPEND) + l.simple_bind_s(dn, password); return True except: + log.error(sys.exc_info()[0]) return False LDAPSERVER = config.get("authLdap", "LDAPServer") diff --git a/radicale/config.py b/radicale/config.py index 1cf9dd6..509b5f9 100644 --- a/radicale/config.py +++ b/radicale/config.py @@ -56,7 +56,15 @@ INITIAL_CONFIG = { "filename": "/etc/radicale/users", "encryption": "crypt"}, "storage": { - "folder": os.path.expanduser("~/.config/radicale/calendars")}} + "folder": os.path.expanduser("~/.config/radicale/calendars")}, + "authLdap": { + "LDAPServer": "127.0.0.1", + "LDAPPrepend": "uid=", + "LDAPAppend": "ou=users,dc=example,dc=com"}, + "logging": { + "file": os.path.expanduser("~/.config/radicale/radicale.log"), + "level": "error"} + } # Create a ConfigParser and configure it _CONFIG_PARSER = ConfigParser()