/*
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2016 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 <ldb.h>
#include <talloc.h>
#include <tevent.h>
#include "responder/common/cache_req/cache_req_private.h"
#include "responder/common/cache_req/cache_req_plugin.h"
{
"This request type does not support negative cache\n");
return EOK;
}
"Checking negative cache for [%s]\n",
"[%s] does not exist (negative cache)\n",
return ENOENT;
"Unable to check negative cache [%d]: %s\n",
return ret;
}
"[%s] is not present in negative cache\n",
return EOK;
}
{
"This request type does not support negative cache\n");
return;
}
"Cannot set negative cache for [%s] [%d]: %s\n",
/* not fatal */
}
return;
}
struct ldb_result **_result)
{
"Bug: No cache lookup function specified\n");
return ERR_INTERNAL;
}
"Looking up [%s] in cache\n",
}
switch (ret) {
case EOK:
"Multiple objects were found when "
"only one was expected!\n");
ret = ERR_INTERNAL;
goto done;
}
break;
case ENOENT:
"Object [%s] was not found in cache\n",
break;
default:
"Unable to lookup [%s] in cache [%d]: %s\n",
break;
}
done:
}
return ret;
}
struct ldb_result *result,
const char **_string,
const char **_flag)
{
"Bug: No dpreq params function specified\n");
return ERR_INTERNAL;
}
"Creating DP request parameters\n");
"Unable to create DP request parameters [%d]: %s\n",
return ret;
}
return EOK;
}
struct tevent_req *subreq,
{
char *err_msg;
"Could not get account info [%d]: %s\n",
"Due to an error we will return cached data\n");
}
if (err_maj) {
"Data Provider Error: %u, %u, %s\n",
"Due to an error we will return cached data\n");
}
return;
}
static enum cache_object_status
struct ldb_result *result)
{
return CACHE_OBJECT_MISSING;
}
return CACHE_OBJECT_VALID;
return CACHE_OBJECT_MIDPOINT;
}
return CACHE_OBJECT_EXPIRED;
}
struct cache_req_search_state {
/* input data */
/* output data */
};
enum cache_object_status status);
struct tevent_req *
struct tevent_context *ev,
{
return NULL;
}
goto done;
}
goto done;
}
if (status == CACHE_OBJECT_VALID) {
goto done;
}
goto done;
}
return req;
done:
} else {
}
return req;
}
enum cache_object_status status)
{
const char *extra_flag;
const char *search_str;
return ret;
}
switch (status) {
case CACHE_OBJECT_MIDPOINT:
/* Out of band update. The calling function will return the cached
* entry immediately. We need to use rctx so the request is not
* removed when state is freed. */
"Performing midpoint cache update of [%s]\n",
"data provider request\n");
/* This is non-fatal, so we'll continue here */
} else {
}
return EOK;
case CACHE_OBJECT_EXPIRED:
case CACHE_OBJECT_MISSING:
"Looking up [%s] in data provider\n",
"Out of memory sending data provider request\n");
return ENOMEM;
}
return EAGAIN;
default:
/* error */
"Unexpected status [%d]\n", status);
return ret;
}
}
{
return;
}
{
/* Get result from cache again. */
return;
return;
}
return;
}
struct tevent_req *req,
struct ldb_result **_result)
{
return EOK;
}