ldap_common.c revision 430cc9ad62e0d7d1bd8dc7c65be2bfcf087c5e5c
dc0682900a79cfb47fd9a416902129bfa68fdcbfStéphane Graber LDAP Provider Common Functions
87c7e080c8e2d4b702a23c38d10e39bccdfd03e1Stéphane Graber Simo Sorce <ssorce@redhat.com>
015f0dd7924d27aeb2f16bb0c4d243f3fd93e94bMichael H. Warfield Copyright (C) 2008-2010 Red Hat
015f0dd7924d27aeb2f16bb0c4d243f3fd93e94bMichael H. Warfield This program is free software; you can redistribute it and/or modify
015f0dd7924d27aeb2f16bb0c4d243f3fd93e94bMichael H. Warfield it under the terms of the GNU General Public License as published by
015f0dd7924d27aeb2f16bb0c4d243f3fd93e94bMichael H. Warfield the Free Software Foundation; either version 3 of the License, or
015f0dd7924d27aeb2f16bb0c4d243f3fd93e94bMichael H. Warfield (at your option) any later version.
015f0dd7924d27aeb2f16bb0c4d243f3fd93e94bMichael H. Warfield This program is distributed in the hope that it will be useful,
015f0dd7924d27aeb2f16bb0c4d243f3fd93e94bMichael H. Warfield but WITHOUT ANY WARRANTY; without even the implied warranty of
015f0dd7924d27aeb2f16bb0c4d243f3fd93e94bMichael H. Warfield MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dc0682900a79cfb47fd9a416902129bfa68fdcbfStéphane Graber GNU General Public License for more details.
dc0682900a79cfb47fd9a416902129bfa68fdcbfStéphane Graber You should have received a copy of the GNU General Public License
dc0682900a79cfb47fd9a416902129bfa68fdcbfStéphane Graber along with this program. If not, see <http://www.gnu.org/licenses/>.
dc0682900a79cfb47fd9a416902129bfa68fdcbfStéphane Graber#include "providers/ldap/sdap_async_private.h"
#include "db/sysdb_autofs.h"
#include "util/sss_krb5.h"
#include "util/crypto/sss_crypto.h"
#include "providers/ldap/ldap_opts.h"
#include "providers/ldap/sdap_idmap.h"
struct sdap_domain *
return sditer;
struct sdap_domain *
const char *dn)
int match_len;
int best_match_len = 0;
return NULL;
return sdmatch;
return ENOMEM;
goto done;
done:
return ret;
return ret;
return ENOMEM;
if (ret) {
return ret;
return EOK;
const char *conf_path,
char *schema;
const char *search_base;
const char *pwd_policy;
int ret;
const char *ldap_deref;
int ldap_deref_val;
const char *authtok_type;
char *cleartext;
goto done;
goto done;
goto done;
search_base_options[o]));
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
#ifndef HAVE_LDAP_CONNCB
bool ldap_referrals;
if (ldap_referrals) {
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
return EINVAL;
&cleartext);
return ret;
return ret;
return ret;
done:
return ret;
const char *conf_path,
bool *use_host_filter,
bool *include_regexp,
bool *include_netgroups)
const char *search_base;
int ret;
return ret;
return ret;
return ret;
return EOK;
const char *conf_path,
const char *search_base;
int ret;
return ret;
return ret;
case SDAP_SCHEMA_RFC2307:
case SDAP_SCHEMA_RFC2307BIS:
case SDAP_SCHEMA_IPA_V1:
case SDAP_SCHEMA_AD:
return EINVAL;
return ret;
return ret;
return EOK;
const char *class_name;
char *unparsed_base;
switch (class) {
case SDAP_SEARCH_BASE:
case SDAP_USER_SEARCH_BASE:
case SDAP_GROUP_SEARCH_BASE:
case SDAP_SUDO_SEARCH_BASE:
case SDAP_SERVICE_SEARCH_BASE:
case SDAP_AUTOFS_SEARCH_BASE:
const char *unparsed_base,
int scope,
const char *filter,
if (!tmp_ctx) {
goto done;
if (!ldb) {
goto done;
goto done;
goto done;
if (!ldn) {
goto done;
goto done;
done:
return ret;
const char *unparsed_base,
const char *class_name,
const char *old_filter,
char **split_bases;
char *filter;
int count;
if (!tmp_ctx) {
goto done;
if (!ldb) {
goto done;
goto done;
if (!search_bases) {
goto done;
&search_bases[0]);
goto done;
if (!search_bases) {
goto done;
struct sdap_search_base);
if (!search_bases[i]) {
goto done;
goto done;
if (!ldn) {
goto done;
split_bases[c]);
goto done;
split_bases[c]);
goto done;
goto done;
if (!filter) {
goto done;
if(!tree) {
goto done;
filter);
done:
return ret;
ctx);
void *pvt)
int ret;
return ret;
const char *tmp;
const char *srv_name;
char *new_uri;
if (!service) {
if (!srvaddr) {
if (!tmp) {
if (!new_uri) {
int signum,
int count,
void *siginfo,
void *private_data)
int ret;
orderly_shutdown(0);
const char *realm)
char *sig_realm;
return ENOMEM;
return ENOMEM;
return EOK;
int ret;
struct remove_info_files_ctx);
const char *realm,
const char *service_name)
int ret;
return ENOMEM;
goto done;
goto done;
done:
return ret;
char *default_primary,
char *default_realm,
const char *keytab_path)
char *sasl_primary;
char *desired_primary;
char *primary_realm;
char *sasl_realm;
char *desired_realm;
bool primary_requested = true;
bool realm_requested = true;
if (!desired_primary) {
primary_requested = false;
if (!desired_realm) {
realm_requested = false;
goto done;
goto done;
goto done;
done:
return ret;
if (krberr) {
goto done;
if (krberr) {
goto done;
if (!realm) {
goto done;
done:
return realm;
int ret;
const char *krb5_servers;
const char *krb5_backup_servers;
const char *krb5_realm;
const char *krb5_opt_realm;
goto done;
goto done;
&service);
goto done;
goto done;
goto done;
goto done;
done:
return ret;
const char *service_name,
const char *dns_service_name,
const char *urls,
bool primary)
char *srv_user_data;
if (!tmp_ctx) {
return ENOMEM;
goto done;
for (i = 0; list[i]; i++) {
if (!primary) {
list[i]);
if (!dns_service_name) {
goto done;
if (!srv_user_data) {
goto done;
if (ret) {
goto done;
goto done;
list[i]);
goto done;
if (ret) {
goto done;
done:
return ret;
static inline errno_t
const char *urls)
static inline errno_t
const char *urls)
int ret;
if (!tmp_ctx) {
return ENOMEM;
if (!service) {
goto done;
goto done;
goto done;
if (!urls) {
urls);
goto done;
if (backup_urls) {
goto done;
goto done;
done:
return ret;
char *endptr;
return EOK;
errno = 0;
if (errno != 0) {
return errno;
return EINVAL;
return EINVAL;
return EOK;
const char *ldap_name,
char **sysdb_name)
size_t i;
for (i = 0; i < map_size; i++) {
if (i < map_size) {
if (!*sysdb_name) {
return ENOMEM;
return EOK;
char ***missing_attrs)
size_t i, j, k;
const char **expected_attrs;
char *sysdb_name;
return EINVAL;
if (!tmp_ctx) {
return ENOMEM;
goto done;
if (!missing) {
goto done;
for (i = 0; i < attr_count; i++) {
expected_attrs[i],
&sysdb_name);
goto done;
done:
return ret;
const char *base_filter)
return filter;
const char *sid_attr,
char **_sid_str)
char *sid_str;
return ENOENT;
return ENOMEM;
&sid_str);
return EIO;
return EOK;
struct sdap_id_conn_ctx *
return NULL;
return NULL;
return conn;
struct sdap_id_ctx *
return NULL;
return NULL;
return sdap_ctx;