negcache.c revision 950716d2087446205c84f00b371f468d6ead1ec2
/*
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 "responder/common/negcache_files.h"
#include "responder/common/responder.h"
#include "responder/common/negcache.h"
#include <fcntl.h>
#include <time.h>
#include "tdb.h"
#define NC_ENTRY_PREFIX "NCE/"
struct sss_nc_ctx {
struct tdb_context *tdb;
};
typedef int (*ncache_set_byname_fn_t)(struct sss_nc_ctx *, bool,
const char *, const char *);
{
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;
}
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;
}
bool permanent, bool use_local_negative)
{
char *timest;
unsigned long long int timell;
int ret;
if (permanent) {
} else {
} else {
/* EOK is tested in cwrap based unit test */
return EOK;
}
}
}
if (ret != 0) {
}
done:
return ret;
}
const char *name)
{
char *str;
int ret;
return ret;
}
{
char *str;
int ret;
return ret;
}
{
char *str;
int ret;
return ret;
}
const char *domain,
const char *name)
{
char *str;
int ret;
name);
return ret;
}
typedef int (*ncache_check_byname_fn_t)(struct sss_nc_ctx *, const char *,
const char *);
{
char *lower;
if (dom->case_sensitive == false) {
} else {
}
return ret;
}
const char *name)
{
}
const char *name)
{
}
const char *name)
{
}
{
char *str;
int ret;
return ret;
}
struct sss_domain_info *dom,
{
int ret;
name,
if (!service_and_protocol) return ENOMEM;
return ret;
}
{
int ret;
name,
if (!service_and_protocol) return ENOMEM;
return ret;
}
struct sss_domain_info *dom,
{
int ret;
port,
if (!service_and_protocol) return ENOMEM;
return ret;
}
struct sss_domain_info *dom,
const char *proto)
{
int ret;
port,
if (!service_and_protocol) return ENOMEM;
return ret;
}
{
char *str;
int ret;
uid);
} else {
}
return ret;
}
{
char *str;
int ret;
gid);
} else {
}
return ret;
}
{
char *str;
int ret;
return ret;
}
{
char *str;
int ret;
return ret;
}
{
bool use_local_negative = false;
char *str;
int ret;
if (ctx->local_timeout > 0) {
}
return ret;
}
{
bool use_local_negative = false;
char *str;
int ret;
if (ctx->local_timeout > 0) {
}
return ret;
}
{
char *str;
int ret;
return ret;
}
{
char *lower;
if (dom->case_sensitive == false) {
} else {
}
return ret;
}
{
}
{
}
{
}
{
bool use_local_negative = false;
char *str;
int ret;
uid);
} else {
}
if (ctx->local_timeout > 0) {
}
return ret;
}
{
bool use_local_negative = false;
char *str;
int ret;
gid);
} else {
}
if (ctx->local_timeout > 0) {
}
return ret;
}
{
char *str;
int ret;
return ret;
}
const char *cert)
{
char *str;
int ret;
return ret;
}
{
unsigned long long int timestamp;
bool remove_key = false;
char *ep;
/* 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,
{
bool filter_set = false;
char **filter_list = NULL;
char *domainname = NULL;
int i;
return ENOMEM;
}
/* 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++) {
filter_list[i],
&domainname, &name);
"cannot add [%s] to negcache because the required or "
"default domain are not known yet\n", filter_list[i]);
"Invalid name in filterUsers list: [%s] (%d)\n",
filter_list[i], ret);
continue;
}
"Mismatch between domain name (%s) and name "
"set in FQN (%s), skipping user %s\n",
continue;
}
continue;
}
"Failed to store permanent user filter for [%s]"
" (%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);
"Cannot add [%s] to negcache because the required or "
"default domain are not known yet\n", filter_list[i]);
"Invalid name in filterUsers list: [%s] (%d)\n",
filter_list[i], ret);
continue;
}
if (domainname) {
if (!dom) {
"Invalid domain name [%s]\n", domainname);
continue;
}
continue;
}
"Failed to store permanent user filter for [%s]"
" (%d [%s])\n", filter_list[i],
continue;
}
} else {
continue;
}
"Failed to store permanent user filter for"
" [%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);
"Invalid name in filterGroups list: [%s] (%d)\n",
filter_list[i], ret);
continue;
}
"Mismatch between domain name (%s) and name "
"set in FQN (%s), skipping group %s\n",
continue;
}
continue;
}
"Failed to store permanent group filter for [%s]"
" (%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);
"Cannot add [%s] to negcache because the required or "
"default domain are not known yet\n", filter_list[i]);
"Invalid name in filterGroups list: [%s] (%d)\n",
filter_list[i], ret);
continue;
}
if (domainname) {
if (!dom) {
"Invalid domain name [%s]\n", domainname);
continue;
}
continue;
}
"Failed to store permanent group filter for"
" [%s] (%d [%s])\n", filter_list[i],
continue;
}
} else {
continue;
}
"Failed to store permanent group filter for"
" [%s:%s] (%d [%s])\n",
continue;
}
}
}
}
done:
return ret;
}
/* Reset permanent negcache after checking the domains */
struct sss_nc_ctx *ncache)
{
int ret;
}
return ret;
}