diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 6af892b03..afa81127d 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -865,6 +865,7 @@ def app_install(operation_logger, app, label=None, args=None, no_remove_on_failu os.path.join(extracted_app_folder, 'scripts/remove'), args=[app_instance_name], env=env_dict_remove )[0] + # Here again, calling hook_exec could fail miserably, or get # manually interrupted (by mistake or because script was stuck) # In that case we still want to proceed with the rest of the diff --git a/src/yunohost/ssh.py b/src/yunohost/ssh.py index f0110b34e..be876ce16 100644 --- a/src/yunohost/ssh.py +++ b/src/yunohost/ssh.py @@ -25,7 +25,7 @@ def user_ssh_allow(username): from yunohost.utils.ldap import _get_ldap_interface ldap = _get_ldap_interface() - ldap.update('uid=%s,ou=users' % username, {'loginShell': '/bin/bash'}) + ldap.update('uid=%s,ou=users' % username, {'loginShell': ['/bin/bash']}) # Somehow this is needed otherwise the PAM thing doesn't forget about the # old loginShell value ? @@ -46,7 +46,7 @@ def user_ssh_disallow(username): from yunohost.utils.ldap import _get_ldap_interface ldap = _get_ldap_interface() - ldap.update('uid=%s,ou=users' % username, {'loginShell': '/bin/false'}) + ldap.update('uid=%s,ou=users' % username, {'loginShell': ['/bin/false']}) # Somehow this is needed otherwise the PAM thing doesn't forget about the # old loginShell value ? diff --git a/src/yunohost/tools.py b/src/yunohost/tools.py index d5fab2fb1..75a27aa66 100644 --- a/src/yunohost/tools.py +++ b/src/yunohost/tools.py @@ -88,15 +88,15 @@ def tools_ldapinit(): logger.warn("Error when trying to inject '%s' -> '%s' into ldap: %s" % (rdn, attr_dict, e)) admin_dict = { - 'cn': 'admin', - 'uid': 'admin', - 'description': 'LDAP Administrator', - 'gidNumber': '1007', - 'uidNumber': '1007', - 'homeDirectory': '/home/admin', - 'loginShell': '/bin/bash', + 'cn': ['admin'], + 'uid': ['admin'], + 'description': ['LDAP Administrator'], + 'gidNumber': ['1007'], + 'uidNumber': ['1007'], + 'homeDirectory': ['/home/admin'], + 'loginShell': ['/bin/bash'], 'objectClass': ['organizationalRole', 'posixAccount', 'simpleSecurityObject'], - 'userPassword': 'yunohost' + 'userPassword': ['yunohost'] } ldap.update('cn=admin', admin_dict) @@ -140,7 +140,7 @@ def tools_adminpw(new_password, check_strength=True): ldap = _get_ldap_interface() try: - ldap.update("cn=admin", {"userPassword": new_hash, }) + ldap.update("cn=admin", {"userPassword": [ new_hash ], }) except: logger.exception('unable to change admin password') raise YunohostError('admin_password_change_failed') diff --git a/src/yunohost/user.py b/src/yunohost/user.py index ed2a44670..d19da177c 100644 --- a/src/yunohost/user.py +++ b/src/yunohost/user.py @@ -178,19 +178,19 @@ def user_create(operation_logger, username, firstname, lastname, mail, password, fullname = '%s %s' % (firstname, lastname) attr_dict = { 'objectClass': ['mailAccount', 'inetOrgPerson', 'posixAccount', 'userPermissionYnh'], - 'givenName': firstname, - 'sn': lastname, - 'displayName': fullname, - 'cn': fullname, - 'uid': username, - 'mail': mail, - 'maildrop': username, - 'mailuserquota': mailbox_quota, - 'userPassword': _hash_user_password(password), - 'gidNumber': uid, - 'uidNumber': uid, - 'homeDirectory': '/home/' + username, - 'loginShell': '/bin/false' + 'givenName': [firstname], + 'sn': [lastname], + 'displayName': [fullname], + 'cn': [fullname], + 'uid': [username], + 'mail': mail, # NOTE: this one seems to be already a list + 'maildrop': [username], + 'mailuserquota': [mailbox_quota], + 'userPassword': [_hash_user_password(password)], + 'gidNumber': [uid], + 'uidNumber': [uid], + 'homeDirectory': ['/home/' + username], + 'loginShell': ['/bin/false'] } # If it is the first user, add some aliases @@ -316,21 +316,21 @@ def user_update(operation_logger, username, firstname=None, lastname=None, mail= # Get modifications from arguments new_attr_dict = {} if firstname: - new_attr_dict['givenName'] = firstname # TODO: Validate - new_attr_dict['cn'] = new_attr_dict['displayName'] = firstname + ' ' + user['sn'][0] + new_attr_dict['givenName'] = [firstname] # TODO: Validate + new_attr_dict['cn'] = new_attr_dict['displayName'] = [firstname + ' ' + user['sn'][0]] if lastname: - new_attr_dict['sn'] = lastname # TODO: Validate - new_attr_dict['cn'] = new_attr_dict['displayName'] = user['givenName'][0] + ' ' + lastname + new_attr_dict['sn'] = [lastname] # TODO: Validate + new_attr_dict['cn'] = new_attr_dict['displayName'] = [user['givenName'][0] + ' ' + lastname] if lastname and firstname: - new_attr_dict['cn'] = new_attr_dict['displayName'] = firstname + ' ' + lastname + new_attr_dict['cn'] = new_attr_dict['displayName'] = [firstname + ' ' + lastname] if change_password: # Ensure sufficiently complex password assert_password_is_strong_enough("user", change_password) - new_attr_dict['userPassword'] = _hash_user_password(change_password) + new_attr_dict['userPassword'] = [_hash_user_password(change_password)] if mail: main_domain = _get_maindomain() @@ -395,7 +395,7 @@ def user_update(operation_logger, username, firstname=None, lastname=None, mail= new_attr_dict['maildrop'] = user['maildrop'] if mailbox_quota is not None: - new_attr_dict['mailuserquota'] = mailbox_quota + new_attr_dict['mailuserquota'] = [mailbox_quota] operation_logger.start()