bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek/*
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek SSSD
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek KCM Server - the KCM ccache database interface
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek This file should only be included from the ccache.c module.
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek Copyright (C) Red Hat, 2016
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek This program is free software; you can redistribute it and/or modify
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek it under the terms of the GNU General Public License as published by
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek the Free Software Foundation; either version 3 of the License, or
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek (at your option) any later version.
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek This program is distributed in the hope that it will be useful,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek but WITHOUT ANY WARRANTY; without even the implied warranty of
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek GNU General Public License for more details.
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek You should have received a copy of the GNU General Public License
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek along with this program. If not, see <http://www.gnu.org/licenses/>.
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek*/
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek#ifndef _KCMSRV_CCACHE_BE_
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek#define _KCMSRV_CCACHE_BE_
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek#include "config.h"
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek#include <talloc.h>
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek#include "responder/kcm/kcmsrv_ccache.h"
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef errno_t
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_init_fn)(struct kcm_ccdb *db);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef struct tevent_req *
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_nextid_send_fn)(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_context *ev,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb *db,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct cli_creds *client);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef errno_t
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_nextid_recv_fn)(struct tevent_req *req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek unsigned int *_nextid);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef struct tevent_req *
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_set_default_send_fn)(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_context *ev,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb *db,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct cli_creds *client,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek uuid_t uuid);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef errno_t
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_set_default_recv_fn)(struct tevent_req *req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef struct tevent_req *
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_get_default_send_fn)(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_context *ev,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb *db,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct cli_creds *client);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef errno_t
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_get_default_recv_fn)(struct tevent_req *req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek uuid_t dfl);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef struct tevent_req *
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_list_send_fn)(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_context *ev,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb *db,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct cli_creds *client);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef errno_t
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_list_recv_fn)(struct tevent_req *req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek uuid_t **_uuid_list);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef struct tevent_req *
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_getbyname_send_fn)(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_context *ev,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb *db,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct cli_creds *client,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek const char *name);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef errno_t
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_getbyname_recv_fn)(struct tevent_req *req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccache **_cc);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef struct tevent_req *
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_getbyuuid_send_fn)(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_context *ev,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb *db,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct cli_creds *client,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek uuid_t uuid);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef errno_t
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_getbyuuid_recv_fn)(struct tevent_req *req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccache **_cc);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef struct tevent_req *
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_name_by_uuid_send_fn)(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_context *ev,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb *db,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct cli_creds *client,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek uuid_t uuid);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef errno_t
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_name_by_uuid_recv_fn)(struct tevent_req *req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek const char **_name);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef struct tevent_req *
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_uuid_by_name_send_fn)(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_context *ev,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb *db,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct cli_creds *client,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek const char *name);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef errno_t
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_uuid_by_name_recv_fn)(struct tevent_req *req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek uuid_t _uuid);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef struct tevent_req *
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_create_send_fn)(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_context *ev,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb *db,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct cli_creds *client,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccache *cc);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef errno_t
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_create_recv_fn)(struct tevent_req *req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef struct tevent_req *
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_mod_send_fn)(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_context *ev,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb *db,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct cli_creds *client,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek uuid_t uuid,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_mod_ctx *mod_cc);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef errno_t
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_mod_recv_fn)(struct tevent_req *req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef struct tevent_req *
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*kcm_ccdb_store_cred_blob_send_fn)(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_context *ev,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb *db,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct cli_creds *client,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek uuid_t uuid,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct sss_iobuf *cred_blob);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef errno_t
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*kcm_ccdb_store_cred_blob_recv_fn)(struct tevent_req *req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef struct tevent_req *
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_delete_send_fn)(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_context *ev,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb *db,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct cli_creds *client,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek uuid_t uuid);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozektypedef errno_t
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek(*ccdb_delete_recv_fn)(struct tevent_req *req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek/*
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek * Each ccache back end (for example memory or secrets) must implement
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek * all these functions. The functions are wrapped by the kcm_ccdb
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek * interface that performs additional sanity checks or contains shared
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek * logic such as access checks but in general doesn't assume anything
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek * about how the operations work.
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek */
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct kcm_ccdb_ops {
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_init_fn init;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_nextid_send_fn nextid_send;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_nextid_recv_fn nextid_recv;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_set_default_send_fn set_default_send;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_set_default_recv_fn set_default_recv;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_get_default_send_fn get_default_send;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_get_default_recv_fn get_default_recv;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_list_send_fn list_send;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_list_recv_fn list_recv;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_getbyname_send_fn getbyname_send;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_getbyname_recv_fn getbyname_recv;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_getbyuuid_send_fn getbyuuid_send;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_getbyuuid_recv_fn getbyuuid_recv;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_name_by_uuid_send_fn name_by_uuid_send;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_name_by_uuid_recv_fn name_by_uuid_recv;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_uuid_by_name_send_fn uuid_by_name_send;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_uuid_by_name_recv_fn uuid_by_name_recv;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_create_send_fn create_send;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_create_recv_fn create_recv;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_mod_send_fn mod_send;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_mod_recv_fn mod_recv;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek kcm_ccdb_store_cred_blob_send_fn store_cred_send;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek kcm_ccdb_store_cred_blob_recv_fn store_cred_recv;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_delete_send_fn delete_send;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ccdb_delete_recv_fn delete_recv;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek};
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekextern const struct kcm_ccdb_ops ccdb_mem_ops;
35c9dfe9ba78d3a635cd1af0fb6349ba44344623Jakub Hrozekextern const struct kcm_ccdb_ops ccdb_sec_ops;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek#endif /* _KCMSRV_CCACHE_BE_ */