diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2013-12-08 06:33:58 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2015-06-07 02:51:16 +0200 |
commit | 185cf14065554038820c696e7d35f47017b43783 (patch) | |
tree | ffbd2d4cdb8760a93b98acb4631dc6c116c21480 /lib/openldap | |
parent | 65586b40e5f8eb50d3cba27051dfc57e504b632f (diff) |
bugfix
Diffstat (limited to 'lib/openldap')
-rw-r--r-- | lib/openldap | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/openldap b/lib/openldap index 2cc55db..0a8df96 100644 --- a/lib/openldap +++ b/lib/openldap @@ -36,6 +36,7 @@ indexedAttributes = frozenset([ 'olcAccess', 'olcSyncrepl', 'olcOverlay', + 'olcLimits', ]) @@ -164,6 +165,11 @@ def processEntry(module, l, dn, entry): changed = True if module.check_mode: module.exit_json(changed=changed, msg="add DN %s" % dn) + if 'olcAccess' in entry.keys(): + # replace "username=...,cn=peercred,cn=external,cn=auth" + # by a DN with proper gidNumber and uidNumber + entry['olcAccess'] = map ( partial(sasl_ext_re.sub, acl_sasl_ext) + , entry['olcAccess'] ) l.add_s( dn, addModlist(entry) ) else: d,e = r @@ -233,12 +239,12 @@ def loadModule(module, l, name): # Find the database associated with a given attribute (eg, # olcDbDirectory or olcSuffix). -def getDN_DB(module, l, a, v): +def getDN_DB(module, l, a, v, attrlist=['']): f = filter_format( '(&(objectClass=olcDatabaseConfig)('+a+'=%s))', [v] ) return l.search_s( 'cn=config' , ldap.SCOPE_ONELEVEL , filterstr = f - , attrlist = [''] ) + , attrlist = attrlist ) # Clear the given DB directory and delete the associated database. Fail @@ -253,7 +259,7 @@ def removeDB(module, dbdir, skipdn=None): l = ldap.initialize( 'ldapi://' ) l.sasl_interactive_bind_s('', ldap.sasl.external()) - r = getDN_DB( module, l, 'olcDbDirectory', dbdir ) + r = getDN_DB( module, l, 'olcDbDirectory', dbdir, attrlist=['olcSuffix'] ) l.unbind_s() if len(r) > 1: @@ -368,7 +374,7 @@ def main(): elif state == "present": if form == 'slapd.conf': if name is None: - module.fail_json(msg="name") + module.fail_json(msg="missing name") target = slapd_to_ldif(target, name) if target is None and mod is None: |