ldap_id_cleanup.c revision 16ef1ec0d10d24703351d02bbd7d0c2255da4359
/*
SSSD
LDAP Identity Cleanup 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 <errno.h>
#include <time.h>
#include "util/find_uid.h"
#include "providers/ldap/ldap_common.h"
#include "providers/ldap/sdap_async.h"
/* ==Cleanup-Task========================================================= */
struct tevent_context *ev,
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 cleanup takes so long, either we try to cleanup too
* frequently, or something went seriously wrong */
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 *cleanup_task;
if (!cleanup_task) {
DEBUG(0, ("FATAL: failed to setup cleanup task!\n"));
return EFAULT;
}
return EOK;
}
struct global_cleanup_state {
struct tevent_context *ev;
struct sdap_id_ctx *ctx;
};
struct tevent_context *ev,
struct sdap_id_ctx *ctx);
struct tevent_context *ev,
struct sss_domain_info *domain);
struct tevent_context *ev,
struct sdap_id_ctx *ctx)
{
struct global_cleanup_state *state;
if (!subreq) {
return NULL;
}
return req;
}
{
struct tevent_req);
struct global_cleanup_state);
enum tevent_req_state tstate;
if (tstate != TEVENT_REQ_USER_ERROR) {
}
goto fail;
}
}
if (!subreq) {
goto fail;
}
return;
fail:
}
{
struct tevent_req);
enum tevent_req_state tstate;
if (tstate != TEVENT_REQ_USER_ERROR) {
}
goto fail;
}
}
return;
fail:
}
/* ==User-Cleanup-Process================================================= */
struct cleanup_users_state {
struct tevent_context *ev;
struct sss_domain_info *domain;
struct sdap_id_ctx *ctx;
struct sysdb_handle *handle;
struct ldb_message **msgs;
int cur;
};
const struct ldb_message *msg);
struct tevent_context *ev,
struct sdap_id_ctx *ctx)
{
struct tevent_req *req;
struct cleanup_users_state *state;
int ret;
if (!req) {
return NULL;
}
if (account_cache_expiration > 0) {
"(&(!(%s=0))(%s<=%ld)(|(!(%s=*))(%s<=%ld)))",
(long) now,
} else {
"(&(!(%s=0))(%s<=%ld)(!(%s=*)))",
(long) now,
}
if (!subfilter) {
goto done;
}
if (ret) {
}
goto done;
}
goto done;
}
/* get_uid_table returns ENOSYS on non-Linux platforms. We proceed with
* the cleanup in that case
*/
goto done;
}
if (ret != 0) {
goto done;
}
return req;
done:
return req;
}
{
struct tevent_req *subreq;
struct cleanup_users_state);
const char *name;
int ret;
SYSDB_NAME, NULL);
if (!name) {
return 1;
}
/* If the user is logged in, proceed to the next one */
return cleanup_users_next(req);
return 1;
}
}
/* If not logged in or cannot check the table, delete him */
if (!subreq) {
return 1;
}
return 0;
}
const struct ldb_message *msg)
{
int ret;
SYSDB_UIDNUM, 0);
if (!uid) {
return EFAULT;
}
if (ret == HASH_SUCCESS) {
return EOK;
} else if (ret == HASH_ERROR_KEY_NOT_FOUND) {
return ENOENT;
}
return EIO;
}
{
struct cleanup_users_state);
return cleanup_users_delete(req);
}
return 1;
}
{
struct tevent_req);
int ret;
if (ret) {
return;
}
}
/* ==Group-Cleanup-Process================================================ */
struct cleanup_groups_state {
struct tevent_context *ev;
struct sss_domain_info *domain;
struct sysdb_handle *handle;
struct ldb_message **msgs;
int cur;
};
struct tevent_context *ev,
struct sss_domain_info *domain)
{
struct cleanup_groups_state *state;
char *subfilter;
if (!req) {
return NULL;
}
SYSDB_CACHE_EXPIRE, (long)now);
if (!subfilter) {
return NULL;
}
if (!subreq) {
return NULL;
}
return req;
}
{
struct tevent_req);
struct cleanup_groups_state);
int ret;
if (ret) {
return;
}
return;
}
}
}
{
struct cleanup_groups_state);
const char *subfilter;
const char *dn;
struct ldb_message **msgs;
int ret;
if (!dn) {
return;
}
SYSDB_MEMBEROF, dn);
if (!subfilter) {
}
return;
}
return;
}
}
{
struct cleanup_groups_state);
return;
}
}
{
struct tevent_req *subreq;
struct cleanup_groups_state);
const char *name;
SYSDB_NAME, NULL);
if (!name) {
return;
}
if (!subreq) {
return;
}
}
{
struct tevent_req);
int ret;
if (ret) {
return;
}
}