1dedfbb334
Resolves: upstream#3588 - sssd_nss consumes more memory until restarted or machine swaps Resolves: failure in glibc tests https://sourceware.org/bugzilla/show_bug.cgi?id=22530 Resolves: upstream#3451 - When sssd is configured with id_provider proxy and auth_provider ldap, login fails if the LDAP server is not allowing anonymous binds Resolves: upstream#3285 - SSSD needs restart after incorrect clock is corrected with AD Resolves: upstream#3586 - Give a more detailed debug and system-log message if krb5_init_context() failed Resolves: rhbz#1431153 - SSSD ships a drop-in configuration snippet in /etc/systemd/system Backport few upstream features from 1.16.1
111 lines
3.2 KiB
Diff
111 lines
3.2 KiB
Diff
From 5af7dcbba7a54c9a017a7d317f74453254125eb7 Mon Sep 17 00:00:00 2001
|
|
From: Lukas Slebodnik <lslebodn@redhat.com>
|
|
Date: Wed, 29 Nov 2017 17:57:56 +0100
|
|
Subject: [PATCH 76/79] confdb: Move detection files to separate function
|
|
|
|
---
|
|
src/confdb/confdb.c | 73 ++++++++++++++++++++++++++++++-----------------------
|
|
1 file changed, 41 insertions(+), 32 deletions(-)
|
|
|
|
diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
|
|
index a028224817f12ace2a0c4165d7b9cb0bb80ce5a1..c41bd5087592ba15d8956e0279aaf72ba86936ed 100644
|
|
--- a/src/confdb/confdb.c
|
|
+++ b/src/confdb/confdb.c
|
|
@@ -1718,52 +1718,61 @@ done:
|
|
return ret;
|
|
}
|
|
|
|
-static int confdb_has_files_domain(struct confdb_ctx *cdb)
|
|
+static bool need_implicit_files_domain(TALLOC_CTX *tmp_ctx,
|
|
+ struct ldb_result *doms)
|
|
{
|
|
- TALLOC_CTX *tmp_ctx = NULL;
|
|
- struct ldb_dn *dn = NULL;
|
|
- struct ldb_result *res = NULL;
|
|
- static const char *attrs[] = { CONFDB_DOMAIN_ID_PROVIDER, NULL };
|
|
const char *id_provider = NULL;
|
|
- int ret;
|
|
unsigned int i;
|
|
|
|
- tmp_ctx = talloc_new(NULL);
|
|
- if (tmp_ctx == NULL) {
|
|
- return ENOMEM;
|
|
- }
|
|
-
|
|
- dn = ldb_dn_new(tmp_ctx, cdb->ldb, CONFDB_DOMAIN_BASEDN);
|
|
- if (dn == NULL) {
|
|
- ret = ENOMEM;
|
|
- goto done;
|
|
- }
|
|
-
|
|
- ret = ldb_search(cdb->ldb, tmp_ctx, &res, dn, LDB_SCOPE_ONELEVEL,
|
|
- attrs, NULL);
|
|
- if (ret != LDB_SUCCESS) {
|
|
- ret = EIO;
|
|
- goto done;
|
|
- }
|
|
-
|
|
- for (i = 0; i < res->count; i++) {
|
|
- id_provider = ldb_msg_find_attr_as_string(res->msgs[i],
|
|
+ for (i = 0; i < doms->count; i++) {
|
|
+ id_provider = ldb_msg_find_attr_as_string(doms->msgs[i],
|
|
CONFDB_DOMAIN_ID_PROVIDER,
|
|
NULL);
|
|
if (id_provider == NULL) {
|
|
- DEBUG(SSSDBG_CRIT_FAILURE,
|
|
+ DEBUG(SSSDBG_OP_FAILURE,
|
|
"The object [%s] doesn't have a id_provider\n",
|
|
- ldb_dn_get_linearized(res->msgs[i]->dn));
|
|
- ret = EINVAL;
|
|
- goto done;
|
|
+ ldb_dn_get_linearized(doms->msgs[i]->dn));
|
|
+ continue;
|
|
}
|
|
|
|
if (strcasecmp(id_provider, "files") == 0) {
|
|
- break;
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
- ret = i < res->count ? EOK : ENOENT;
|
|
+ return true;
|
|
+}
|
|
+
|
|
+static int confdb_has_files_domain(struct confdb_ctx *cdb)
|
|
+{
|
|
+ TALLOC_CTX *tmp_ctx = NULL;
|
|
+ struct ldb_dn *dn = NULL;
|
|
+ struct ldb_result *res = NULL;
|
|
+ static const char *attrs[] = { CONFDB_DOMAIN_ID_PROVIDER, NULL };
|
|
+ int ret;
|
|
+ bool need_files_dom;
|
|
+
|
|
+ tmp_ctx = talloc_new(NULL);
|
|
+ if (tmp_ctx == NULL) {
|
|
+ return ENOMEM;
|
|
+ }
|
|
+
|
|
+ dn = ldb_dn_new(tmp_ctx, cdb->ldb, CONFDB_DOMAIN_BASEDN);
|
|
+ if (dn == NULL) {
|
|
+ ret = ENOMEM;
|
|
+ goto done;
|
|
+ }
|
|
+
|
|
+ ret = ldb_search(cdb->ldb, tmp_ctx, &res, dn, LDB_SCOPE_ONELEVEL,
|
|
+ attrs, NULL);
|
|
+ if (ret != LDB_SUCCESS) {
|
|
+ ret = EIO;
|
|
+ goto done;
|
|
+ }
|
|
+
|
|
+ need_files_dom = need_implicit_files_domain(tmp_ctx, res);
|
|
+
|
|
+ ret = need_files_dom ? ENOENT : EOK;
|
|
done:
|
|
talloc_free(tmp_ctx);
|
|
return ret;
|
|
--
|
|
2.15.1
|
|
|