ldap_init.c revision 17531a398cc9084036cb08d69fe876a8f12707bb
/*
SSSD
LDAP Provider Initialization functions
Authors:
Simo Sorce <ssorce@redhat.com>
Copyright (C) 2009 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "util/child_common.h"
#include "providers/ldap/ldap_common.h"
#include "providers/ldap/sdap_async_private.h"
#include "providers/ldap/sdap_access.h"
#include "providers/ldap/sdap_sudo.h"
#include "providers/ldap/sdap_autofs.h"
#include "providers/ldap/sdap_idmap.h"
#include "providers/fail_over_srv.h"
#include "providers/dp_refresh.h"
/* Id Handler */
struct bet_ops sdap_id_ops = {
};
/* Auth Handler */
struct bet_ops sdap_auth_ops = {
};
/* Chpass Handler */
struct bet_ops sdap_chpass_ops = {
};
/* Access Handler */
struct bet_ops sdap_access_ops = {
};
/* Please use this only for short lists */
bool case_sensitive)
{
size_t c;
size_t d;
int cmp;
if (case_sensitive) {
} else {
}
if (cmp == 0) {
"Duplicate string [%s] found.\n", list[c]);
return EINVAL;
}
}
}
return EOK;
}
void **pvt_data)
{
const char *urls;
const char *backup_urls;
const char *dns_service_name;
const char *sasl_mech;
struct sdap_service *sdap_service;
int ret;
/* If we're already set up, just return that */
"Re-using sdap_id_ctx for this provider\n");
return EOK;
}
goto done;
}
"Service name for discovery set to %s\n", dns_service_name);
&sdap_service);
goto done;
}
if (!ctx) {
goto done;
}
&ctx->krb5_service);
"sdap_gssapi_init failed [%d][%s].\n",
goto done;
}
}
}
goto done;
}
/* Set up the ID mapping object */
ret = sdap_setup_child();
goto done;
}
/* setup SRV lookup plugin */
goto done;
}
/* setup periodical refresh of expired records */
}
*ops = &sdap_id_ops;
done:
}
return ret;
}
void **pvt_data)
{
int ret;
"ldap_id_init_internal failed [%d][%s].\n",
goto done;
}
"sdap_id_setup_tasks failed [%d][%s].\n",
goto done;
}
done:
}
return ret;
}
void **pvt_data)
{
void *data;
struct sdap_id_ctx *id_ctx;
struct sdap_auth_ctx *ctx;
int ret;
*ops = &sdap_auth_ops;
}
return ret;
}
void **pvt_data)
{
int ret;
void *data;
const char *urls;
const char *backup_urls;
const char *dns_service_name;
goto done;
}
if (dns_service_name) {
"Service name for chpass discovery set to %s\n",
}
"ldap_chpass_uri and ldap_chpass_dns_service_name not set, "
"using ldap_uri.\n");
} else {
"Failed to initialize failover service!\n");
goto done;
}
}
*ops = &sdap_chpass_ops;
done:
}
return ret;
}
void **pvt_data)
{
int ret;
struct sdap_access_ctx *access_ctx;
const char *filter;
const char *order;
char **order_list;
int order_list_len;
size_t c;
const char *dummy;
if(access_ctx == NULL) {
goto done;
}
goto done;
}
"ldap_access_order not given, using 'filter'.\n");
order = "filter";
}
&order_list, &order_list_len);
goto done;
}
goto done;
}
if (order_list_len > LDAP_ACCESS_LAST) {
"Currently only [%d] different access rules are supported.\n",
goto done;
}
for (c = 0; order_list[c] != NULL; c++) {
/* It's okay if this is NULL. In that case we will simply act
* like the 'deny' provider.
*/
"Warning: LDAP access rule 'filter' is set, "
"but no ldap_access_filter configured. "
"All domain users will be denied access.\n");
} else {
filter);
goto done;
}
}
"Warning: LDAP access rule 'expire' is set, "
"but no ldap_account_expire_policy configured. "
"All domain users will be denied access.\n");
} else {
"Unsupported LDAP account expire policy [%s].\n",
dummy);
goto done;
}
}
} else if (strcasecmp(order_list[c],
} else if (strcasecmp(order_list[c],
LDAP_ACCESS_EXPIRE_POLICY_WARN_NAME) == 0) {
} else if (strcasecmp(order_list[c],
LDAP_ACCESS_EXPIRE_POLICY_RENEW_NAME) == 0) {
} else {
"Unexpected access rule name [%s].\n", order_list[c]);
goto done;
}
}
if (c == 0) {
"but ldap_access_order is empty. "
"All domain users will be denied access.\n");
}
*ops = &sdap_access_ops;
*pvt_data = access_ctx;
done:
}
return ret;
}
void **pvt_data)
{
#ifdef BUILD_SUDO
struct sdap_id_ctx *id_ctx;
void *data;
int ret;
return ret;
}
if (!id_ctx) {
return EIO;
}
#else
"built without sudo support, ignoring\n");
return EOK;
#endif
}
void **pvt_data)
{
#ifdef BUILD_AUTOFS
struct sdap_id_ctx *id_ctx;
void *data;
int ret;
return ret;
}
if (!id_ctx) {
return EIO;
}
#else
"built without autofs support, ignoring\n");
return EOK;
#endif
}
{
/* TODO: Clean up any internal data */
}