diff options
author | Sumit Bose <sbose@redhat.com> | 2015-01-21 12:35:00 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-01-21 16:12:42 +0100 |
commit | ba818cc39dfe94c2b8613f4badf7912811f0f737 (patch) | |
tree | 022a7a69efb8dfbf7265468c083b173a7dd863f3 /src | |
parent | 858e750c3d4fe54e50616a1ed1e101469503c070 (diff) | |
download | sssd-ba818cc39dfe94c2b8613f4badf7912811f0f737.tar.gz sssd-ba818cc39dfe94c2b8613f4badf7912811f0f737.tar.xz sssd-ba818cc39dfe94c2b8613f4badf7912811f0f737.zip |
views: fix GID overrride for mpg domains
When adding a user sysdb internally adds a value to SYSDB_GIDNUM for
mpg domain which might cause conflicts with the one we added to users
git GID overrides. With this patch the override GID is added after the
user is created but in the same transaction
Releted to https://fedorahosted.org/sssd/ticket/2514
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/providers/ipa/ipa_s2n_exop.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c index e7c2d9bb9..a9c2f1ae3 100644 --- a/src/providers/ipa/ipa_s2n_exop.c +++ b/src/providers/ipa/ipa_s2n_exop.c @@ -1748,6 +1748,7 @@ static errno_t ipa_s2n_save_objects(struct sss_domain_info *dom, char **del_groups_dns; bool in_transaction = false; int tret; + struct sysdb_attrs *gid_override_attrs = NULL; tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { @@ -1939,7 +1940,16 @@ static errno_t ipa_s2n_save_objects(struct sss_domain_info *dom, if (ret == EOK || ret == ENOENT) { if ((orig_gid != 0 && orig_gid != attrs->a.user.pw_gid) || attrs->a.user.pw_uid != attrs->a.user.pw_gid) { - ret = sysdb_attrs_add_uint32(attrs->sysdb_attrs, + + gid_override_attrs = sysdb_new_attrs(tmp_ctx); + if (gid_override_attrs == NULL) { + DEBUG(SSSDBG_OP_FAILURE, + "sysdb_new_attrs failed.\n"); + ret = ENOMEM; + goto done; + } + + ret = sysdb_attrs_add_uint32(gid_override_attrs, SYSDB_GIDNUM, attrs->a.user.pw_gid); if (ret != EOK) { @@ -1973,6 +1983,15 @@ static errno_t ipa_s2n_save_objects(struct sss_domain_info *dom, goto done; } + if (gid_override_attrs != NULL) { + ret = sysdb_set_user_attr(dom, name, gid_override_attrs, + SYSDB_MOD_REP); + if (ret != EOK) { + DEBUG(SSSDBG_OP_FAILURE, "sysdb_set_user_attr failed.\n"); + goto done; + } + } + if (attrs->response_type == RESP_USER_GROUPLIST) { ret = get_sysdb_grouplist(tmp_ctx, dom->sysdb, dom, name, &sysdb_grouplist); |