115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose Common Responder utility functions
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose Copyright (C) Sumit Bose <sbose@redhat.com> 2014
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose This program is free software; you can redistribute it and/or modify
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose it under the terms of the GNU General Public License as published by
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose the Free Software Foundation; either version 3 of the License, or
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose (at your option) any later version.
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose This program is distributed in the hope that it will be useful,
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose but WITHOUT ANY WARRANTY; without even the implied warranty of
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose GNU General Public License for more details.
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose You should have received a copy of the GNU General Public License
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose along with this program. If not, see <http://www.gnu.org/licenses/>.
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bosestatic inline bool
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Boseattr_in_list(const char **list, size_t nlist, const char *str)
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose for (i = 0; i < nlist; i++) {
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose return (i < nlist) ? true : false;
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Boseconst char **parse_attr_list_ex(TALLOC_CTX *mem_ctx, const char *conf_str,
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose const char **defaults)
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose ret = split_on_separator(tmp_ctx, conf_str, ',', true, true,
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose "Cannot parse attribute ACL list %s: %d\n", conf_str, ret);
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose allow = talloc_zero_array(tmp_ctx, const char *, conf_list_size);
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose deny = talloc_zero_array(tmp_ctx, const char *, conf_list_size);
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose for (i = 0; i < conf_list_size; i++) {
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose switch (conf_list[i][0]) {
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose DEBUG(SSSDBG_CRIT_FAILURE, "ACL values must start with "
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose "either '+' (allow) or '-' (deny), got '%s'\n",
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose /* Assume the output will have to hold defaults and all the configured,
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose * values, resize later
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose list = talloc_zero_array(tmp_ctx, const char *, list_size + 1);
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose /* Start by copying explicitly allowed attributes */
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose for (i = 0; i < ai; i++) {
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose /* if the attribute is explicitly denied, skip it */
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose "Added allowed attr %s to whitelist\n", allow[i]);
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose /* Add defaults */
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose for (i = 0; defaults[i]; i++) {
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose /* if the attribute is explicitly denied, skip it */
115de6d50f0d0bdd5745a5d8eb0d067be9128528Sumit Bose "Added default attr %s to whitelist\n", defaults[i]);
78f9a9d4a2725f1b2cb6e582c965b5e6f7bdff7dJakub Hrozekchar *sss_resp_create_fqname(TALLOC_CTX *mem_ctx,
78f9a9d4a2725f1b2cb6e582c965b5e6f7bdff7dJakub Hrozek name = sss_get_cased_name(tmp_ctx, orig_name, dom->case_sensitive);
78f9a9d4a2725f1b2cb6e582c965b5e6f7bdff7dJakub Hrozek DEBUG(SSSDBG_CRIT_FAILURE, "sss_get_cased_name failed\n");
78f9a9d4a2725f1b2cb6e582c965b5e6f7bdff7dJakub Hrozek name = sss_reverse_replace_space(tmp_ctx, name, rctx->override_space);
78f9a9d4a2725f1b2cb6e582c965b5e6f7bdff7dJakub Hrozek DEBUG(SSSDBG_CRIT_FAILURE, "sss_reverse_replace_space failed\n");
78f9a9d4a2725f1b2cb6e582c965b5e6f7bdff7dJakub Hrozek if (name_is_upn == false) {
78f9a9d4a2725f1b2cb6e582c965b5e6f7bdff7dJakub Hrozek name = sss_create_internal_fqname(tmp_ctx, name, dom->name);
78f9a9d4a2725f1b2cb6e582c965b5e6f7bdff7dJakub Hrozek DEBUG(SSSDBG_CRIT_FAILURE, "sss_create_internal_fqname failed\n");