ad_subdomains.c revision 31ad608192c24eb56cf7a8294f6bfc080893193c
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher AD Subdomains Module
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher Sumit Bose <sbose@redhat.com>
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher Copyright (C) 2013 Red Hat
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher This program is free software; you can redistribute it and/or modify
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher it under the terms of the GNU General Public License as published by
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher the Free Software Foundation; either version 3 of the License, or
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher (at your option) any later version.
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher This program is distributed in the hope that it will be useful,
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher but WITHOUT ANY WARRANTY; without even the implied warranty of
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher GNU General Public License for more details.
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher You should have received a copy of the GNU General Public License
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher along with this program. If not, see <http://www.gnu.org/licenses/>.
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher/* Attributes of AD trusted domains */
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher#define AD_AT_TRUST_ATTRS "trustAttributes"
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher#define MASTER_DOMAIN_SID_FILTER "objectclass=domain"
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher/* trustType=2 denotes uplevel (NT5 and later) trusted domains. See
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher * http://msdn.microsoft.com/en-us/library/windows/desktop/ms680342%28v=vs.85%29.aspx
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher * for example.
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher * The absence of msDS-TrustForestTrustInfo attribute denotes a domain from
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher * the same forest. See http://msdn.microsoft.com/en-us/library/cc223786.aspx
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher * for more information.
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher#define SLAVE_DOMAIN_FILTER "(&(objectclass=trustedDomain)(trustType=2)(!(msDS-TrustForestTrustInfo=*)))"
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher/* do not refresh more often than every 5 seconds for now */
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher/* refresh automatically every 4 hours */
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher#define AD_SUBDOMAIN_REFRESH_PERIOD (3600 * 4)
5ea3cfbb8272f5e02f8e9683c0028b3e1a3c9045Sumit Boseads_store_sdap_subdom(struct ad_subdomains_ctx *ctx,
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher return sdap_domain_subdom_add(ctx->sdap_id_ctx, ctx->sdom, parent);
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagherad_subdom_store(struct ad_subdomains_ctx *ctx,
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher ret = sysdb_attrs_get_uint32_t(subdom_attrs, AD_AT_TRUST_TYPE,
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher DEBUG(SSSDBG_OP_FAILURE, ("sysdb_attrs_get_uint32_t failed.\n"));
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher ret = sysdb_attrs_get_string(subdom_attrs, AD_AT_TRUST_PARTNER, &name);
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher DEBUG(SSSDBG_OP_FAILURE, ("failed to get subdomain name\n"));
88a9c6a44b474bff0f7e22f9eb28a9e55df2c0b5Stephen Gallagher realm = get_uppercase_realm(tmp_ctx, name);
goto done;
if (ret) {
name));
goto done;
goto done;
&sid_str);
goto done;
goto done;
done:
return ret;
bool *changes)
const char *value;
int ret;
for (c = 0; c < count; c++) {
if (handled[c]) {
goto done;
if (c >= count) {
goto done;
if (ret) {
handled[c] = true;
if (count == h) {
goto done;
*changes = true;
for (c = 0; c < count; c++) {
if (handled[c]) {
if (ret) {
done:
return ret;
int ret;
goto done;
goto done;
goto done;
done:
int ret;
if (ret) {
goto fail;
goto fail;
fail:
goto done;
goto done;
goto done;
done:
return EOK;
NULL, 0,
return ENOMEM;
return EAGAIN;
int ret;
bool refresh_has_changes = false;
goto done;
if (reply_count) {
goto done;
goto done;
goto done;
if (refresh_has_changes) {
goto done;
goto done;
done:
void *pvt)
const char *errstr)
if (!ctx) {
if (ctx) {
struct ad_subdomains_ctx);
if (!ctx) {
const char *ad_domain,
void **pvt_data)
int ret;
return ENOMEM;
return ENOMEM;
return EFAULT;
return EOK;