Blame SOURCES/0057-NSS-continue-with-UPN-email-search-if-name-was-not-f.patch

b2d430
From 481bd8fd5db7a92954ff351ab64ab32b4249bf19 Mon Sep 17 00:00:00 2001
b2d430
From: Sumit Bose <sbose@redhat.com>
b2d430
Date: Tue, 21 Jun 2016 11:06:19 +0200
b2d430
Subject: [PATCH 57/62] NSS: continue with UPN/email search if name was not
b2d430
 found
b2d430
b2d430
Currently we only search for UPNs if the domain part of the name was not
b2d430
know, with Kerberos aliases and email addresses we have to do this even
b2d430
if the domain name is a know domain.
b2d430
b2d430
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
b2d430
(cherry picked from commit 447b1da857368678990b54cd6b9cfed940357c44)
b2d430
---
b2d430
 src/responder/nss/nsssrv_cmd.c | 12 ++++++------
b2d430
 1 file changed, 6 insertions(+), 6 deletions(-)
b2d430
b2d430
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
b2d430
index 77e540d8da969614e4ab40c62e6ae1f271962f31..cd15b41886ad046d1d70dbd8ad54af5a4eccee5d 100644
b2d430
--- a/src/responder/nss/nsssrv_cmd.c
b2d430
+++ b/src/responder/nss/nsssrv_cmd.c
b2d430
@@ -980,6 +980,7 @@ done:
b2d430
 
b2d430
 static void nss_cmd_getby_dp_callback(uint16_t err_maj, uint32_t err_min,
b2d430
                                       const char *err_msg, void *ptr);
b2d430
+static int nss_cmd_assume_upn(struct nss_dom_ctx *dctx);
b2d430
 
b2d430
 /* search for a user.
b2d430
  * Returns:
b2d430
@@ -1051,6 +1052,7 @@ static int nss_cmd_getpwnam_search(struct nss_dom_ctx *dctx)
b2d430
             /* There are no further domains or this was a
b2d430
              * fully-qualified user request.
b2d430
              */
b2d430
+
b2d430
             return ENOENT;
b2d430
         }
b2d430
 
b2d430
@@ -1144,8 +1146,6 @@ static int nss_cmd_getpwnam_search(struct nss_dom_ctx *dctx)
b2d430
                 if (dom) continue;
b2d430
             }
b2d430
 
b2d430
-            DEBUG(SSSDBG_OP_FAILURE, "No results for getpwnam call\n");
b2d430
-
b2d430
             /* User not found in ldb -> delete user from memory cache. */
b2d430
             ret = delete_entry_from_memcache(dctx->domain, name, nctx->rctx,
b2d430
                                              nctx->pwd_mc_ctx, SSS_MC_PASSWD);
b2d430
@@ -1163,6 +1163,8 @@ static int nss_cmd_getpwnam_search(struct nss_dom_ctx *dctx)
b2d430
                       "Deleting user from memcache failed.\n");
b2d430
             }
b2d430
 
b2d430
+            DEBUG(SSSDBG_OP_FAILURE, "No results for getpwnam call\n");
b2d430
+
b2d430
             return ENOENT;
b2d430
         }
b2d430
 
b2d430
@@ -1215,7 +1217,7 @@ static int nss_cmd_assume_upn(struct nss_dom_ctx *dctx)
b2d430
 {
b2d430
     int ret;
b2d430
 
b2d430
-    if (dctx->domain == NULL) {
b2d430
+    if (dctx->cmdctx->name_is_upn == false) {
b2d430
         dctx->domain = dctx->cmdctx->cctx->rctx->domains;
b2d430
         dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider);
b2d430
         dctx->cmdctx->check_next = true;
b2d430
@@ -1563,6 +1565,7 @@ static int nss_cmd_getbynam(enum sss_cli_command cmd, struct cli_ctx *cctx)
b2d430
 
b2d430
     rawname = (const char *)body;
b2d430
     dctx->mc_name = rawname;
b2d430
+    dctx->rawname = rawname;
b2d430
 
b2d430
     DEBUG(SSSDBG_TRACE_FUNC, "Running command [%d][%s] with input [%s].\n",
b2d430
           cmd, sss_cmd2str(dctx->cmdctx->cmd), rawname);
b2d430
@@ -1588,7 +1591,6 @@ static int nss_cmd_getbynam(enum sss_cli_command cmd, struct cli_ctx *cctx)
b2d430
         if (req == NULL) {
b2d430
             ret = ENOMEM;
b2d430
         } else {
b2d430
-            dctx->rawname = rawname;
b2d430
             tevent_req_set_callback(req, nss_cmd_getbynam_done, dctx);
b2d430
             ret = EAGAIN;
b2d430
         }
b2d430
@@ -1604,7 +1606,6 @@ static int nss_cmd_getbynam(enum sss_cli_command cmd, struct cli_ctx *cctx)
b2d430
         if (req == NULL) {
b2d430
             ret = ENOMEM;
b2d430
         } else {
b2d430
-            dctx->rawname = rawname;
b2d430
             tevent_req_set_callback(req, nss_cmd_getbynam_done, dctx);
b2d430
             ret = EAGAIN;
b2d430
         }
b2d430
@@ -1626,7 +1627,6 @@ static int nss_cmd_getbynam(enum sss_cli_command cmd, struct cli_ctx *cctx)
b2d430
         }
b2d430
     } else {
b2d430
         /* this is a multidomain search */
b2d430
-        dctx->rawname = rawname;
b2d430
         dctx->domain = cctx->rctx->domains;
b2d430
         cmdctx->check_next = true;
b2d430
         if (cctx->rctx->get_domains_last_call.tv_sec == 0) {
b2d430
-- 
b2d430
2.4.11
b2d430