summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-04-04 13:03:23 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-04-10 13:38:44 +0200
commit6fc4702a3037d9bb5b27bcb58f70edf1802b7b19 (patch)
treee0470eba6e749d3b5d10dabf98d1acfdce89007c /src
parent591b0325f5d6f70ae71e61a8c563b437acfb1884 (diff)
downloadsssd-6fc4702a3037d9bb5b27bcb58f70edf1802b7b19.tar.gz
sssd-6fc4702a3037d9bb5b27bcb58f70edf1802b7b19.tar.bz2
sssd-6fc4702a3037d9bb5b27bcb58f70edf1802b7b19.zip
Allow using flatname for subdomain home dir template
https://fedorahosted.org/sssd/ticket/1609
Diffstat (limited to 'src')
-rw-r--r--src/man/sssd.conf.5.xml10
-rw-r--r--src/providers/ipa/ipa_s2n_exop.c3
-rw-r--r--src/responder/nss/nsssrv_cmd.c10
-rw-r--r--src/responder/pac/pacsrv_utils.c2
-rw-r--r--src/util/sss_nss.c14
-rw-r--r--src/util/sss_nss.h3
6 files changed, 33 insertions, 9 deletions
diff --git a/src/man/sssd.conf.5.xml b/src/man/sssd.conf.5.xml
index 7bcccee8..6a1292c6 100644
--- a/src/man/sssd.conf.5.xml
+++ b/src/man/sssd.conf.5.xml
@@ -1638,7 +1638,15 @@ override_homedir = /home/%u
<para>
Use this homedir as default value for all subdomains
within this domain. See <emphasis>override_homedir</emphasis>
- for info about possible values.
+ for info about possible values. In addition to those, the
+ expansion below can only be used with
+ <emphasis>subdomain_homedir</emphasis>.
+ <variablelist>
+ <varlistentry>
+ <term>%F</term>
+ <listitem><para>flat (NetBIOS) name of a subdomain.</para></listitem>
+ </varlistentry>
+ </variablelist>
</para>
<para>
The value can be overridden by
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
index 7e5d0c14..64ee7752 100644
--- a/src/providers/ipa/ipa_s2n_exop.c
+++ b/src/providers/ipa/ipa_s2n_exop.c
@@ -624,7 +624,8 @@ static void ipa_s2n_get_user_done(struct tevent_req *subreq)
attrs->a.user.pw_name,
attrs->a.user.pw_uid,
NULL,
- state->dom->name);
+ state->dom->name,
+ state->dom->flat_name);
if (homedir == NULL) {
ret = ENOMEM;
goto done;
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index c391ed53..df7255bb 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -183,10 +183,10 @@ static const char *get_homedir_override(TALLOC_CTX *mem_ctx,
*/
if (dom->override_homedir) {
return expand_homedir_template(mem_ctx, dom->override_homedir,
- name, uid, homedir, dom->name);
+ name, uid, homedir, dom->name, NULL);
} else if (nctx->override_homedir) {
return expand_homedir_template(mem_ctx, nctx->override_homedir,
- name, uid, homedir, dom->name);
+ name, uid, homedir, dom->name, NULL);
}
if (!homedir || *homedir == '\0') {
@@ -195,10 +195,12 @@ static const char *get_homedir_override(TALLOC_CTX *mem_ctx,
*/
if (dom->fallback_homedir) {
return expand_homedir_template(mem_ctx, dom->fallback_homedir,
- name, uid, homedir, dom->name);
+ name, uid, homedir,
+ dom->name, NULL);
} else if (nctx->fallback_homedir) {
return expand_homedir_template(mem_ctx, nctx->fallback_homedir,
- name, uid, homedir, dom->name);
+ name, uid, homedir,
+ dom->name, NULL);
}
}
diff --git a/src/responder/pac/pacsrv_utils.c b/src/responder/pac/pacsrv_utils.c
index 824daa62..c868b107 100644
--- a/src/responder/pac/pacsrv_utils.c
+++ b/src/responder/pac/pacsrv_utils.c
@@ -796,7 +796,7 @@ errno_t get_pwd_from_pac(TALLOC_CTX *mem_ctx,
if (dom->subdomain_homedir) {
pwd->pw_dir = expand_homedir_template(pwd, dom->subdomain_homedir,
lname, pwd->pw_uid, NULL,
- dom->name);
+ dom->name, dom->flat_name);
if (pwd->pw_dir == NULL) {
ret = ENOMEM;
goto done;
diff --git a/src/util/sss_nss.c b/src/util/sss_nss.c
index ac36a9ba..2b733832 100644
--- a/src/util/sss_nss.c
+++ b/src/util/sss_nss.c
@@ -24,7 +24,8 @@
char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template,
const char *username, uint32_t uid,
- const char *original, const char *domain)
+ const char *original, const char *domain,
+ const char *flatname)
{
char *copy;
char *p;
@@ -105,6 +106,7 @@ char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template,
result = talloc_asprintf_append(result, "%s%s@%s", p,
username, domain);
break;
+
case 'o':
if (original == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE,
@@ -117,6 +119,16 @@ char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template,
result = talloc_asprintf_append(result, "%s%s", p, orig);
break;
+ case 'F':
+ if (flatname == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot expand domain name "
+ "template because domain flat "
+ "name is empty.\n"));
+ goto done;
+ }
+ result = talloc_asprintf_append(result, "%s%s", p, flatname);
+ 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 0520035f..6dcdbaef 100644
--- a/src/util/sss_nss.h
+++ b/src/util/sss_nss.h
@@ -27,5 +27,6 @@
char *expand_homedir_template(TALLOC_CTX *mem_ctx, const char *template,
const char *username, uint32_t uid,
- const char *original, const char *domain);
+ const char *original, const char *domain,
+ const char *flatname);
#endif