ldap_id_enum.c revision 476b2f491e248b182c0f6c3461028b61a8a87ab7
/*
SSSD
LDAP Identity Enumeration
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 <errno.h>
#include <time.h>
#include "providers/ldap/ldap_common.h"
#include "providers/ldap/sdap_async.h"
struct tevent_context *ev,
struct sdap_id_ctx *ctx);
/* ==Enumeration-Task===================================================== */
struct sdap_id_ctx *ctx);
struct tevent_timer *te,
struct tevent_timer *tt,
{
struct tevent_timer *timeout;
struct tevent_req *req;
int delay;
/* schedule starting from now, not the last run */
return;
}
if (!req) {
/* schedule starting from now, not the last run */
}
return;
}
/* if enumeration takes so long, either we try to enumerate too
* frequently, or something went seriously wrong */
/* If we can't guarantee a timeout, we
* need to cancel the request, to avoid
* the possibility of starting another
* concurrently
*/
/* schedule starting from now, not the last run */
}
return;
}
return;
}
struct tevent_timer *te,
{
struct sdap_id_ctx);
int delay;
}
{
struct sdap_id_ctx);
enum tevent_req_state tstate;
int delay;
/* On error schedule starting from now, not the last run */
tv = tevent_timeval_current();
} else {
}
}
{
struct tevent_timer *enum_task;
if (!enum_task) {
DEBUG(0, ("FATAL: failed to setup enumeration task!\n"));
return EFAULT;
}
return EOK;
}
#define MAX_ENUM_RESTARTS 3
struct global_enum_state {
struct tevent_context *ev;
struct sdap_id_ctx *ctx;
bool purge;
int restarts;
};
struct tevent_context *ev,
struct sdap_id_ctx *ctx,
bool purge);
struct tevent_context *ev,
struct sdap_id_ctx *ctx,
bool purge);
struct sdap_id_ctx *ctx)
{
struct global_enum_state *state;
int t;
} else {
}
if (!subreq) {
return NULL;
}
return req;
}
{
struct tevent_req);
struct global_enum_state);
enum tevent_req_state tstate;
int ret;
if (tstate != TEVENT_REQ_USER_ERROR) {
}
goto fail;
}
}
if (!subreq) {
goto fail;
}
return;
fail:
if (err) {
}
}
}
}
{
struct tevent_req);
struct global_enum_state);
enum tevent_req_state tstate;
int ret;
if (tstate != TEVENT_REQ_USER_ERROR) {
}
goto fail;
}
}
if (!subreq) {
goto fail;
}
return;
}
return;
fail:
/* check if credentials are expired otherwise go offline on failures */
}
}
}
{
struct tevent_req);
}
struct tevent_immediate *im,
void *private_data)
{
struct tevent_req);
struct global_enum_state);
struct tevent_req *subreq;
return;
}
}
{
struct global_enum_state);
struct tevent_immediate *im;
return ELOOP;
}
if (!im) {
return ENOMEM;
}
/* schedule a completely new event to avoid deep recursions */
return EOK;
}
struct tevent_immediate *im,
void *private_data)
{
struct tevent_req);
struct global_enum_state);
struct tevent_req *subreq;
return;
}
}
{
struct global_enum_state);
struct tevent_immediate *im;
return ELOOP;
}
if (!im) {
return ENOMEM;
}
/* schedule a completely new event to avoid deep recursions */
return EOK;
}
/* ==User-Enumeration===================================================== */
struct enum_users_state {
struct tevent_context *ev;
struct sdap_id_ctx *ctx;
char *filter;
const char **attrs;
};
struct tevent_context *ev,
struct sdap_id_ctx *ctx,
bool purge)
{
struct enum_users_state *state;
int ret;
"(&(%s=*)(objectclass=%s)(%s>=%s)(!(%s=%s)))",
} else {
"(&(%s=*)(objectclass=%s))",
}
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 enum_users_state);
int ret;
if (ret) {
DEBUG(0, ("Authentication mechanism not Supported by server"));
}
return;
}
if (!subreq) {
return;
}
}
{
struct tevent_req);
struct enum_users_state);
char *timestamp;
int ret;
if (ret) {
return;
}
if (timestamp) {
}
}
/* =Group-Enumeration===================================================== */
struct enum_groups_state {
struct tevent_context *ev;
struct sdap_id_ctx *ctx;
char *filter;
const char **attrs;
};
struct tevent_context *ev,
struct sdap_id_ctx *ctx,
bool purge)
{
struct enum_groups_state *state;
const char *attr_name;
int ret;
"(&(%s=*)(objectclass=%s)(%s>=%s)(!(%s=%s)))",
} else {
"(&(%s=*)(objectclass=%s))",
}
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 enum_groups_state);
int ret;
if (ret) {
DEBUG(0, ("Authentication mechanism not Supported by server"));
}
return;
}
if (!subreq) {
return;
}
}
{
struct tevent_req);
struct enum_groups_state);
char *timestamp;
int ret;
if (ret) {
return;
}
if (timestamp) {
}
}