/*
SSSD
KCM Server - ccache in-memory storage
Copyright (C) Red Hat, 2016
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 "config.h"
#include <talloc.h>
#include <stdio.h>
#include "responder/kcm/kcmsrv_ccache_pvt.h"
#include "responder/kcm/kcmsrv_ccache_be.h"
struct ccdb_mem;
/*
* The KCM memory database is just a double-linked list of kcm_ccache structures
*/
struct ccache_mem_wrap {
bool is_default;
};
struct ccdb_mem {
/* Both ccaches and the next-id are kept in memory */
unsigned int nextid;
};
/* In order to provide a consistent interface, we need to let the caller
* of getbyXXX own the ccache, therefore the memory back end returns a shallow
* copy of the ccache
*/
struct kcm_ccache *in)
{
return NULL;
}
return out;
}
{
/* since KCM stores ccaches, better not crash.. */
continue;
}
break;
}
}
}
return out;
}
const char *name)
{
/* since KCM stores ccaches, better not crash.. */
continue;
}
break;
}
}
}
return out;
}
/* Since with the in-memory database, the database operations are just
* fake-async wrappers around otherwise sync operations, we don't often
* need any state, so we use this empty structure instead
*/
struct ccdb_mem_dummy_state {
};
{
return 0;
}
}
}
return 0;
}
{
return ENOMEM;
}
return EOK;
}
struct ccdb_mem_nextid_state {
unsigned int nextid;
};
struct tevent_context *ev,
{
return NULL;
}
goto immediate;
}
} else {
}
return req;
}
unsigned int *_nextid)
{
struct ccdb_mem_nextid_state);
return EOK;
}
struct ccdb_mem_list_state {
};
struct tevent_context *ev,
{
return NULL;
}
num_ccaches++;
}
}
goto immediate;
}
cc_index = 0;
cc_index++;
}
}
} else {
}
return req;
}
uuid_t **_uuid_list)
{
struct ccdb_mem_list_state);
return EOK;
}
struct tevent_context *ev,
{
return NULL;
}
/* Reset all ccache defaults first */
/* since KCM stores ccaches, better not crash.. */
continue;
}
ccwrap->is_default = false;
}
}
/* Then set the default for the right ccache. This also allows to
* pass a null uuid to just reset the old ccache (for example after
* deleting the default
*/
ccwrap->is_default = true;
}
return req;
}
{
return EOK;
}
struct ccdb_mem_get_default_state {
};
struct tevent_context *ev,
{
return NULL;
}
/* Reset all ccache defaults first */
/* since KCM stores ccaches, better not crash.. */
continue;
}
break;
}
}
"No ccache marked as default, returning null ccache\n");
} else {
}
return req;
}
{
struct ccdb_mem_get_default_state);
return EOK;
}
struct ccdb_mem_getbyuuid_state {
};
struct tevent_context *ev,
{
return NULL;
}
goto immediate;
}
}
} else {
}
return req;
}
struct kcm_ccache **_cc)
{
struct ccdb_mem_getbyuuid_state);
return EOK;
}
struct ccdb_mem_getbyname_state {
};
struct tevent_context *ev,
const char *name)
{
return NULL;
}
goto immediate;
}
}
} else {
}
return req;
}
struct kcm_ccache **_cc)
{
struct ccdb_mem_getbyname_state);
return EOK;
}
struct ccdb_mem_name_by_uuid_state {
const char *name;
};
struct tevent_context *ev,
{
return NULL;
}
goto immediate;
}
goto immediate;
}
} else {
}
return req;
}
const char **_name)
{
struct ccdb_mem_name_by_uuid_state);
return EOK;
}
struct ccdb_mem_uuid_by_name_state {
};
struct tevent_context *ev,
const char *name)
{
return NULL;
}
goto immediate;
}
} else {
}
return req;
}
{
struct ccdb_mem_uuid_by_name_state);
return EOK;
}
struct tevent_context *ev,
struct kcm_ccache *cc)
{
return NULL;
}
goto immediate;
}
} else {
}
return req;
}
{
return EOK;
}
struct tevent_context *ev,
struct kcm_mod_ctx *mod_cc)
{
return NULL;
}
/* UUID is immutable, so search by that */
goto immediate;
}
} else {
}
return req;
}
{
return EOK;
}
struct tevent_context *ev,
{
return NULL;
}
goto immediate;
}
"Cannot store credentials to ccache [%d]: %s\n",
goto immediate;
}
} else {
}
return req;
}
{
return EOK;
}
struct tevent_context *ev,
{
return NULL;
}
"BUG: Attempting to free unknown ccache\n");
goto immediate;
}
/* Destructor takes care of everything */
} else {
}
return req;
}
{
return EOK;
}
.init = ccdb_mem_init,
};