From 58fd3aa25c5292bc67432647ab7e5059439fcc6d Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 6 Jan 2013 17:17:25 -0500 Subject: Pass domain to sysdb_getnam() functions Also allows us to remove sysdb_subdom_getnam() wrappers and restore fqnames proper value in subdomains, by testing for a parent domain being present or not. --- src/responder/nss/nsssrv_cmd.c | 14 +++++--------- src/responder/pam/pamsrv_cmd.c | 4 +--- src/responder/sudo/sudosrv_get_sudorules.c | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) (limited to 'src/responder') 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; diff --git a/src/responder/pam/pamsrv_cmd.c b/src/responder/pam/pamsrv_cmd.c index 813894d3..fa8eabf6 100644 --- a/src/responder/pam/pamsrv_cmd.c +++ b/src/responder/pam/pamsrv_cmd.c @@ -1239,9 +1239,7 @@ static int pam_check_user_search(struct pam_auth_req *preq) return EFAULT; } - /* if this is a subdomain we need to search for the fully qualified - * name in the database */ - ret = sysdb_subdom_getpwnam(preq, sysdb, name, &preq->res); + ret = sysdb_getpwnam(preq, sysdb, dom, name, &preq->res); if (ret != EOK) { DEBUG(1, ("Failed to make request to our cache!\n")); return EIO; diff --git a/src/responder/sudo/sudosrv_get_sudorules.c b/src/responder/sudo/sudosrv_get_sudorules.c index 5a78000c..ac8cb3ce 100644 --- a/src/responder/sudo/sudosrv_get_sudorules.c +++ b/src/responder/sudo/sudosrv_get_sudorules.c @@ -136,7 +136,7 @@ static errno_t sudosrv_get_user(struct sudo_dom_ctx *dctx) goto done; } - ret = sysdb_getpwnam(dctx, sysdb, name, &user); + ret = sysdb_getpwnam(dctx, sysdb, dctx->domain, name, &user); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, ("Failed to make request to our cache!\n")); -- cgit