summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb_subdomains.c
diff options
context:
space:
mode:
authorPavel Reichl <pavel.reichl@redhat.com>2013-12-17 17:32:04 +0000
committerJakub Hrozek <jhrozek@redhat.com>2014-01-09 11:50:59 +0100
commit17195241500e46272018d7897d6e87249870caf2 (patch)
treed4cd863028e0f1b210110160b0fab1f9fdbd9e17 /src/db/sysdb_subdomains.c
parentfe521d1ad610920ce5411589a158157d6a5f0794 (diff)
downloadsssd-17195241500e46272018d7897d6e87249870caf2.tar.gz
sssd-17195241500e46272018d7897d6e87249870caf2.tar.xz
sssd-17195241500e46272018d7897d6e87249870caf2.zip
responder: Set forest attribute in AD domains
Resolves: https://fedorahosted.org/sssd/ticket/2160
Diffstat (limited to 'src/db/sysdb_subdomains.c')
-rw-r--r--src/db/sysdb_subdomains.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c
index 43c75799c..9c2926c00 100644
--- a/src/db/sysdb_subdomains.c
+++ b/src/db/sysdb_subdomains.c
@@ -208,6 +208,7 @@ errno_t sysdb_master_domain_update(struct sss_domain_info *domain)
SYSDB_SUBDOMAIN_REALM,
SYSDB_SUBDOMAIN_FLAT,
SYSDB_SUBDOMAIN_ID,
+ SYSDB_SUBDOMAIN_FOREST,
NULL};
tmp_ctx = talloc_new(NULL);
@@ -278,13 +279,27 @@ errno_t sysdb_master_domain_update(struct sss_domain_info *domain)
}
}
+ tmp_str = ldb_msg_find_attr_as_string(res->msgs[0], SYSDB_SUBDOMAIN_FOREST,
+ NULL);
+ if (tmp_str != NULL &&
+ (domain->forest == NULL ||
+ strcasecmp(tmp_str, domain->forest) != 0)) {
+ talloc_free(domain->forest);
+ domain->forest = talloc_strdup(domain, tmp_str);
+ if (domain->forest == NULL) {
+ ret = ENOMEM;
+ goto done;
+ }
+ }
+
done:
talloc_free(tmp_ctx);
return ret;
}
errno_t sysdb_master_domain_add_info(struct sss_domain_info *domain,
- const char *flat, const char *id)
+ const char *flat, const char *id,
+ const char* forest)
{
TALLOC_CTX *tmp_ctx;
struct ldb_message *msg;
@@ -345,6 +360,24 @@ errno_t sysdb_master_domain_add_info(struct sss_domain_info *domain,
do_update = true;
}
+ if (forest != NULL && (domain->forest == NULL ||
+ strcmp(domain->forest, forest) != 0)) {
+ ret = ldb_msg_add_empty(msg, SYSDB_SUBDOMAIN_FOREST,
+ LDB_FLAG_MOD_REPLACE, NULL);
+ if (ret != LDB_SUCCESS) {
+ ret = sysdb_error_to_errno(ret);
+ goto done;
+ }
+
+ ret = ldb_msg_add_string(msg, SYSDB_SUBDOMAIN_FOREST, forest);
+ if (ret != LDB_SUCCESS) {
+ ret = sysdb_error_to_errno(ret);
+ goto done;
+ }
+
+ do_update = true;
+ }
+
if (do_update == false) {
ret = EOK;
goto done;