summaryrefslogtreecommitdiffstats
path: root/src/providers/ipa/ipa_subdomains_id.c
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2013-12-02 13:03:33 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-06-02 19:07:57 +0200
commit5cd660aaa885bca95ac3dca660bb77e5786d5f8e (patch)
tree6450720de4fdbf7a26465c65c2ccc395fbb9b64e /src/providers/ipa/ipa_subdomains_id.c
parentbe7eabee6b7eb8def2441bf5de4c6d4950c155bf (diff)
downloadsssd-5cd660aaa885bca95ac3dca660bb77e5786d5f8e.tar.gz
sssd-5cd660aaa885bca95ac3dca660bb77e5786d5f8e.tar.xz
sssd-5cd660aaa885bca95ac3dca660bb77e5786d5f8e.zip
NSS: Refactor expand_homedir_template
Function expand_homedir_template had lot of parameters. After adding new expand option, all function call should be rewritten, (usually argument NULL will be added) This patch wraps all necessary arguments to structure.
Diffstat (limited to 'src/providers/ipa/ipa_subdomains_id.c')
-rw-r--r--src/providers/ipa/ipa_subdomains_id.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/providers/ipa/ipa_subdomains_id.c b/src/providers/ipa/ipa_subdomains_id.c
index 21e9f85a1..8657f90fa 100644
--- a/src/providers/ipa/ipa_subdomains_id.c
+++ b/src/providers/ipa/ipa_subdomains_id.c
@@ -366,10 +366,10 @@ get_subdomain_homedir_of_user(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom,
const char **_homedir)
{
errno_t ret;
- char *name;
- char *lc_name;
+ const char *name;
const char *homedir;
TALLOC_CTX *tmp_ctx;
+ struct sss_nss_homedir_ctx homedir_ctx;
tmp_ctx = talloc_new(mem_ctx);
if (tmp_ctx == NULL) {
@@ -377,22 +377,27 @@ get_subdomain_homedir_of_user(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom,
goto done;
}
- ret = sss_parse_name(tmp_ctx, dom->names, fqname, NULL, &name);
+ ZERO_STRUCT(homedir_ctx);
+
+ homedir_ctx.uid = uid;
+ homedir_ctx.domain = dom->name;
+ homedir_ctx.flatname = dom->flat_name;
+ ret = sss_parse_name_const(tmp_ctx, dom->names, fqname,
+ NULL, &name);
if (ret != EOK) {
goto done;
}
/* To be compatible with the old winbind based user lookups and IPA
* clients the user name in the home directory path will be lower-case. */
- lc_name = sss_tc_utf8_str_tolower(tmp_ctx, name);
- if (lc_name == NULL) {
- ret =ENOMEM;
+ homedir_ctx.username = sss_tc_utf8_str_tolower(tmp_ctx, name);
+ if (homedir_ctx.username == NULL) {
+ ret = ENOMEM;
goto done;
}
- homedir = expand_homedir_template(tmp_ctx, dom->subdomain_homedir, lc_name,
- uid, NULL, dom->name, dom->flat_name);
-
+ homedir = expand_homedir_template(tmp_ctx, dom->subdomain_homedir,
+ &homedir_ctx);
if (homedir == NULL) {
DEBUG(SSSDBG_OP_FAILURE, "expand_homedir_template failed\n");
ret = ENOMEM;