/*
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"
struct sss_nc_ctx {
};
const char *, const char *);
{
return EOK;
}
{
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;
}
const char *);
{
char *lower;
if (dom->case_sensitive == false) {
} else {
}
return ret;
}
const char *name)
{
}
const char *name)
{
if (neg_cache_name == NULL) {
return ENOMEM;
}
return ret;
}
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;
}
{
}
{
if (neg_cache_name == NULL) {
return ENOMEM;
}
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;
}
struct sss_domain_info *dom,
const char *lookup_type)
{
return talloc_asprintf(mem_ctx,
"%s/%s/%s",
}
struct sss_domain_info *dom,
const char *lookup_type)
{
char *str;
int ret;
/* Permanent cache is always used here, because the lookup
* type's (getgrgid, getpwuid, ..) support locating an entry's domain
* doesn't change
*/
return ret;
}
struct sss_domain_info *dom,
const char *lookup_type)
{
char *str;
int ret;
return ret;
}
struct sss_domain_info *dom,
{
return talloc_asprintf(mem_ctx,
"%s/%s/%s/%"SPRIgid,
gid);
}
struct sss_domain_info *dom,
{
char *str;
int ret;
return EINVAL;
}
return ENOMEM;
}
return ret;
}
struct sss_domain_info *dom,
{
char *str;
int ret;
return EINVAL;
}
return ENOMEM;
}
return ret;
}
struct sss_domain_info *dom,
{
return talloc_asprintf(ctx,
"%s/%s/%s/%"SPRIuid,
uid);
}
struct sss_domain_info *dom,
{
char *str;
int ret;
return EINVAL;
}
return ENOMEM;
}
return ret;
}
struct sss_domain_info *dom,
{
char *str;
int ret;
return EINVAL;
}
return ENOMEM;
}
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;
}
{
/* not interested in this key */
return 0;
}
}
const char **prefixes)
{
int ret;
return EOK;
}
discard_const(prefixes[i]));
if (ret < 0) {
return EIO;
}
}
return EOK;
}
{
const char *prefixes[] = {
NULL,
};
}
{
const char *prefixes[] = {
NULL,
};
}
struct confdb_ctx *cdb,
{
int i;
return ENOMEM;
}
/* Populate domain-specific negative cache user entries */
if (!conf_path) {
goto done;
}
&filter_list);
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;
}
}
}
/* Populate non domain-specific negative cache user entries */
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 {
for (dom = domain_list;
continue;
}
"Failed to store permanent user filter for"
" [%s:%s] (%d [%s])\n",
continue;
}
}
}
}
/* Populate domain-specific negative cache group entries */
if (!conf_path) {
goto done;
}
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;
}
}
}
/* Populate non domain-specific negative cache group entries */
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 {
for (dom = domain_list;
continue;
}
"Failed to store permanent group filter for"
" [%s:%s] (%d [%s])\n",
continue;
}
}
}
}
/* SSSD doesn't handle "root", thus it'll be added to the negative cache
* nonetheless what's already added there. */
if (default_list == NULL) {
goto done;
}
if (default_list[0] == NULL) {
goto done;
}
/* Populate negative cache users and groups entries for the
* "default_list" */
for (dom = domain_list;
default_list[i],
continue;
}
"Failed to store permanent user filter for"
" [%s:%s] (%d [%s])\n",
continue;
}
"Failed to store permanent group filter for"
" [%s:%s] (%d [%s])\n",
continue;
}
}
}
/* Also add "root" uid and gid to the negative cache */
"Failed to store permanent uid filter for root (0) "
"(%d [%s])\n",
}
"Failed to store permanent gid filter for root (0) "
"(%d [%s])\n",
}
done:
return ret;
}
/* Reset permanent negcache after checking the domains */
struct sss_nc_ctx *ncache)
{
int ret;
}
return ret;
}