ldap_id.c revision d239b492ad0382d7061690219275f175c05e1830
/*
SSSD
LDAP Identity Backend Module
Authors:
Simo Sorce <ssorce@redhat.com>
Copyright (C) 2008 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 <errno.h>
#include <time.h>
#include "providers/ldap/ldap_common.h"
#include "providers/ldap/sdap_async.h"
/* =Users-Related-Functions-(by-name,by-uid)============================== */
struct users_get_state {
struct tevent_context *ev;
struct sdap_id_ctx *ctx;
struct sss_domain_info *domain;
const char *name;
int filter_type;
char *filter;
const char **attrs;
};
struct tevent_context *ev,
struct sdap_id_ctx *ctx,
const char *name,
int filter_type,
int attrs_type)
{
struct users_get_state *state;
const char *attr_name;
int ret;
switch (filter_type) {
case BE_FILTER_NAME:
break;
case BE_FILTER_IDNUM:
break;
default:
goto fail;
}
goto fail;
}
/* TODO: handle attrs_type */
if (!sdap_connected(ctx)) {
/* FIXME: add option to decide if tls should be used
if (!subreq) {
goto fail;
}
return req;
}
if (!subreq) {
goto fail;
}
return req;
fail:
return req;
}
{
struct tevent_req);
struct users_get_state);
int ret;
if (ret) {
DEBUG(0, ("Authentication mechanism not Supported by server"));
}
return;
}
if (!subreq) {
return;
}
}
{
struct tevent_req);
struct users_get_state);
char *endptr;
int ret;
return;
}
/* it was an enumeration */
return;
}
switch (state->filter_type) {
case BE_FILTER_NAME:
if (!subreq) {
return;
}
return;
case BE_FILTER_IDNUM:
errno = 0;
return;
}
if (!subreq) {
return;
}
return;
default:
return;
}
}
}
{
struct tevent_req);
struct users_get_state);
int ret;
if (ret) {
}
}
{
return EOK;
}
/* =Groups-Related-Functions-(by-name,by-uid)============================= */
struct groups_get_state {
struct tevent_context *ev;
struct sdap_id_ctx *ctx;
struct sss_domain_info *domain;
const char *name;
int filter_type;
char *filter;
const char **attrs;
};
struct tevent_context *ev,
struct sdap_id_ctx *ctx,
const char *name,
int filter_type,
int attrs_type)
{
struct groups_get_state *state;
const char *attr_name;
int ret;
switch(filter_type) {
case BE_FILTER_NAME:
break;
case BE_FILTER_IDNUM:
break;
default:
goto fail;
}
goto fail;
}
/* TODO: handle attrs_type */
if (!sdap_connected(ctx)) {
/* FIXME: add option to decide if tls should be used
if (!subreq) {
goto fail;
}
return req;
}
if (!subreq) {
goto fail;
}
return req;
fail:
return req;
}
{
struct tevent_req);
struct groups_get_state);
int ret;
if (ret) {
DEBUG(0, ("Authentication mechanism not Supported by server"));
}
return;
}
if (!subreq) {
return;
}
}
{
struct tevent_req);
struct groups_get_state);
char *endptr;
int ret;
return;
}
/* it was an enumeration */
return;
}
switch (state->filter_type) {
case BE_FILTER_NAME:
if (!subreq) {
return;
}
return;
case BE_FILTER_IDNUM:
errno = 0;
return;
}
if (!subreq) {
return;
}
return;
default:
return;
}
}
}
{
struct tevent_req);
struct groups_get_state);
int ret;
if (ret) {
}
}
{
return EOK;
}
/* =Get-Groups-for-User================================================== */
struct groups_by_user_state {
struct tevent_context *ev;
struct sdap_id_ctx *ctx;
const char *name;
const char **attrs;
};
struct tevent_context *ev,
struct sdap_id_ctx *ctx,
const char *name)
{
struct groups_by_user_state *state;
int ret;
if (!sdap_connected(ctx)) {
/* FIXME: add option to decide if tls should be used
if (!subreq) {
goto fail;
}
return req;
}
if (!subreq) {
goto fail;
}
return req;
fail:
return req;
}
{
struct tevent_req);
struct groups_by_user_state);
int ret;
if (ret) {
DEBUG(0, ("Authentication mechanism not Supported by server"));
}
return;
}
if (!subreq) {
return;
}
}
{
struct tevent_req);
int ret;
if (ret) {
return;
}
}
{
return EOK;
}
/* =Get-Account-Info-Call================================================= */
/* FIXME: embed this function in sssd_be and only call out
* specific functions from modules ? */
{
struct sdap_id_ctx *ctx;
struct be_acct_req *ar;
struct tevent_req *req;
const char *err = "Unknown Error";
}
case BE_REQ_USER: /* user */
/* skip enumerations on demand */
}
if (!req) {
}
break;
case BE_REQ_GROUP: /* group */
}
/* skip enumerations on demand */
if (!req) {
}
break;
case BE_REQ_INITGROUPS: /* init groups for user */
err = "Invalid filter type";
break;
}
err = "Invalid attr type";
break;
}
err = "Invalid filter value";
break;
}
ar->filter_value);
/* tevent_req_set_callback(req, groups_by_user_done, breq); */
break;
default: /*fail*/
err = "Invalid request type";
}
}
{
struct sdap_id_ctx *ctx;
int ret;
if (ret) {
error = "Enum Users Failed";
struct sdap_id_ctx);
if (sdap_check_gssapi_reconnect(ctx)) {
return;
}
}
}
}
{
struct sdap_id_ctx *ctx;
int ret;
if (ret) {
error = "Enum Groups Failed";
struct sdap_id_ctx);
if (sdap_check_gssapi_reconnect(ctx)) {
return;
}
}
}
}
{
struct sdap_id_ctx *ctx;
int ret;
if (ret) {
error = "Init Groups Failed";
struct sdap_id_ctx);
if (sdap_check_gssapi_reconnect(ctx)) {
return;
}
}
}
}