mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-04 00:17:06 +00:00
fix python error "cannot pickle 'dict_keys' object"
a deep copy of a dictionary with values of type `dict_keys`, required by the underlying ldap3 python3 library, is no longer allowed. they must be a `list` type actual error: Traceback (most recent call last): File "/mailinabox/setup/migrate.py", line 461, in <module> run_miabldap_migrations() File "/mailinabox/setup/migrate.py", line 440, in run_miabldap_migrations raise e File "/mailinabox/setup/migrate.py", line 431, in run_miabldap_migrations migration_func(env) File "/mailinabox/setup/migrate.py", line 249, in migration_miabldap_1 users=m13.create_users(env, conn, ldap, ldap_base, ldap_users_base, ldap_domains_base) File "/mailinabox/setup/migration_13.py", line 137, in create_users dn = add_user(env, ldapconn, ldap_base, ldap_users_base, ldap_domains_base, email, password, privs.split("\n"), totp) File "/mailinabox/setup/migration_13.py", line 90, in add_user ldapconn.add(dn, objectClasses, attrs) File "/usr/lib/python3/dist-packages/ldap3/core/connection.py", line 947, in add _attributes = deepcopy(attributes) # dict could change when adding objectClass values File "/usr/lib/python3.10/copy.py", line 146, in deepcopy y = copier(x, memo) File "/usr/lib/python3.10/copy.py", line 231, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/usr/lib/python3.10/copy.py", line 161, in deepcopy rv = reductor(4) TypeError: cannot pickle 'dict_keys' object
This commit is contained in:
parent
d87148292e
commit
80decc3f71
@ -52,7 +52,7 @@ def add_user(env, ldapconn, search_base, users_base, domains_base, email, passwo
|
||||
for priv in privs:
|
||||
if priv.strip() != '': privs_uniq[priv] = True
|
||||
if len(privs_uniq) > 0:
|
||||
attrs['mailaccess'] = privs_uniq.keys()
|
||||
attrs['mailaccess'] = list(privs_uniq.keys())
|
||||
|
||||
# Get a common name
|
||||
localpart, domainpart = email.split("@")
|
||||
@ -238,7 +238,7 @@ def add_permitted_senders_group(ldapconn, users_base, group_base, source, permit
|
||||
ldapconn.add(group_dn, [ "mailGroup" ], {
|
||||
"cn" : gid,
|
||||
"mail" : source,
|
||||
"member" : permitted_dn.keys(),
|
||||
"member" : list(permitted_dn.keys()),
|
||||
"description": "Permitted to MAIL FROM this address"
|
||||
})
|
||||
except ldap3.core.exceptions.LDAPEntryAlreadyExistsResult:
|
||||
|
Loading…
Reference in New Issue
Block a user