b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina Pavel Březina <pbrezina@redhat.com>
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina Copyright (C) 2015 Red Hat
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina This program is free software; you can redistribute it and/or modify
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina it under the terms of the GNU General Public License as published by
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina the Free Software Foundation; either version 3 of the License, or
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina (at your option) any later version.
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina This program is distributed in the hope that it will be useful,
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina but WITHOUT ANY WARRANTY; without even the implied warranty of
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina GNU General Public License for more details.
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina You should have received a copy of the GNU General Public License
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina along with this program. If not, see <http://www.gnu.org/licenses/>.
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina /* check RDN attribute */
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina if (ldbattr == NULL || strcasecmp(ldbattr, rdn_attr) != 0) {
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina return false;
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina /* Check DN components. First we check if all attr=value pairs match input.
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina * Then we check that the next attribute is a domain component.
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina while ((attr = va_arg(ap, const char *)) != NULL) {
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina ldbattr = ldb_dn_get_component_name(dn, comp);
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina if (ldbattr == NULL || strcasecmp(ldbattr, attr) != 0) {
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina if (strval == NULL || strncasecmp(strval, val, ldbval->length) != 0) {
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina ldbattr = ldb_dn_get_component_name(dn, comp);
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina if (ldbattr == NULL || strcmp(ldbattr, "dc") != 0) {
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina return false;
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina return false;
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina dn = ldb_dn_new(mem_ctx, sysdb_ctx_get_ldb(sysdb), obj_dn);
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina if (bret == false) {
b407fe0474a674bb42f0f42ab47c7f530a07a367Pavel Březina rdn = talloc_strndup(mem_ctx, (const char*)val->data, val->length);