summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorPavel Reichl <preichl@redhat.com>2014-09-23 09:41:38 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-10-12 18:50:26 +0200
commitadf9c23d663c308cfeeaa5ad0a33c399c85b27ec (patch)
tree44bae197f293312a842705cb0aa3461edb179e19 /src/util
parentdaa3dd779fbaec36142d112f8a47c7b9f23177c1 (diff)
downloadsssd-adf9c23d663c308cfeeaa5ad0a33c399c85b27ec.tar.gz
sssd-adf9c23d663c308cfeeaa5ad0a33c399c85b27ec.tar.xz
sssd-adf9c23d663c308cfeeaa5ad0a33c399c85b27ec.zip
NSS: UPN as a template expansion for homedir mappings
Fixes: https://fedorahosted.org/sssd/ticket/2340 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/sss_nss.c11
-rw-r--r--src/util/sss_nss.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/util/sss_nss.c b/src/util/sss_nss.c
index 8cc1416d7..208b57842 100644
--- a/src/util/sss_nss.c
+++ b/src/util/sss_nss.c
@@ -147,6 +147,17 @@ char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template,
homedir_ctx->config_homedir_substr);
break;
+ case 'P':
+ if (homedir_ctx->upn == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Cannot expand user principal name template "
+ "string is empty.\n");
+ goto done;
+ }
+ result = talloc_asprintf_append(result, "%s%s", p,
+ homedir_ctx->upn);
+ break;
+
case '%':
result = talloc_asprintf_append(result, "%s%%", p);
break;
diff --git a/src/util/sss_nss.h b/src/util/sss_nss.h
index 19bf26589..30359fc7c 100644
--- a/src/util/sss_nss.h
+++ b/src/util/sss_nss.h
@@ -32,6 +32,7 @@ struct sss_nss_homedir_ctx {
const char *domain;
const char *flatname;
const char *config_homedir_substr;
+ const char *upn;
};
char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template,