diff options
Diffstat (limited to 'src/providers/ipa/ipa_s2n_exop.c')
-rw-r--r-- | src/providers/ipa/ipa_s2n_exop.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c index 004cdab6..1a81c860 100644 --- a/src/providers/ipa/ipa_s2n_exop.c +++ b/src/providers/ipa/ipa_s2n_exop.c @@ -446,7 +446,12 @@ static errno_t s2n_response_to_attrs(TALLOC_CTX *mem_ctx, goto done; } - attrs->a.user.pw_name = talloc_strdup(attrs, name); + /* Winbind is not consistent with the case of the returned user + * name. In general all names should be lower case but there are + * bug in some version of winbind which might lead to upper case + * letters in the name. To be on the safe side we explicitly + * lowercase the name. */ + attrs->a.user.pw_name = sss_tc_utf8_str_tolower(attrs, name); if (attrs->a.user.pw_name == NULL) { DEBUG(SSSDBG_OP_FAILURE, ("talloc_strdup failed.\n")); ret = ENOMEM; @@ -585,6 +590,7 @@ static void ipa_s2n_get_user_done(struct tevent_req *subreq) time_t now; uint64_t timeout = 10*60*60; /* FIXME: find a better timeout ! */ const char *homedir = NULL; + struct sysdb_attrs *user_attrs = NULL; ret = ipa_s2n_exop_recv(subreq, state, &result, &retoid, &retdata); talloc_zfree(subreq); @@ -627,11 +633,25 @@ static void ipa_s2n_get_user_done(struct tevent_req *subreq) } } + user_attrs = sysdb_new_attrs(state); + if (user_attrs == NULL) { + DEBUG(SSSDBG_OP_FAILURE, ("sysdb_new_attrs failed.\n")); + ret = ENOMEM; + goto done; + } + + ret = sysdb_attrs_add_string(user_attrs, SYSDB_NAME_ALIAS, + attrs->a.user.pw_name); + if (ret != EOK) { + DEBUG(SSSDBG_OP_FAILURE, ("sysdb_attrs_add_string failed.\n")); + goto done; + } + ret = sysdb_store_domuser(state->dom, attrs->a.user.pw_name, NULL, attrs->a.user.pw_uid, 0, NULL, /* gecos */ homedir, NULL, - NULL, NULL, timeout, now); + user_attrs, NULL, timeout, now); break; case RESP_GROUP: ret = sysdb_store_domgroup(state->dom, attrs->a.group.gr_name, @@ -647,6 +667,7 @@ static void ipa_s2n_get_user_done(struct tevent_req *subreq) done: + talloc_free(user_attrs); if (ret == EOK) { tevent_req_done(req); } else { |