diff options
author | Stef Walter <stefw@gnome.org> | 2012-04-11 15:02:10 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-06-12 21:28:06 -0400 |
commit | 3c60433641ce2e86b9b04778c8f8652ef0d097e4 (patch) | |
tree | 7e62e915dc54fc40305e5e81714190154783620c /src/responder/nss | |
parent | 6199bd6b41e8b280e65db4b4bb17a1c5c0444aa9 (diff) | |
download | sssd-3c60433641ce2e86b9b04778c8f8652ef0d097e4.tar.gz sssd-3c60433641ce2e86b9b04778c8f8652ef0d097e4.tar.bz2 sssd-3c60433641ce2e86b9b04778c8f8652ef0d097e4.zip |
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
Diffstat (limited to 'src/responder/nss')
-rw-r--r-- | src/responder/nss/nsssrv.c | 3 | ||||
-rw-r--r-- | src/responder/nss/nsssrv_cmd.c | 22 | ||||
-rw-r--r-- | src/responder/nss/nsssrv_netgroup.c | 4 | ||||
-rw-r--r-- | src/responder/nss/nsssrv_services.c | 12 |
4 files changed, 21 insertions, 20 deletions
diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c index 85bf6dc8..62253804 100644 --- a/src/responder/nss/nsssrv.c +++ b/src/responder/nss/nsssrv.c @@ -162,8 +162,7 @@ static int nss_get_config(struct nss_ctx *nctx, nctx->cache_refresh_percent = 0; } - ret = sss_ncache_prepopulate(nctx->ncache, cdb, nctx->rctx->names, - nctx->rctx); + ret = sss_ncache_prepopulate(nctx->ncache, cdb, nctx->rctx); if (ret != EOK) { goto done; } 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; diff --git a/src/responder/nss/nsssrv_netgroup.c b/src/responder/nss/nsssrv_netgroup.c index 593b7e43..774d182b 100644 --- a/src/responder/nss/nsssrv_netgroup.c +++ b/src/responder/nss/nsssrv_netgroup.c @@ -197,8 +197,8 @@ static struct tevent_req *setnetgrent_send(TALLOC_CTX *mem_ctx, dctx = state->dctx; dctx->cmdctx = state->cmdctx; - ret = sss_parse_name(state, client->rctx->names, rawname, - &domname, &state->netgr_shortname); + ret = sss_parse_name_for_domains(state, client->rctx->domains, rawname, + &domname, &state->netgr_shortname); if (ret != EOK) { DEBUG(2, ("Invalid name received [%s]\n", rawname)); goto error; diff --git a/src/responder/nss/nsssrv_services.c b/src/responder/nss/nsssrv_services.c index 2e539f13..e0ee21c3 100644 --- a/src/responder/nss/nsssrv_services.c +++ b/src/responder/nss/nsssrv_services.c @@ -779,7 +779,7 @@ done: errno_t parse_getservbyname(TALLOC_CTX *mem_ctx, uint8_t *body, size_t blen, - struct sss_names_ctx *names, + struct sss_domain_info *domains, char **domain_name, char **service_name, char **service_protocol); @@ -820,7 +820,7 @@ int nss_cmd_getservbyname(struct cli_ctx *cctx) } ret = parse_getservbyname(cmdctx, body, blen, - cctx->rctx->names, + cctx->rctx->domains, &domname, &service_name, &service_protocol); @@ -870,7 +870,7 @@ done: errno_t parse_getservbyname(TALLOC_CTX *mem_ctx, uint8_t *body, size_t blen, - struct sss_names_ctx *names, + struct sss_domain_info *domains, char **domain_name, char **service_name, char **service_protocol) @@ -959,8 +959,8 @@ errno_t parse_getservbyname(TALLOC_CTX *mem_ctx, } } - ret = sss_parse_name(tmp_ctx, names, rawname, - &domname, &svc_name); + ret = sss_parse_name_for_domains(tmp_ctx, domains, rawname, + &domname, &svc_name); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, ("Could not split name and domain of [%s]\n", @@ -1034,7 +1034,6 @@ nss_cmd_getserv_done(struct tevent_req *req) errno_t parse_getservbyport(TALLOC_CTX *mem_ctx, uint8_t *body, size_t blen, - struct sss_names_ctx *names, uint16_t *service_port, char **service_protocol) { @@ -1138,7 +1137,6 @@ int nss_cmd_getservbyport(struct cli_ctx *cctx) } ret = parse_getservbyport(cmdctx, body, blen, - cctx->rctx->names, &port, &service_protocol); if (ret != EOK) { |