We were setting the GID of migrated users to that of the default user's group (ipausers) when it should have been the same as the UID unless UPG was disabled.

This does the right thing and fixes migration which was broken when we made ipausers a non-posix group.

rob
>From f1c96bc7ed0d96332daf206bc8bf6cc6a2bc6871 Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcrit...@redhat.com>
Date: Tue, 28 Feb 2012 17:34:14 -0500
Subject: [PATCH] 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
---
 ipalib/plugins/migration.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ipalib/plugins/migration.py b/ipalib/plugins/migration.py
index ab4e523..fb8ddd0 100644
--- a/ipalib/plugins/migration.py
+++ b/ipalib/plugins/migration.py
@@ -128,7 +128,8 @@ def _pre_migrate_user(ldap, pkey, dn, entry_attrs, failed, config, ctx, **kwargs
         except errors.NotFound:
             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():
+            ctx['def_group_gid'] = g_attrs['gidnumber'][0]
 
     # fill in required attributes by IPA
     entry_attrs['ipauniqueid'] = 'autogenerate'
@@ -137,7 +138,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():
-- 
1.7.6

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to