89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek IPA Subdomains Module - utilities
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek Sumit Bose <sbose@redhat.com>
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek Copyright (C) 2015 Red Hat
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek This program is free software; you can redistribute it and/or modify
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek it under the terms of the GNU General Public License as published by
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek the Free Software Foundation; either version 3 of the License, or
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek (at your option) any later version.
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek This program is distributed in the hope that it will be useful,
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek but WITHOUT ANY WARRANTY; without even the implied warranty of
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek GNU General Public License for more details.
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek You should have received a copy of the GNU General Public License
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek along with this program. If not, see <http://www.gnu.org/licenses/>.
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozekstruct ldb_dn *ipa_subdom_ldb_dn(TALLOC_CTX *mem_ctx,
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek ret = sysdb_attrs_get_string(attrs, SYSDB_ORIG_DN, &orig_dn);
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek DEBUG(SSSDBG_OP_FAILURE, "sysdb_attrs_get_string failed: %d\n", ret);
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek DEBUG(SSSDBG_OP_FAILURE, "ldb_dn_new failed.\n");
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek DEBUG(SSSDBG_OP_FAILURE, "Original DN [%s] is not a valid DN.\n",
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozekbool ipa_subdom_is_member_dom(struct ldb_dn *dn)
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek return false;
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek /* We are only interested in the member domain objects. In IPA the
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek * forest root object is stored as e.g.
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek * cn=AD.DOM,cn=ad,cn=trusts,dc=example,dc=com. Member domains in the
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek * forest are children of the forest root object e.g.
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek * cn=SUB.AD.DOM,cn=AD.DOM,cn=ad,cn=trusts,dc=example,dc=com. Since
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek * the forest name is not stored in the member objects we derive it
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek * from the RDN of the forest root object. */
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek "DN too short, not a member domain\n");
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek return false;
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek if (strncasecmp("trusts", (const char *) val->data, val->length) != 0) {
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek "4th component is not 'trust', not a member domain\n");
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek return false;
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek if (strncasecmp("ad", (const char *) val->data, val->length) != 0) {
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek "3rd component is not 'ad', not a member domain\n");
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek return false;
89ddc9ed474e9ac2b1e7bccb0a58610babf26cf8Jakub Hrozek return true;