diff options
author | Rob Crittenden <rcritten@redhat.com> | 2012-02-28 17:34:14 -0500 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-02-29 18:05:31 +0100 |
commit | e294f79488aee881e636b6a3c0565287c26da65d (patch) | |
tree | 12860e23987294a6693a2e1f01afc96b09dd5bd2 | |
parent | 1356988b7a40a60af39807db143860efb4a2f435 (diff) | |
download | freeipa-e294f79488aee881e636b6a3c0565287c26da65d.tar.gz freeipa-e294f79488aee881e636b6a3c0565287c26da65d.tar.xz freeipa-e294f79488aee881e636b6a3c0565287c26da65d.zip |
Don't set migrated user's GID to that of default users group.
The GID should be the UID unless UPG is disabled.
https://fedorahosted.org/freeipa/ticket/2430
-rw-r--r-- | ipalib/plugins/migration.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ipalib/plugins/migration.py b/ipalib/plugins/migration.py index 884ae4ed6..82100ee35 100644 --- a/ipalib/plugins/migration.py +++ b/ipalib/plugins/migration.py @@ -119,9 +119,13 @@ def _pre_migrate_user(ldap, pkey, dn, entry_attrs, failed, config, ctx, **kwargs try: (g_dn, g_attrs) = ldap.get_entry(ctx['def_group_dn'], ['gidnumber']) except errors.NotFound: - error_msg = 'Default group for new users not found.' + error_msg = _('Default group for new users not found.') raise errors.NotFound(reason=error_msg) - ctx['def_group_gid'] = g_attrs['gidnumber'][0] + if not ldap.has_upg(): + if 'gidnumber' in g_attrs: + ctx['def_group_gid'] = g_attrs['gidnumber'][0] + else: + raise errors.NotFound(reason=_('User Private Groups are disabled and the default users group is not POSIX')) # fill in required attributes by IPA entry_attrs['ipauniqueid'] = 'autogenerate' @@ -130,7 +134,8 @@ def _pre_migrate_user(ldap, pkey, dn, entry_attrs, failed, config, ctx, **kwargs home_dir = '%s/%s' % (homes_root, pkey) home_dir = home_dir.replace('//', '/').rstrip('/') entry_attrs['homedirectory'] = home_dir - entry_attrs.setdefault('gidnumber', ctx['def_group_gid']) + if 'def_group_gid' in ctx: + entry_attrs.setdefault('gidnumber', ctx['def_group_gid']) # do not migrate all attributes for attr in entry_attrs.keys(): |