Blame SOURCES/0009-extdom-return-LDAP_NO_SUCH_OBJECT-if-domains-differ_rhbz#2000263.patch

b39a24
From 4fca95751ca32a1ed16a6d8a4e557c5799ec5c78 Mon Sep 17 00:00:00 2001
b39a24
From: Sumit Bose <sbose@redhat.com>
b39a24
Date: Wed, 25 Aug 2021 17:10:29 +0200
b39a24
Subject: [PATCH] extdom: return LDAP_NO_SUCH_OBJECT if domains differ
b39a24
b39a24
If a client sends a request to lookup an object from a given trusted
b39a24
domain by UID or GID and an object with matching ID is only found in a
b39a24
different domain the extdom should return LDAP_NO_SUCH_OBJECT to
b39a24
indicate to the client that the requested ID does not exists in the
b39a24
given domain.
b39a24
b39a24
Resolves: https://pagure.io/freeipa/issue/8965
b39a24
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
b39a24
---
b39a24
 .../ipa-extdom-extop/ipa_extdom_common.c                  | 8 ++++++--
b39a24
 1 file changed, 6 insertions(+), 2 deletions(-)
b39a24
b39a24
diff --git a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c
b39a24
index 5d97ff613..6f646b9f4 100644
b39a24
--- a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c
b39a24
+++ b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c
b39a24
@@ -542,7 +542,9 @@ int pack_ber_user(struct ipa_extdom_ctx *ctx,
b39a24
         if (strcasecmp(locat+1, domain_name) == 0  ) {
b39a24
             locat[0] = '\0';
b39a24
         } else {
b39a24
-            ret = LDAP_INVALID_SYNTAX;
b39a24
+            /* The found object is from a different domain than requested,
b39a24
+             * that means it does not exist in the requested domain */
b39a24
+            ret = LDAP_NO_SUCH_OBJECT;
b39a24
             goto done;
b39a24
         }
b39a24
     }
b39a24
@@ -655,7 +657,9 @@ int pack_ber_group(enum response_types response_type,
b39a24
         if (strcasecmp(locat+1, domain_name) == 0  ) {
b39a24
             locat[0] = '\0';
b39a24
         } else {
b39a24
-            ret = LDAP_INVALID_SYNTAX;
b39a24
+            /* The found object is from a different domain than requested,
b39a24
+             * that means it does not exist in the requested domain */
b39a24
+            ret = LDAP_NO_SUCH_OBJECT;
b39a24
             goto done;
b39a24
         }
b39a24
     }
b39a24
-- 
b39a24
2.31.1
b39a24