/*
SSSD
Authors:
Fabiano FidĂȘncio <fidencio@redhat.com>
Copyright (C) 2017 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "providers/ldap/ldap_common.h"
#include "providers/ldap/sdap_async_private.h"
#include "providers/ipa/ipa_rules_common.h"
#include "providers/ipa/ipa_deskprofile_private.h"
#include "providers/ipa/ipa_deskprofile_rules.h"
#include "providers/ipa/ipa_deskprofile_rules_util.h"
struct ipa_deskprofile_rule_state {
int search_base_iter;
const char **attrs;
char *rules_filter;
char *cur_filter;
};
static errno_t
struct ipa_deskprofile_rule_state *state);
static void
struct tevent_req *
struct tevent_context *ev,
struct sdap_handle *sh,
struct sdap_options *opts,
struct sdap_search_base **search_bases,
struct sysdb_attrs *ipa_host,
struct sss_domain_info *domain,
const char *username)
{
char *user;
char *group;
char *host_dn_clean;
char *group_clean;
char *host_group_clean;
char *rule_filter;
const char *host_dn;
const char **memberof_list;
char **groups_list;
return NULL;
}
goto immediate;
}
goto immediate;
}
goto immediate;
}
state->search_base_iter = 0;
"deskprofile_get_attrs_get_cached_rules() failed\n");
goto immediate;
}
"(&(objectclass=%s)"
"(%s=%s)"
"(|(%s=%s)(%s=%s)(%s=%s)",
IPA_HOST_CATEGORY, "all",
IPA_USER_CATEGORY, "all",
if (rule_filter == NULL) {
goto immediate;
}
/* Add all parent groups of ipa_hostname to the filter */
state, &memberof_list);
/* This host is not a member of any hostgroups */
if (memberof_list == NULL) {
goto immediate;
}
memberof_list[0] = NULL;
}
memberof_list[i],
"sss_filter_sanitize() failed [%d]: %s\n",
goto immediate;
}
if (rule_filter == NULL) {
goto immediate;
}
}
/* Add the username to the filter */
"sss_parse_internal_fqname() failed [%d]: %s\n",
goto immediate;
}
if (rule_filter == NULL) {
goto immediate;
}
/* Add all parent groups of `username` to the filter */
&groups_list);
goto immediate;
}
"sss_filter_sanitize() failed [%d]: %s\n",
goto immediate;
}
"sss_parse_internal_fqname() failed [%d]: %s\n",
goto immediate;
}
if (rule_filter == NULL) {
goto immediate;
}
}
if (rule_filter == NULL) {
goto immediate;
}
/* ipa_deskprofile_rule_info_next should always have a search base
* when called for the first time.
*
* For the subsequent iterations, not finding any more search bases
* is fine though (thus the function returns EOK).
*
* As, here, it's the first case happening, let's return EINVAL.
*/
}
goto immediate;
}
return req;
} else {
}
return req;
}
static errno_t
struct ipa_deskprofile_rule_state *state)
{
return EOK;
}
return ENOMEM;
}
"Sending request for next search base: [%s][%d][%s]\n",
NULL, 0,
true);
return ENOMEM;
}
return EAGAIN;
}
static void
{
int i;
&rules);
"Could not retrieve Desktop Profile rules\n");
goto fail;
}
if (rule_count > 0) {
struct sysdb_attrs *,
goto fail;
}
i = 0;
state->rule_count++;
i++;
}
}
return;
goto fail;
return;
}
/* We went through all search bases and we have some results */
return;
fail:
}
struct sysdb_attrs ***_rules)
{
return EOK;
}