bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek KCM Server - the KCM ccache operations
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek Copyright (C) Red Hat, 2016
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 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 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 Hrozekstatic int kcm_cc_destructor(struct kcm_ccache *cc)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek const char *name,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek DEBUG(SSSDBG_CRIT_FAILURE, "Name %s is malformed\n", name);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek kret = krb5_copy_principal(k5c, princ, &cc->client);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek const char *err_msg = sss_krb5_get_error_message(k5c, kret);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "krb5_copy_principal failed: [%d][%s]\n", kret, err_msg);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekconst char *kcm_cc_get_name(struct kcm_ccache *cc)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_cc_get_uuid(struct kcm_ccache *cc, uuid_t _uuid)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekkrb5_principal kcm_cc_get_client_principal(struct kcm_ccache *cc)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek return false;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek /* root can access any ccache */
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek return true;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ok = ((cc->owner.uid == uid) && (cc->owner.gid == gid));
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Client %"SPRIuid":%"SPRIgid" has no access to ccache %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekint32_t kcm_cc_get_offset(struct kcm_ccache *cc)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_cc_store_cred_blob(struct kcm_ccache *cc,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct kcm_cred *kcm_cc_get_cred(struct kcm_ccache *cc)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct kcm_cred *kcm_cc_next_cred(struct kcm_cred *crd)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct kcm_cred *kcm_cred_new(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek kcreds = talloc_zero(mem_ctx, struct kcm_cred);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek kcreds->cred_blob = talloc_steal(kcreds, cred_blob);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek/* Add a cred to ccache */
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_cc_store_creds(struct kcm_ccache *cc,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_cred_get_uuid(struct kcm_cred *crd, uuid_t _uuid)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct sss_iobuf *kcm_cred_get_creds(struct kcm_cred *crd)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct kcm_ccdb *kcm_ccdb_init(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek DEBUG(SSSDBG_FUNC_DATA, "KCM back end: memory\n");
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek DEBUG(SSSDBG_FUNC_DATA, "KCM back end: sssd-secrets\n");
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek DEBUG(SSSDBG_CRIT_FAILURE, "Unknown ccache database\n");
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek DEBUG(SSSDBG_CRIT_FAILURE, "Ccache database not initialized\n");
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek DEBUG(SSSDBG_CRIT_FAILURE, "Cannot initialize ccache database\n");
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_nextid_done(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct tevent_req *kcm_ccdb_nextid_send(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek req = tevent_req_create(mem_ctx, &state, struct kcm_ccdb_nextid_state);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek if (ev == NULL || db == NULL || client == NULL) {
3e4fe6cc59419ce4c178e9ad31cd1069ab375e9bJakub Hrozek subreq = state->db->ops->nextid_send(state, ev, state->db, client);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_nextid_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_nextid_done(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_nextid_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ret = state->db->ops->nextid_recv(subreq, &nextid);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to generate next UID [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek state->next_cc = talloc_asprintf(state, "%"SPRIuid":%u",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf failed\n");
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek DEBUG(SSSDBG_TRACE_LIBS, "generated %s\n", state->next_cc);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_ccdb_nextid_recv(struct tevent_req *req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_nextid_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek *_next_cc = talloc_steal(mem_ctx, state->next_cc);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_list_done(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct tevent_req *kcm_ccdb_list_send(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek req = tevent_req_create(mem_ctx, &state, struct kcm_ccdb_list_state);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek if (ev == NULL || db == NULL || client == NULL) {
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_list_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_list_done(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_list_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ret = state->db->ops->list_recv(subreq, state, &state->uuid_list);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to list all ccaches [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_ccdb_list_recv(struct tevent_req *req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_list_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek *_uuid_list = talloc_steal(mem_ctx, state->uuid_list);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_get_default_done(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct tevent_req *kcm_ccdb_get_default_send(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_get_default_state *state = NULL;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek req = tevent_req_create(mem_ctx, &state, struct kcm_ccdb_get_default_state);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek if (ev == NULL || db == NULL || client == NULL) {
3e4fe6cc59419ce4c178e9ad31cd1069ab375e9bJakub Hrozek subreq = db->ops->get_default_send(state, ev, db, client);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_get_default_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_get_default_done(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_get_default_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ret = state->db->ops->get_default_recv(subreq, state->uuid);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to get the default ccache [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_ccdb_get_default_recv(struct tevent_req *req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_get_default_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek /* The caller might supply a NULL dfl to just check if there is
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek * some default ccache
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_set_default_uuid_resolved(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_set_default_done(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct tevent_req *kcm_ccdb_set_default_send(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_set_default_state *state = NULL;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek req = tevent_req_create(mem_ctx, &state, struct kcm_ccdb_set_default_state);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek if (ev == NULL || db == NULL || client == NULL) {
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek /* NULL UUID means to just reset the default to 'no default' */
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek subreq = state->db->ops->set_default_send(state,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_set_default_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek /* Otherwise we need to check if the client can access the UUID
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek * about to be set as default
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek subreq = db->ops->getbyuuid_send(state, ev, db, client, uuid);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_set_default_uuid_resolved, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_set_default_uuid_resolved(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_set_default_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ret = state->db->ops->getbyuuid_recv(subreq, state, &cc);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to get cache by UUID [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek DEBUG(SSSDBG_TRACE_LIBS, "No cache found by UUID\n");
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek subreq = state->db->ops->set_default_send(state,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_set_default_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_set_default_done(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_set_default_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ret = state->db->ops->set_default_recv(subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to set the default ccache [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_ccdb_set_default_recv(struct tevent_req *req)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_getbyname_done(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct tevent_req *kcm_ccdb_getbyname_send(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek const char *name)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek req = tevent_req_create(mem_ctx, &state, struct kcm_ccdb_getbyname_state);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek if (ev == NULL || db == NULL || client == NULL || name == NULL) {
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek subreq = db->ops->getbyname_send(state, ev, db, client, name);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_getbyname_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_getbyname_done(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_getbyname_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ret = state->db->ops->getbyname_recv(subreq, state, &state->cc);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to get cache by name [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek DEBUG(SSSDBG_TRACE_LIBS, "No cache found by name\n");
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_ccdb_getbyname_recv(struct tevent_req *req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_getbyname_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_getbyuuid_done(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct tevent_req *kcm_ccdb_getbyuuid_send(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek req = tevent_req_create(mem_ctx, &state, struct kcm_ccdb_getbyuuid_state);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek if (ev == NULL || db == NULL || client == NULL) {
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek subreq = db->ops->getbyuuid_send(state, ev, db, client, uuid);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_getbyuuid_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_getbyuuid_done(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_getbyuuid_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ret = state->db->ops->getbyuuid_recv(subreq, state, &state->cc);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to get cache by UUID [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek DEBUG(SSSDBG_TRACE_LIBS, "No cache found by UUID\n");
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_ccdb_getbyuuid_recv(struct tevent_req *req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_getbyuuid_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_name_by_uuid_done(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct tevent_req *kcm_ccdb_name_by_uuid_send(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_name_by_uuid_state *state = NULL;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek if (ev == NULL || db == NULL || client == NULL || uuid_is_null(uuid)) {
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek subreq = db->ops->name_by_uuid_send(state, ev, db, client, uuid);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_name_by_uuid_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_name_by_uuid_done(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_name_by_uuid_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ret = state->db->ops->name_by_uuid_recv(subreq, state, &state->name);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to resolve cache by UUID [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_ccdb_name_by_uuid_recv(struct tevent_req *req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek const char **_name)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_name_by_uuid_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_uuid_by_name_done(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct tevent_req *kcm_ccdb_uuid_by_name_send(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek const char *name)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_uuid_by_name_state *state = NULL;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek if (ev == NULL || db == NULL || client == NULL || name == NULL) {
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek subreq = db->ops->uuid_by_name_send(state, ev, db, client, name);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_uuid_by_name_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_uuid_by_name_done(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_uuid_by_name_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ret = state->db->ops->uuid_by_name_recv(subreq, state, state->uuid);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to resolve cache by UUID [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_ccdb_uuid_by_name_recv(struct tevent_req *req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_uuid_by_name_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_create_done(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct tevent_req *kcm_ccdb_create_cc_send(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek req = tevent_req_create(mem_ctx, &state, struct kcm_ccdb_create_cc_state);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek if (ev == NULL || db == NULL || client == NULL || cc == NULL) {
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_create_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_create_done(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_create_cc_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to create ccache [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_ccdb_create_cc_recv(struct tevent_req *req)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekvoid kcm_mod_ctx_clear(struct kcm_mod_ctx *mod_ctx)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekvoid kcm_mod_cc(struct kcm_ccache *cc, struct kcm_mod_ctx *mod_ctx)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_mod_done(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct tevent_req *kcm_ccdb_mod_cc_send(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek req = tevent_req_create(mem_ctx, &state, struct kcm_ccdb_mod_cc_state);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek if (ev == NULL || db == NULL || client == NULL || mod_cc == NULL) {
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_mod_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_mod_done(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_mod_cc_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to create ccache [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_ccdb_mod_cc_recv(struct tevent_req *req)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_store_cred_blob_done(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct tevent_req *kcm_ccdb_store_cred_blob_send(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_store_cred_blob_state *state = NULL;
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek req = tevent_req_create(mem_ctx, &state, struct kcm_ccdb_store_cred_blob_state);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek if (ev == NULL || db == NULL || client == NULL || cred_blob == NULL) {
3e4fe6cc59419ce4c178e9ad31cd1069ab375e9bJakub Hrozek subreq = state->db->ops->store_cred_send(state,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_store_cred_blob_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_store_cred_blob_done(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_store_cred_blob_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to create ccache [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_ccdb_store_cred_blob_recv(struct tevent_req *req)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_delete_done(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_delete_get_default_done(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_delete_default_reset_done(struct tevent_req *subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstruct tevent_req *kcm_ccdb_delete_cc_send(TALLOC_CTX *mem_ctx,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek req = tevent_req_create(mem_ctx, &state, struct kcm_ccdb_delete_cc_state);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek if (ev == NULL || db == NULL || client == NULL) {
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_delete_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_delete_done(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_delete_cc_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to delete ccache [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek /* The delete operation must also check if the deleted ccache was
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek * the default and reset the default if it was
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek subreq = state->db->ops->get_default_send(state,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_delete_get_default_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_delete_get_default_done(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_delete_cc_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ret = state->db->ops->get_default_recv(subreq, dfl_uuid);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to get the default ccache [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek if (uuid_compare(dfl_uuid, state->uuid) != 0) {
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek /* The ccache about to be deleted was not the default, quit */
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek /* If we deleted the default ccache, reset the default ccache to 'none' */
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek subreq = state->db->ops->set_default_send(state,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek tevent_req_set_callback(subreq, kcm_ccdb_delete_default_reset_done, req);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekstatic void kcm_ccdb_delete_default_reset_done(struct tevent_req *subreq)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct tevent_req *req = tevent_req_callback_data(subreq,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek struct kcm_ccdb_delete_cc_state *state = tevent_req_data(req,
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek ret = state->db->ops->set_default_recv(subreq);
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek "Failed to NULL the default ccache [%d]: %s\n",
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_ccdb_delete_cc_recv(struct tevent_req *req)
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozek if (!(debug_level & SSSDBG_TRACE_ALL) || uuid == NULL) {
bea0dc79faf609de8603cb42f190adae544bc8fbJakub Hrozekerrno_t kcm_check_name(const char *name, struct cli_creds *client)