summaryrefslogtreecommitdiff
path: root/src/responder/nss/nsssrv_cmd.c
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-06 17:17:25 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 10:49:20 +0100
commit58fd3aa25c5292bc67432647ab7e5059439fcc6d (patch)
tree54d9c27c24d910d412875fd6cdc2660f9dae743f /src/responder/nss/nsssrv_cmd.c
parent73120327cc136229d56d08f7f8c5e8df4129c1e3 (diff)
downloadsssd-58fd3aa25c5292bc67432647ab7e5059439fcc6d.tar.gz
sssd-58fd3aa25c5292bc67432647ab7e5059439fcc6d.tar.bz2
sssd-58fd3aa25c5292bc67432647ab7e5059439fcc6d.zip
Pass domain to sysdb_get<pw/gr>nam() functions
Also allows us to remove sysdb_subdom_get<pw/gr>nam() wrappers and restore fqnames proper value in subdomains, by testing for a parent domain being present or not.
Diffstat (limited to 'src/responder/nss/nsssrv_cmd.c')
-rw-r--r--src/responder/nss/nsssrv_cmd.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 55543f07..7e33d922 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -297,7 +297,7 @@ static int fill_pwent(struct sss_packet *packet,
size_t dom_len = 0;
int delim = 1;
int i, ret, num, t;
- bool add_domain = dom->fqnames;
+ bool add_domain = (dom->fqnames && (dom->parent == NULL));
const char *domain = dom->name;
const char *namefmt;
bool packet_initialized = false;
@@ -759,9 +759,7 @@ static int nss_cmd_getpwnam_search(struct nss_dom_ctx *dctx)
return EIO;
}
- /* if this is a subdomain we need to search for the fully qualified
- * name in the database */
- ret = sysdb_subdom_getpwnam(cmdctx, sysdb, name, &dctx->res);
+ ret = sysdb_getpwnam(cmdctx, sysdb, dom, name, &dctx->res);
if (ret != EOK) {
DEBUG(1, ("Failed to make request to our cache!\n"));
return EIO;
@@ -1926,7 +1924,7 @@ static int fill_members(struct sss_packet *packet,
size_t blen;
const char *domain = dom->name;
- bool add_domain = dom->fqnames;
+ bool add_domain = (dom->fqnames && (dom->parent == NULL));
if (add_domain) {
delim = 1;
@@ -2055,7 +2053,7 @@ static int fill_grent(struct sss_packet *packet,
int i = 0;
int ret, num, memnum;
size_t rzero, rsize;
- bool add_domain = dom->fqnames;
+ bool add_domain = (dom->fqnames && (dom->parent == NULL));
const char *domain = dom->name;
const char *namefmt;
TALLOC_CTX *tmp_ctx = NULL;
@@ -2358,9 +2356,7 @@ static int nss_cmd_getgrnam_search(struct nss_dom_ctx *dctx)
return EIO;
}
- /* if this is a subdomain we need to search for the fully qualified
- * name in the database */
- ret = sysdb_subdom_getgrnam(cmdctx, sysdb, name, &dctx->res);
+ ret = sysdb_getgrnam(cmdctx, sysdb, dom, name, &dctx->res);
if (ret != EOK) {
DEBUG(1, ("Failed to make request to our cache!\n"));
return EIO;