0db2f3402b37df221fbf55486769989f82df479aPavel Březina Pavel Březina <pbrezina@redhat.com>
0db2f3402b37df221fbf55486769989f82df479aPavel Březina Copyright (C) 2016 Red Hat
0db2f3402b37df221fbf55486769989f82df479aPavel Březina This program is free software; you can redistribute it and/or modify
0db2f3402b37df221fbf55486769989f82df479aPavel Březina it under the terms of the GNU General Public License as published by
0db2f3402b37df221fbf55486769989f82df479aPavel Březina the Free Software Foundation; either version 3 of the License, or
0db2f3402b37df221fbf55486769989f82df479aPavel Březina (at your option) any later version.
0db2f3402b37df221fbf55486769989f82df479aPavel Březina This program is distributed in the hope that it will be useful,
0db2f3402b37df221fbf55486769989f82df479aPavel Březina but WITHOUT ANY WARRANTY; without even the implied warranty of
0db2f3402b37df221fbf55486769989f82df479aPavel Březina MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0db2f3402b37df221fbf55486769989f82df479aPavel Březina GNU General Public License for more details.
0db2f3402b37df221fbf55486769989f82df479aPavel Březina You should have received a copy of the GNU General Public License
0db2f3402b37df221fbf55486769989f82df479aPavel Březina along with this program. If not, see <http://www.gnu.org/licenses/>.
0db2f3402b37df221fbf55486769989f82df479aPavel Březina#include "responder/common/cache_req/cache_req_private.h"
1b33f4d5c564141b888071a342403230a71983cbPavel Březinastatic const char **
1b33f4d5c564141b888071a342403230a71983cbPavel Březinacache_req_data_create_attrs(TALLOC_CTX *mem_ctx,
2e72ababbbadda4c4036f99528460c1d595e0941Lukas Slebodnik static const char *defattrs[] = { SYSDB_DEFAULT_ATTRS, SYSDB_NAME,
1b33f4d5c564141b888071a342403230a71983cbPavel Březina static size_t defnum = sizeof(defattrs) / sizeof(defattrs[0]);
1b33f4d5c564141b888071a342403230a71983cbPavel Březina for (reqnum = 0; requested[reqnum] != NULL; reqnum++);
1b33f4d5c564141b888071a342403230a71983cbPavel Březina /* We always want to get default attributes. */
1b33f4d5c564141b888071a342403230a71983cbPavel Březina attrs = talloc_zero_array(mem_ctx, const char *, total + 1);
1b33f4d5c564141b888071a342403230a71983cbPavel Březina for (i = 0; i < reqnum; i++) {
1b33f4d5c564141b888071a342403230a71983cbPavel Březina attrs[i] = talloc_strdup(attrs, requested[i]);
1b33f4d5c564141b888071a342403230a71983cbPavel Březina for (; i < total; i++) {
1b33f4d5c564141b888071a342403230a71983cbPavel Březina attrs[i] = talloc_strdup(attrs, defattrs[i - reqnum]);
0db2f3402b37df221fbf55486769989f82df479aPavel Březina data = talloc_zero(mem_ctx, struct cache_req_data);
0db2f3402b37df221fbf55486769989f82df479aPavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "talloc_zero() failed\n");
0db2f3402b37df221fbf55486769989f82df479aPavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Bug: name cannot be NULL!\n");
0db2f3402b37df221fbf55486769989f82df479aPavel Březina data->name.input = talloc_strdup(data, input->name.input);
0db2f3402b37df221fbf55486769989f82df479aPavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Bug: certificate cannot be NULL!\n");
0db2f3402b37df221fbf55486769989f82df479aPavel Březina data->cert = talloc_strdup(data, input->cert);
0db2f3402b37df221fbf55486769989f82df479aPavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Bug: SID cannot be NULL!\n");
2e13817e64ff1e0e47dc844be501f2d3ab299f34Pavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Bug: name cannot be NULL!\n");
2e13817e64ff1e0e47dc844be501f2d3ab299f34Pavel Březina data->svc.name->input = talloc_strdup(data, input->svc.name->input);
2e13817e64ff1e0e47dc844be501f2d3ab299f34Pavel Březina data->svc.protocol.name = talloc_strdup(data, input->svc.protocol.name);
c2fc9459c31cb1192ab3c15ce4df1c150e99bf95Pavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Bug: port cannot be 0!\n");
c2fc9459c31cb1192ab3c15ce4df1c150e99bf95Pavel Březina data->svc.protocol.name = talloc_strdup(data, input->svc.protocol.name);
53c31b83e4d06ea4c2813eec2f1e647a613b4a2bPavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Bug: name cannot be NULL!\n");
53c31b83e4d06ea4c2813eec2f1e647a613b4a2bPavel Březina data->name.input = talloc_strdup(data, input->name.input);
53c31b83e4d06ea4c2813eec2f1e647a613b4a2bPavel Březina data->alias = talloc_strdup(data, input->alias);
0db2f3402b37df221fbf55486769989f82df479aPavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Invalid cache request type!\n");
1b33f4d5c564141b888071a342403230a71983cbPavel Březina data->attrs = cache_req_data_create_attrs(data, input->attrs);
0db2f3402b37df221fbf55486769989f82df479aPavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create cache_req data "
0db2f3402b37df221fbf55486769989f82df479aPavel Březina return cache_req_data_create(mem_ctx, type, &input);
488518dde58724daa13b9216a0f1af6e0ba5401fPavel Březina const char **attrs)
488518dde58724daa13b9216a0f1af6e0ba5401fPavel Březina return cache_req_data_create(mem_ctx, type, &input);
0db2f3402b37df221fbf55486769989f82df479aPavel Březina return cache_req_data_create(mem_ctx, type, &input);
3be2628d8aba6aeb99ac1484da990f1fad8169ecPavel Březina const char **attrs)
3be2628d8aba6aeb99ac1484da990f1fad8169ecPavel Březina return cache_req_data_create(mem_ctx, type, &input);
0db2f3402b37df221fbf55486769989f82df479aPavel Březina return cache_req_data_create(mem_ctx, type, &input);
0db2f3402b37df221fbf55486769989f82df479aPavel Březina const char *sid,
0db2f3402b37df221fbf55486769989f82df479aPavel Březina const char **attrs)
0db2f3402b37df221fbf55486769989f82df479aPavel Březina return cache_req_data_create(mem_ctx, type, &input);
a79acee185654d110c0e35ba351368d664e4e53dPavel Březina return cache_req_data_create(mem_ctx, type, &input);
2e13817e64ff1e0e47dc844be501f2d3ab299f34Pavel Březina return cache_req_data_create(mem_ctx, type, &input);
53c31b83e4d06ea4c2813eec2f1e647a613b4a2bPavel Březina const char **attrs)
53c31b83e4d06ea4c2813eec2f1e647a613b4a2bPavel Březina return cache_req_data_create(mem_ctx, type, &input);
189db5329db0277425bb3bdd785c19aee23bb364Fabiano Fidênciocache_req_data_set_bypass_cache(struct cache_req_data *data,
189db5329db0277425bb3bdd785c19aee23bb364Fabiano Fidêncio DEBUG(SSSDBG_CRIT_FAILURE, "cache_req_data should never be NULL\n");
52e675ec4b160720515c81ae8c0e5a95feb50c57Sumit Bosecache_req_data_set_bypass_dp(struct cache_req_data *data,
52e675ec4b160720515c81ae8c0e5a95feb50c57Sumit Bose DEBUG(SSSDBG_CRIT_FAILURE, "cache_req_data should never be NULL\n");