From 3c60433641ce2e86b9b04778c8f8652ef0d097e4 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 11 Apr 2012 15:02:10 +0200 Subject: Make re_expression and full_name_format per domain options * Allows different user/domain qualified names for different domains. For example Domain\User or user@domain. * The global re_expression and full_name_format options remain as defaults for the domains. * Subdomains get the re_expression and full_name_format of their parent domain. https://bugzilla.redhat.com/show_bug.cgi?id=811663 --- src/responder/nss/nsssrv_cmd.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/responder/nss/nsssrv_cmd.c') diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c index 9f286444..fc504700 100644 --- a/src/responder/nss/nsssrv_cmd.c +++ b/src/responder/nss/nsssrv_cmd.c @@ -235,11 +235,13 @@ static int fill_pwent(struct sss_packet *packet, int i, ret, num, t; bool add_domain = dom->fqnames; const char *domain = dom->name; - const char *namefmt = nctx->rctx->names->fq_fmt; + const char *namefmt; bool packet_initialized = false; int ncret; TALLOC_CTX *tmp_ctx = NULL; + namefmt = dom->names->fq_fmt; + if (add_domain) dom_len = strlen(domain); to_sized_string(&pwfield, nctx->pwfield); @@ -794,8 +796,8 @@ static int nss_cmd_getpwnam(struct cli_ctx *cctx) rawname = (const char *)body; domname = NULL; - ret = sss_parse_name(cmdctx, cctx->rctx->names, rawname, - &domname, &cmdctx->name); + ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains, rawname, + &domname, &cmdctx->name); if (ret != EOK) { DEBUG(2, ("Invalid name received [%s]\n", rawname)); ret = ENOENT; @@ -1681,7 +1683,7 @@ static int fill_members(struct sss_packet *packet, size_t rsize = *_rsize; char *tmpstr; struct sized_string name; - const char *namefmt = nctx->rctx->names->fq_fmt; + const char *namefmt = dom->names->fq_fmt; TALLOC_CTX *tmp_ctx = NULL; size_t delim; @@ -1820,9 +1822,11 @@ static int fill_grent(struct sss_packet *packet, size_t rzero, rsize; bool add_domain = dom->fqnames; const char *domain = dom->name; - const char *namefmt = nctx->rctx->names->fq_fmt; + const char *namefmt; TALLOC_CTX *tmp_ctx = NULL; + namefmt = dom->names->fq_fmt; + if (add_domain) { delim = 1; dom_len = strlen(domain); @@ -2258,8 +2262,8 @@ static int nss_cmd_getgrnam(struct cli_ctx *cctx) rawname = (const char *)body; domname = NULL; - ret = sss_parse_name(cmdctx, cctx->rctx->names, rawname, - &domname, &cmdctx->name); + ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains, rawname, + &domname, &cmdctx->name); if (ret != EOK) { DEBUG(2, ("Invalid name received [%s]\n", rawname)); ret = ENOENT; @@ -3368,8 +3372,8 @@ static int nss_cmd_initgroups(struct cli_ctx *cctx) rawname = (const char *)body; domname = NULL; - ret = sss_parse_name(cmdctx, cctx->rctx->names, rawname, - &domname, &cmdctx->name); + ret = sss_parse_name_for_domains(cmdctx, cctx->rctx->domains, rawname, + &domname, &cmdctx->name); if (ret != EOK) { DEBUG(2, ("Invalid name received [%s]\n", rawname)); ret = ENOENT; -- cgit