dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0118-krb5-make-krb5-provider-view-aware.patch

905b4d
From f2a61159a9d8a73405d5dbc6f74bb176b3ee34c9 Mon Sep 17 00:00:00 2001
905b4d
From: Sumit Bose <sbose@redhat.com>
905b4d
Date: Thu, 27 Nov 2014 10:01:40 +0100
905b4d
Subject: [PATCH 118/128] krb5: make krb5 provider view aware
905b4d
905b4d
https://fedorahosted.org/sssd/ticket/2510
905b4d
905b4d
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
905b4d
---
905b4d
 src/providers/ipa/ipa_subdomains.c | 13 +++++++++++++
905b4d
 src/providers/krb5/krb5_auth.c     | 18 ++++++++++++------
905b4d
 2 files changed, 25 insertions(+), 6 deletions(-)
905b4d
905b4d
diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c
905b4d
index 6fdb0befa32f96d01c9b3666a3ef9c8331a83242..d053d46ac4208bd52fcbf524a11243896b849612 100644
905b4d
--- a/src/providers/ipa/ipa_subdomains.c
905b4d
+++ b/src/providers/ipa/ipa_subdomains.c
905b4d
@@ -1174,6 +1174,19 @@ static void ipa_get_view_name_done(struct tevent_req *req)
905b4d
                 DEBUG(SSSDBG_CRIT_FAILURE, "Cannot copy view name.\n");
905b4d
             }
905b4d
         }
905b4d
+
905b4d
+        /* TODO: only needed if view changed */
905b4d
+        ret = sysdb_master_domain_update(ctx->sd_ctx->be_ctx->domain);
905b4d
+        if (ret != EOK) {
905b4d
+            DEBUG(SSSDBG_OP_FAILURE, "sysdb_master_domain_update failed.\n");
905b4d
+            goto done;
905b4d
+        }
905b4d
+
905b4d
+        ret = sysdb_update_subdomains(ctx->sd_ctx->be_ctx->domain);
905b4d
+        if (ret != EOK) {
905b4d
+            DEBUG(SSSDBG_OP_FAILURE, "sysdb_update_subdomains failed.\n");
905b4d
+            goto done;
905b4d
+        }
905b4d
     }
905b4d
 
905b4d
     ret = ipa_check_master(ctx);
905b4d
diff --git a/src/providers/krb5/krb5_auth.c b/src/providers/krb5/krb5_auth.c
905b4d
index e791aee1c2d83f84ba617db1d5d93948c0e4e2a1..e43b3652786678b79499e30ed546712ef080fe2c 100644
905b4d
--- a/src/providers/krb5/krb5_auth.c
905b4d
+++ b/src/providers/krb5/krb5_auth.c
905b4d
@@ -462,8 +462,8 @@ struct tevent_req *krb5_auth_send(TALLOC_CTX *mem_ctx,
905b4d
     }
905b4d
     kr = state->kr;
905b4d
 
905b4d
-    ret = sysdb_get_user_attr(state, state->domain, state->pd->user, attrs,
905b4d
-                              &res;;
905b4d
+    ret = sysdb_get_user_attr_with_views(state, state->domain, state->pd->user,
905b4d
+                                         attrs, &res;;
905b4d
     if (ret) {
905b4d
         DEBUG(SSSDBG_FUNC_DATA,
905b4d
               "sysdb search for upn of user [%s] failed.\n", pd->user);
905b4d
@@ -503,14 +503,18 @@ struct tevent_req *krb5_auth_send(TALLOC_CTX *mem_ctx,
905b4d
             goto done;
905b4d
         }
905b4d
 
905b4d
-        kr->homedir = ldb_msg_find_attr_as_string(res->msgs[0], SYSDB_HOMEDIR,
905b4d
-                                                  NULL);
905b4d
+        kr->homedir = sss_view_ldb_msg_find_attr_as_string(state->domain,
905b4d
+                                                           res->msgs[0],
905b4d
+                                                           SYSDB_HOMEDIR,
905b4d
+                                                           NULL);
905b4d
         if (kr->homedir == NULL) {
905b4d
             DEBUG(SSSDBG_CONF_SETTINGS,
905b4d
                   "Home directory for user [%s] not known.\n", pd->user);
905b4d
         }
905b4d
 
905b4d
-        kr->uid = ldb_msg_find_attr_as_uint64(res->msgs[0], SYSDB_UIDNUM, 0);
905b4d
+        kr->uid = sss_view_ldb_msg_find_attr_as_uint64(state->domain,
905b4d
+                                                       res->msgs[0],
905b4d
+                                                       SYSDB_UIDNUM, 0);
905b4d
         if (kr->uid == 0) {
905b4d
             DEBUG(SSSDBG_CONF_SETTINGS,
905b4d
                   "UID for user [%s] not known.\n", pd->user);
905b4d
@@ -518,7 +522,9 @@ struct tevent_req *krb5_auth_send(TALLOC_CTX *mem_ctx,
905b4d
             goto done;
905b4d
         }
905b4d
 
905b4d
-        kr->gid = ldb_msg_find_attr_as_uint64(res->msgs[0], SYSDB_GIDNUM, 0);
905b4d
+        kr->gid = sss_view_ldb_msg_find_attr_as_uint64(state->domain,
905b4d
+                                                       res->msgs[0],
905b4d
+                                                       SYSDB_GIDNUM, 0);
905b4d
         if (kr->gid == 0) {
905b4d
             DEBUG(SSSDBG_CONF_SETTINGS,
905b4d
                   "GID for user [%s] not known.\n", pd->user);
905b4d
-- 
905b4d
1.9.3
905b4d