ldap_id_cleanup.c revision ed80c73efa51780a39dfc9c72821cf88e95d264c
/*
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 sss_domain_info *domain);
struct tevent_context *ev,
struct sdap_id_ctx *ctx)
{
struct global_cleanup_state *state;
int ret;
goto fail;
}
if (!subreq) {
goto fail;
}
return req;
fail:
return req;
}
{
struct tevent_req);
enum tevent_req_state tstate;
if (tstate != TEVENT_REQ_USER_ERROR) {
}
goto fail;
}
}
return;
fail:
}
/* ==User-Cleanup-Process================================================= */
const struct ldb_message *msg);
{
struct ldb_message **msgs;
const char *name;
int ret;
int i;
if (!tmpctx) {
return ENOMEM;
}
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;
}
if (count == 0) {
goto done;
}
/* get_uid_table returns ENOSYS on non-Linux platforms. We proceed with
* the cleanup in that case
*/
goto done;
}
for (i = 0; i < count; i++) {
if (!name) {
goto done;
}
if (uid_table) {
/* If the user is logged in, proceed to the next one */
continue;
goto done;
}
}
/* If not logged in or cannot check the table, delete him */
if (ret) {
goto done;
}
}
done:
return ret;
}
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;
}
/* ==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;
}
}