/*
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 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;
}
5 /* enabled delay */, 0 /* random offset */,
&sdom->cleanup_task);
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 ldb_message *user);
struct sss_domain_info *dom)
{
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;
}
count = 0;
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 */
"User %s is still logged in or a dummy entry, "
"keeping data\n", name);
continue;
"Cannot check if user is logged in: %d\n", ret);
goto done;
}
}
/* If not logged in or cannot check the table, delete him */
if (ret) {
goto done;
}
/* Mark all groups of which user was a member as expired in cache,
* request. */
"expire_memberof_target_groups failed: [%d]:%s\n",
goto done;
}
}
done:
return ret;
}
struct ldb_message *user)
{
return ENOMEM;
}
if (memberof_el == NULL) {
/* User has no cached groups. Nothing to be marked as expired. */
goto done;
}
for (unsigned int i = 0; i < memberof_el->num_values; i++) {
&memberof_el->values[i]);
"sysdb_mark_entry_as_expired_ldb_val failed: [%d]: %s\n",
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;
int ret;
int i;
const char *posix;
if (!tmpctx) {
return ENOMEM;
}
SYSDB_CACHE_EXPIRE, (long)now);
if (!subfilter) {
goto done;
}
count = 0;
goto done;
}
if (count == 0) {
goto done;
}
for (i = 0; i < count; i++) {
char *sanitized_dn;
if (!dn) {
goto done;
}
/* sanitize dn */
"sss_filter_sanitize failed: %s:[%d]\n",
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;
}
"Failed to search sysdb using %s: [%d] %s\n",
goto done;
}
}
done:
return ret;
}