25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina Simo Sorce <ssorce@redhat.com>
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina Copyright (C) 2013 Red Hat
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina This program is free software; you can redistribute it and/or modify
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina it under the terms of the GNU General Public License as published by
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina the Free Software Foundation; either version 3 of the License, or
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina (at your option) any later version.
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina This program is distributed in the hope that it will be useful,
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina but WITHOUT ANY WARRANTY; without even the implied warranty of
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina GNU General Public License for more details.
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina You should have received a copy of the GNU General Public License
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina along with this program. If not, see <http://www.gnu.org/licenses/>.
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březinasdap_attrs_add_ldap_attr(struct sysdb_attrs *ldap_attrs,
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina ret = sysdb_attrs_get_el(ldap_attrs, attr_name, &el);
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina DEBUG(SSSDBG_OP_FAILURE, "Could not get %s from the "
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina "list of the LDAP attributes [%d]: %s\n",
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina DEBUG(SSSDBG_TRACE_INTERNAL, "%s is not available "
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina num_values = multivalued ? el->num_values : 1;
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina for (i = 0; i < num_values; i++) {
32445affe3612428eddde043cdc672a01c189714Jakub Hrozek printable = ldb_binary_encode(ldap_attrs, el->values[i]);
32445affe3612428eddde043cdc672a01c189714Jakub Hrozek DEBUG(SSSDBG_MINOR_FAILURE, "ldb_binary_encode failed..\n");
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina DEBUG(SSSDBG_TRACE_INTERNAL, "Adding %s [%s] to attributes "
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina ret = sysdb_attrs_add_mem(attrs, attr_name, el->values[i].data,
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina ret = sysdb_attrs_get_aliases(tmp_ctx, ldap_attrs, name,
87f8bee53ee1b4ca87b602ff8536bc5fd5b5b595Lukas Slebodnik DEBUG(SSSDBG_OP_FAILURE, "Failed to get the alias list\n");
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina for (i = 0; aliases[i]; i++) {
7cc19286547260350afed9ef7176712f8fc66652Michal Zidek sysdb_alias = sss_create_internal_fqname(tmp_ctx, aliases[i],
7cc19286547260350afed9ef7176712f8fc66652Michal Zidek ret = sysdb_attrs_add_lc_name_alias(attrs, sysdb_alias);
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina DEBUG(SSSDBG_OP_FAILURE, "Failed to add lower-cased version "
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina "of alias [%s] into the "
7cc19286547260350afed9ef7176712f8fc66652Michal Zidek ret = sysdb_attrs_add_string(attrs, SYSDB_NAME_ALIAS, sysdb_alias);
25ac7bda643c8872b5a29bc856c374e76a7f8363Pavel Březina DEBUG(SSSDBG_OP_FAILURE, "Failed to add alias [%s] into the "
9a310913d696d190db14c625080678db853a33fdSumit Bose ret = sysdb_attrs_get_string_array(ldap_attrs, SYSDB_USER_EMAIL, tmp_ctx,
9a310913d696d190db14c625080678db853a33fdSumit Bose ret = sysdb_attrs_add_lc_name_alias_safe(attrs, emails[i]);
9a310913d696d190db14c625080678db853a33fdSumit Bose "Failed to add lower-cased version of email [%s] "
9a310913d696d190db14c625080678db853a33fdSumit Bose DEBUG(SSSDBG_TRACE_ALL, "No email addresses available.\n");
9a310913d696d190db14c625080678db853a33fdSumit Bose "sysdb_attrs_get_string_array failed, skipping ...\n");
44d0fd9bfdcab991f00ba33c91f49527f8cce595Pavel Březinaerrno_t deref_string_to_val(const char *str, int *val)
44d0fd9bfdcab991f00ba33c91f49527f8cce595Pavel Březina } else if (strcasecmp(str, "searching") == 0) {
44d0fd9bfdcab991f00ba33c91f49527f8cce595Pavel Březina DEBUG(SSSDBG_CRIT_FAILURE, "Illegal deref option [%s].\n", str);
1d3f5fc2802c218916e6d6bc98eeaed79c66bafePavel Březina if (extra_filter == NULL || extra_filter[0] == '\0') {
1d3f5fc2802c218916e6d6bc98eeaed79c66bafePavel Březina } else if (base_filter == NULL || base_filter[0] == '\0') {
ad5a48c4947183fda49308259e3411d17a8b0a13Pavel Březina filter = talloc_asprintf(mem_ctx, "(%c%s(%s))",
ad5a48c4947183fda49308259e3411d17a8b0a13Pavel Březina return sdap_combine_filters_ex(mem_ctx, '|', base_filter, extra_filter);
ad5a48c4947183fda49308259e3411d17a8b0a13Pavel Březinachar *sdap_combine_filters(TALLOC_CTX *mem_ctx,
ad5a48c4947183fda49308259e3411d17a8b0a13Pavel Březina return sdap_combine_filters_ex(mem_ctx, '&', base_filter, extra_filter);
50a7a92f92e1584702bf25e61a50cb1c09c7e260Sumit Bosechar *get_enterprise_principal_string_filter(TALLOC_CTX *mem_ctx,
50a7a92f92e1584702bf25e61a50cb1c09c7e260Sumit Bose const char *princ,
50a7a92f92e1584702bf25e61a50cb1c09c7e260Sumit Bose if (attr_name == NULL || princ == NULL || sdap_basic_opts == NULL) {
50a7a92f92e1584702bf25e61a50cb1c09c7e260Sumit Bose realm = dp_opt_get_cstring(sdap_basic_opts, SDAP_KRB5_REALM);
50a7a92f92e1584702bf25e61a50cb1c09c7e260Sumit Bose return talloc_asprintf(mem_ctx, "(%s=%.*s\\\\@%s@%s)", attr_name,
50a7a92f92e1584702bf25e61a50cb1c09c7e260Sumit Bose (int) (p - princ),