sss_cache.c revision 8a1738f9379a1b8fb5c95c3df649e014ff5a1434
/*
SSSD
sss_cache
Copyright (C) Jan Zeleny <jzeleny@redhat.com> 2011
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 <stdio.h>
#include <stdlib.h>
#include <talloc.h>
#include <popt.h>
#include "tools/sss_sync_ops.h"
#define INVALIDATE_NONE 0
#define INVALIDATE_USERS 1
#define INVALIDATE_GROUPS 2
#define INVALIDATE_NETGROUPS 4
#define TYPE_USER 0
#define TYPE_GROUP 1
#define TYPE_NETGROUP 2
struct entry_type_t {
const char *type_string;
const char *, const char **, size_t *, struct ldb_message ***);
};
static struct entry_type_t entry_types[] = {
{"user", sysdb_search_users},
{"group", sysdb_search_groups},
{"netgroup", sysdb_search_netgroups}
};
struct cache_tool_ctx {
struct confdb_ctx *confdb;
struct sss_domain_info *domains;
struct sysdb_ctx_list *sysdb_list;
char *user_filter;
char *group_filter;
char *netgroup_filter;
};
const char *name, int entry_type);
int entry_type, const char *filter);
{
int i;
goto done;
}
goto done;
}
}
}
done:
return ret;
}
int entry_type, const char *filter)
{
struct ldb_message **msgs;
struct entry_type_t type_rec;
int i;
const char *c_name;
if (filter) {
return;
}
for (i = 0; i < msg_count; i++) {
SYSDB_NAME));
} else {
c_name));
c_name);
}
}
}
}
}
const char *name, int entry_type)
{
if (sys_attrs) {
SYSDB_CACHE_EXPIRE, 1);
switch (entry_type) {
case TYPE_USER:
break;
case TYPE_GROUP:
break;
case TYPE_NETGROUP:
break;
default:
return EINVAL;
}
}
} else {
}
} else {
}
return ret;
}
char *confdb_path;
int ret;
if (confdb_path == NULL) {
return ENOMEM;
}
/* Connect to the conf db */
return ret;
}
if (domain) {
goto fail;
}
goto fail;
}
goto fail;
}
} else {
goto fail;
}
}
return EOK;
fail:
if (ctx->sysdb_list) {
} else {
}
return ret;
}
{
int idb = INVALIDATE_NONE;
int debug = 0;
struct poptOption long_options[] = {
0, _("The debug level to run with"), NULL },
_("Invalidate particular user"), NULL },
_("Invalidate all users"), NULL },
_("Invalidate particular group"), NULL },
_("Invalidate all groups"), NULL },
_("Invalidate particular netgroup"), NULL },
_("Invalidate all netgroups"), NULL },
_("Only invalidate entries from a particular domain"), NULL },
};
ret = set_locale();
ERROR("Error setting the locale\n");
goto fini;
}
switch (ret) {
case 'u':
idb |= INVALIDATE_USERS;
break;
case 'g':
idb |= INVALIDATE_GROUPS;
break;
case 'n':
break;
}
}
if (ret != -1) {
}
debug_level = debug;
debug_prg_name = argv[0];
goto fini;
}
if (idb & INVALIDATE_USERS) {
} else if (user) {
}
if (idb & INVALIDATE_GROUPS) {
} else if (group) {
}
if (idb & INVALIDATE_NETGROUPS) {
} else if (netgroup) {
netgroup);
}
goto fini;
}
goto fini;
}
fini:
}
}
return ret;
}