sysdb_selinux.c revision 8bbf89c5ab798c112773fe23515c3a9df56dde71
/*
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 */
struct ldb_message *old_msg,
struct sysdb_attrs *new_attrs,
struct ldb_message **_msg)
{
struct ldb_message *rm_msg;
const char *tmp_str;
int i;
goto done;
}
rm_msg->num_elements = 0;
for (i = 0; i < old_msg->num_elements; i++) {
continue;
}
rm_msg->num_elements++;
}
done:
} else {
}
return ret;
}
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)
{
struct ldb_message *msg;
struct ldb_message *rm_msg;
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;
}
in_transaction = true;
if (type == SELINUX_CONFIG) {
} else if (type == SELINUX_USER_MAP) {
}
goto done;
}
goto done;
}
goto done;
}
/* Now delete attributes which are no longer present */
goto done;
}
if (rm_msg->num_elements > 0) {
}
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;
}
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 ldb_message **usermaps;
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]);
}
}
goto done;
}
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;
}