ldap_id_cleanup.c revision 6e3f79799ce7e736dd19ae2e05a60dc1901613f1
/*
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 ldap_id_cleanup_ctx {
struct sdap_id_ctx *ctx;
struct sdap_domain *sdom;
};
struct tevent_context *ev,
void *pvt)
{
}
struct sdap_domain *sdom)
{
if (period == 0) {
/* Cleanup has been explicitly disabled, so we won't
* create any cleanup tasks. */
goto done;
}
/* Run the first one in a couple of seconds so that we have time to
* finish initializations first. */
first_delay = 10;
if (cleanup_ctx == NULL) {
goto done;
}
return ENOMEM;
}
goto done;
}
done:
}
return ret;
}
struct sss_domain_info *dom);
struct sss_domain_info *domain);
struct sdap_domain *sdom)
{
bool in_transaction = false;
return ENOMEM;
}
goto done;
}
in_transaction = true;
goto done;
}
if (ret) {
goto done;
}
goto done;
}
in_transaction = false;
done:
if (in_transaction) {
}
}
return ret;
}
/* ==User-Cleanup-Process================================================= */
const struct ldb_message *msg);
struct sss_domain_info *dom)
{
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 */
"keeping data\n", name));
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 ENOENT;
}
if (ret == HASH_SUCCESS) {
return EOK;
} else if (ret == HASH_ERROR_KEY_NOT_FOUND) {
return ENOENT;
}
return EIO;
}
/* ==Group-Cleanup-Process================================================ */
struct sss_domain_info *domain)
{
char *subfilter;
const char *dn;
struct ldb_message **msgs;
struct ldb_message **u_msgs;
int ret;
int i;
const char *posix;
if (!tmpctx) {
return ENOMEM;
}
SYSDB_CACHE_EXPIRE, (long)now);
if (!subfilter) {
goto done;
}
if (ret) {
}
goto done;
}
if (count == 0) {
goto done;
}
for (i = 0; i < count; i++) {
if (!dn) {
goto done;
}
/* Search for users that are members of this group, or
* that have this group as their primary GID.
* Include subdomain users as well.
*/
SYSDB_GIDNUM, (long unsigned) gid);
} else {
}
if (!subfilter) {
goto done;
}
goto done;
}
const char *name;
if (!name) {
goto done;
}
if (ret) {
goto done;
}
}
goto done;
}
}
done:
return ret;
}