|
|
1bb595 |
From 8ca799ea968e548337acb0300642a0d88f1bba9b Mon Sep 17 00:00:00 2001
|
|
|
1bb595 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
1bb595 |
Date: Thu, 7 May 2020 15:47:35 +0200
|
|
|
1bb595 |
Subject: [PATCH 13/19] sysdb: make sysdb_update_subdomains() more robust
|
|
|
1bb595 |
MIME-Version: 1.0
|
|
|
1bb595 |
Content-Type: text/plain; charset=UTF-8
|
|
|
1bb595 |
Content-Transfer-Encoding: 8bit
|
|
|
1bb595 |
|
|
|
1bb595 |
Some NULL checks are added basically to allow that missing values can be
|
|
|
1bb595 |
set later.
|
|
|
1bb595 |
|
|
|
1bb595 |
Resolves: https://github.com/SSSD/sssd/issues/5151
|
|
|
1bb595 |
|
|
|
1bb595 |
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
|
|
|
1bb595 |
---
|
|
|
1bb595 |
src/db/sysdb_subdomains.c | 12 +++++++++---
|
|
|
1bb595 |
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
|
1bb595 |
|
|
|
1bb595 |
diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c
|
|
|
1bb595 |
index b170d1978..d256817a6 100644
|
|
|
1bb595 |
--- a/src/db/sysdb_subdomains.c
|
|
|
1bb595 |
+++ b/src/db/sysdb_subdomains.c
|
|
|
1bb595 |
@@ -421,7 +421,9 @@ errno_t sysdb_update_subdomains(struct sss_domain_info *domain,
|
|
|
1bb595 |
}
|
|
|
1bb595 |
|
|
|
1bb595 |
/* in theory these may change, but it should never happen */
|
|
|
1bb595 |
- if (strcasecmp(dom->realm, realm) != 0) {
|
|
|
1bb595 |
+ if ((dom->realm == NULL && realm != NULL)
|
|
|
1bb595 |
+ || (dom->realm != NULL && realm != NULL
|
|
|
1bb595 |
+ && strcasecmp(dom->realm, realm) != 0)) {
|
|
|
1bb595 |
DEBUG(SSSDBG_TRACE_INTERNAL,
|
|
|
1bb595 |
"Realm name changed from [%s] to [%s]!\n",
|
|
|
1bb595 |
dom->realm, realm);
|
|
|
1bb595 |
@@ -432,7 +434,9 @@ errno_t sysdb_update_subdomains(struct sss_domain_info *domain,
|
|
|
1bb595 |
goto done;
|
|
|
1bb595 |
}
|
|
|
1bb595 |
}
|
|
|
1bb595 |
- if (strcasecmp(dom->flat_name, flat) != 0) {
|
|
|
1bb595 |
+ if ((dom->flat_name == NULL && flat != NULL)
|
|
|
1bb595 |
+ || (dom->flat_name != NULL && flat != NULL
|
|
|
1bb595 |
+ && strcasecmp(dom->flat_name, flat) != 0)) {
|
|
|
1bb595 |
DEBUG(SSSDBG_TRACE_INTERNAL,
|
|
|
1bb595 |
"Flat name changed from [%s] to [%s]!\n",
|
|
|
1bb595 |
dom->flat_name, flat);
|
|
|
1bb595 |
@@ -443,7 +447,9 @@ errno_t sysdb_update_subdomains(struct sss_domain_info *domain,
|
|
|
1bb595 |
goto done;
|
|
|
1bb595 |
}
|
|
|
1bb595 |
}
|
|
|
1bb595 |
- if (strcasecmp(dom->domain_id, id) != 0) {
|
|
|
1bb595 |
+ if ((dom->domain_id == NULL && id != NULL)
|
|
|
1bb595 |
+ || (dom->domain_id != NULL && id != NULL
|
|
|
1bb595 |
+ && strcasecmp(dom->domain_id, id) != 0)) {
|
|
|
1bb595 |
DEBUG(SSSDBG_TRACE_INTERNAL,
|
|
|
1bb595 |
"Domain changed from [%s] to [%s]!\n",
|
|
|
1bb595 |
dom->domain_id, id);
|
|
|
1bb595 |
--
|
|
|
1bb595 |
2.21.3
|
|
|
1bb595 |
|