negcache.c revision e35fa36e5c005986978cc7463f54dc29d3eacd66
/*
SSSD
NSS Responder
Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
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 <fcntl.h>
#include <time.h>
#include "tdb.h"
#define NC_ENTRY_PREFIX "NCE/"
struct sss_nc_ctx {
struct tdb_context *tdb;
};
{
return EOK;
}
{
struct sss_nc_ctx *ctx;
errno = 0;
/* open a memory only tdb with default hash size */
return EOK;
};
{
unsigned long long int timestamp;
bool expired = false;
char *ep;
int ret;
goto done;
}
if (ttl == -1) {
/* a negative ttl means: never expires */
goto done;
}
errno = 0;
/* Malformed entry, remove it and return no entry */
expired = true;
goto done;
}
if (timestamp == 0) {
/* a 0 timestamp means this is a permanent entry */
goto done;
}
/* still valid */
goto done;
}
expired = true;
done:
if (expired) {
/* expired, remove and return no entry */
}
return ret;
}
{
char *timest;
int ret;
if (permanent) {
} else {
}
if (ret != 0) {
}
done:
return ret;
}
{
char *str;
int ret;
return ret;
}
{
char *str;
int ret;
return ret;
}
{
char *str;
int ret;
return ret;
}
{
char *str;
int ret;
return ret;
}
{
char *str;
int ret;
return ret;
}
{
char *str;
int ret;
return ret;
}
{
char *str;
int ret;
return ret;
}
{
char *str;
int ret;
return ret;
}
{
unsigned long long int timestamp;
bool remove_key = false;
char *ep;
NC_ENTRY_PREFIX, sizeof(NC_ENTRY_PREFIX)) != 0) {
/* not interested in this key */
return 0;
}
errno = 0;
/* Malformed entry, remove it */
remove_key = true;
goto done;
}
if (timestamp == 0) {
/* a 0 timestamp means this is a permanent entry */
remove_key = true;
}
done:
if (remove_key) {
}
return 0;
}
{
int ret;
if (ret < 0)
return EIO;
return EOK;
}
struct confdb_ctx *cdb,
struct sss_names_ctx *names_ctx,
struct sss_domain_info *domain_list)
{
bool filter_set = false;
char **filter_list = NULL;
char *domainname = NULL;
int i;
/* Populate domain-specific negative cache entries */
if (!conf_path) {
goto done;
}
&filter_list);
filter_set = true;
for (i = 0; (filter_list && filter_list[i]); i++) {
&domainname, &name);
filter_list[i], ret));
continue;
}
"set in FQN (%s), skipping user %s\n",
continue;
}
" (%d [%s])\n", filter_list[i],
continue;
}
}
}
if (!filter_set) {
if (!filter_list) {
goto done;
}
if (!filter_list[0]) {
goto done;
}
}
}
for (i = 0; (filter_list && filter_list[i]); i++) {
&domainname, &name);
filter_list[i], ret));
continue;
}
if (domainname) {
" (%d [%s])\n", filter_list[i],
continue;
}
} else {
" [%s:%s] (%d [%s])\n",
continue;
}
}
}
}
filter_set = false;
if (!conf_path) {
goto done;
}
filter_set = true;
for (i = 0; (filter_list && filter_list[i]); i++) {
&domainname, &name);
filter_list[i], ret));
continue;
}
"set in FQN (%s), skipping group %s\n",
continue;
}
" (%d [%s])\n", filter_list[i],
continue;
}
}
}
if (!filter_set) {
if (!filter_list) {
goto done;
}
if (!filter_list[0]) {
goto done;
}
}
}
for (i = 0; (filter_list && filter_list[i]); i++) {
&domainname, &name);
filter_list[i], ret));
continue;
}
if (domainname) {
" [%s] (%d [%s])\n", filter_list[i],
continue;
}
} else {
" [%s:%s] (%d [%s])\n",
continue;
}
}
}
}
done:
return ret;
}