sysdb_selinux.c revision 894d18ff4178f40a18bbfece8fae270d8307eac6
/*
SSSD
System Database - SELinux support
Copyright (C) Jan Zeleny <jzeleny@redhat.com> 2012
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 "util/sss_selinux.h"
#include "db/sysdb_selinux.h"
#include "db/sysdb_private.h"
/* Some generic routines */
static errno_t
const char *objectclass,
struct sysdb_attrs *attrs,
{
struct ldb_message *msg;
if (!tmp_ctx) {
return ENOMEM;
}
if (!msg) {
goto done;
}
return ret;
}
if (!now) {
}
done:
if (ret) {
}
return ret;
}
struct sysdb_attrs *attrs,
enum selinux_entity_type type)
{
bool in_transaction = false;
const char *objectclass = NULL;
const char *name;
char *clean_name;
if (!tmp_ctx) {
return ENOMEM;
}
switch (type) {
case SELINUX_USER_MAP:
goto done;
}
goto done;
}
break;
case SELINUX_CONFIG:
break;
}
goto done;
}
if (!dn) {
goto done;
}
goto done;
}
in_transaction = true;
goto done;
}
goto done;
}
goto done;
}
in_transaction = false;
done:
if (in_transaction) {
}
}
if (ret) {
}
return ret;
}
struct sysdb_attrs *attrs)
{
}
const char *default_user,
const char *order)
{
struct sysdb_attrs *attrs;
return ENOMEM;
}
if (default_user) {
goto done;
}
}
order);
goto done;
}
done:
return ret;
}
{
return ret;
}
return EOK;
}
/* --- SYSDB SELinux search routines --- */
const char *name,
const char **attrs,
struct ldb_message **_usermap)
{
const char *def_attrs[] = { SYSDB_NAME,
NULL };
size_t msgs_count = 0;
char *clean_name;
int ret;
if (!tmp_ctx) {
return ENOMEM;
}
goto done;
}
if (!basedn) {
goto done;
}
if (ret) {
goto done;
}
done:
}
else if (ret) {
}
return ret;
}
const char *username,
struct ldb_message ***_usermaps)
{
const char *attrs[] = { SYSDB_NAME,
NULL };
struct sysdb_attrs *user;
struct sysdb_attrs *tmp_attrs;
struct sss_domain_info *domain;
size_t msgs_count = 0;
uint32_t host_priority = 0;
uint32_t top_priority = 0;
char *filter;
int i;
if (!tmp_ctx) {
return ENOMEM;
}
/* Now extract user attributes */
goto done;
}
/* Now extract all SELinux user maps */
if (!basedn) {
goto done;
}
goto done;
}
if (ret) {
goto done;
}
/* Now filter those that match */
goto done;
}
goto done;
}
usermaps_cnt = 0;
for (i = 0; i < msgs_count; i++) {
/* Now figure out host priority */
continue;
}
if (priority < top_priority) {
/* This rule has lower priority than what we already have,
* skip it */
continue;
} else if (priority > top_priority) {
/* If the rule has higher priority, drop what we already
* have */
while (usermaps_cnt > 0) {
usermaps_cnt--;
}
}
usermaps_cnt++;
} else {
talloc_zfree(msgs[i]);
}
}
done:
return ret;
}
const char **attrs,
struct ldb_message **_config)
{
const char *def_attrs[] = { SYSDB_SELINUX_DEFAULT_USER,
NULL };
struct ldb_message **msgs;
if (!tmp_ctx) {
return ENOMEM;
}
if (!basedn) {
goto done;
}
if (ret) {
goto done;
}
done:
} else if (ret) {
}
return ret;
}