ipa_subdomains.c revision cd4cc8d8829f1ea5257bf874b91980368114275f
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering IPA Subdomains Module
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering Sumit Bose <sbose@redhat.com>
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering Copyright (C) 2011 Red Hat
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering This program is free software; you can redistribute it and/or modify
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering it under the terms of the GNU General Public License as published by
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering the Free Software Foundation; either version 3 of the License, or
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering (at your option) any later version.
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering This program is distributed in the hope that it will be useful,
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering but WITHOUT ANY WARRANTY; without even the implied warranty of
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering GNU General Public License for more details.
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering You should have received a copy of the GNU General Public License
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering along with this program. If not, see <http://www.gnu.org/licenses/>.
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering#define SUBDOMAINS_FILTER "objectclass=ipaNTTrustedDomain"
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering#define MASTER_DOMAIN_FILTER "objectclass=ipaNTDomainAttrs"
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering#define RANGE_FILTER "objectclass=ipaIDRange"
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering#define IPA_TRUSTED_DOMAIN_SID "ipaNTTrustedDomainSID"
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering#define IPA_ID_RANGE_SIZE "ipaIDRangeSize"
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering#define IPA_SECONDARY_BASE_RID "ipaSecondaryBaseRID"
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering/* do not refresh more often than every 5 seconds for now */
fa6ac76083b8ffc1309876459f54f9f0e2843731Lennart Poettering#define IPA_SUBDOMAIN_DISABLED_PERIOD 3600
struct ipa_subdomains_ctx {
bool configured_explicit;
struct ipa_subdomains_ctx);
return NULL;
static errno_t
const char *gc_service_name;
char *ad_domain;
return ENOMEM;
return ret;
return ret;
return ENOMEM;
return ret;
return ENOMEM;
return ENOMEM;
return ret;
return EFAULT;
return ret;
return EOK;
static errno_t
return ret;
return ENOMEM;
return EOK;
static errno_t
IPA_SERVER_MODE) == false) {
return EOK;
return EOK;
IPA_SERVER_MODE) == false) {
const char *name)
struct ipa_subdomains_ctx);
return NULL;
if (dom) {
return NULL;
const char *value;
size_t c;
int ret;
return ENOMEM;
for (c = 0; c < count; c++) {
goto done;
goto done;
goto done;
value);
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
done:
return ret;
bool *_enumerates)
const char *name;
return ret;
return EOK;
char **_forest)
int ret;
const char *orig_dn;
if (ret) {
goto done;
orig_dn));
goto done;
orig_dn));
goto done;
goto done;
goto done;
goto done;
goto done;
done:
return ret;
bool enumerate)
const char *name;
char *realm;
const char *flat;
const char *id;
int ret;
bool mpg;
return ENOMEM;
goto done;
if (!realm) {
goto done;
if (ret) {
goto done;
if (ret) {
goto done;
goto done;
if (ret) {
goto done;
done:
return ret;
bool *changes)
const char *value;
int ret;
bool enumerate;
for (c = 0; c < count; c++) {
if (handled[c]) {
goto done;
if (c >= count) {
goto done;
goto done;
if (ret) {
handled[c] = true;
if (count == h) {
goto done;
*changes = true;
for (c = 0; c < count; c++) {
if (handled[c]) {
goto done;
if (ret) {
done:
return ret;
struct ipa_subdomains_req_ctx {
char *current_filter;
int search_base_iter;
static errno_t
{ RANGE_FILTER,
int ret;
goto done;
goto done;
goto done;
done:
int ret;
if (ret) {
goto fail;
goto fail;
fail:
static errno_t
return EINVAL;
return EOK;
return ENOMEM;
SDAP_SEARCH_TIMEOUT), false);
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;
domain);
goto done;
goto done;
goto done;
done:
goto done;
goto done;
goto done;
goto done;
done:
goto done;
if (reply_count) {
goto done;
goto done;
goto done;
done:
void *pvt)
const char *errstr)
if (!ctx) {
if (ctx) {
bool *configured_explicit)
int ret;
char *tmp_str;
return ENOMEM;
&tmp_str);
goto done;
*configured_explicit = false;
*configured_explicit = true;
done:
return ret;
struct ipa_subdomains_ctx);
if (!ctx) {
void **pvt_data)
int ret;
bool configured_explicit = false;
return ret;
return ENOMEM;
NULL);
return EOK;
char *realm;
char *hostname;
IPA_SERVER_MODE) == false) {
return EOK;
CONFDB_DEFAULT_FULL_NAME_FORMAT_INTERNAL) != 0)) {
return EINVAL;
return EINVAL;
return ENOMEM;
return EOK;