sysdb_views.c revision ca49ae1eee321751681e99f3ebe2547211db3bf6
/*
SSSD
System Database - View and Override related calls
Copyright (C) 2014 Sumit Bose <sbose@redhat.com>
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 "db/sysdb_private.h"
/* In general is should not be possible that there is a view container without
* a view name set. But to be on the safe side we return both information
* separately. */
char **_view_name,
bool *view_container_exists)
{
const char *tmp_str;
struct ldb_dn *view_base_dn;
struct ldb_result *res;
const char *attrs[] = {SYSDB_VIEW_NAME,
NULL};
return ENOMEM;
}
if (view_base_dn == NULL) {
goto done;
}
if (ret != LDB_SUCCESS) {
goto done;
}
goto done;
}
*view_container_exists = false;
goto done;
} else {
*view_container_exists = true;
NULL);
goto done;
}
}
done:
return ret;
}
char **view_name)
{
bool view_container_exists;
}
const char *view_name)
{
char *tmp_str;
bool view_container_exists = false;
bool add_view_name = false;
struct ldb_message *msg;
return ENOMEM;
}
goto done;
}
/* view name already known, nothing to do */
goto done;
} else {
/* view name changed */
/* not supported atm */
"View name changed from [%s] to [%s]. NOT SUPPORTED.\n",
goto done;
}
}
add_view_name = true;
goto done;
}
goto done;
}
NULL);
if (ret != LDB_SUCCESS) {
goto done;
}
if (ret != LDB_SUCCESS) {
goto done;
}
if (view_container_exists) {
} else {
}
if (ret != LDB_SUCCESS) {
goto done;
}
done:
return ret;
}
struct sysdb_attrs *attrs,
const char *name_override)
{
int ret;
return ENOMEM;
}
if (!domain->case_sensitive) {
} else {
fq_name);
}
"sysdb_attrs_add_lc_name_alias failed.\n");
return ret;
}
}
if (!domain->case_sensitive) {
"sysdb_attrs_add_lc_name_alias failed.\n");
return ret;
}
}
return EOK;
}
const char *view_name,
enum sysdb_member_type type,
{
const char *anchor;
int ret;
struct ldb_dn *override_dn;
const char *override_dn_str;
const char *obj_dn_str;
const char *obj_attrs[] = { SYSDB_OBJECTCLASS,
NULL};
struct ldb_message **msgs;
const char *obj_override_dn;
bool add_ref = true;
size_t c;
bool in_transaction = false;
bool has_override = true;
const char *name_override;
goto done;
}
has_override = true;
&anchor);
"Missing anchor in override attributes.\n");
goto done;
}
if (override_dn == NULL) {
goto done;
}
} else {
/* if there is no override for the given object, just store the DN of
* the object iself in the SYSDB_OVERRIDE_DN attribute to indicate
* that it was checked if an override exists and none was found. */
has_override = false;
}
goto done;
}
} else {
}
goto done;
}
if (count != 1) {
goto done;
}
NULL);
if (obj_override_dn != NULL) {
"Existing [%s] and new [%s] override DN do not match.\n",
goto done;
}
add_ref = false;
}
return sysdb_error_to_errno(ret);
}
in_transaction = true;
if (has_override) {
"ldb_delete failed, maybe object did not exist. Ignoring.\n");
}
"add_aliases_for_name_override failed.\n");
goto done;
}
goto done;
}
goto done;
}
goto done;
}
}
if (ret != LDB_SUCCESS) {
goto done;
}
switch(type) {
case SYSDB_MEMBER_USER:
break;
case SYSDB_MEMBER_GROUP:
break;
default:
goto done;
}
if (ret != LDB_SUCCESS) {
goto done;
}
NULL);
if (ret != LDB_SUCCESS) {
goto done;
}
if (ret != LDB_SUCCESS) {
goto done;
}
if (ret != LDB_SUCCESS) {
"Failed to store override entry: %s(%d)[%s]\n",
goto done;
}
}
if (add_ref) {
goto done;
}
NULL);
if (ret != LDB_SUCCESS) {
goto done;
}
if (ret != LDB_SUCCESS) {
goto done;
}
if (ret != LDB_SUCCESS) {
"Failed to store override DN: %s(%d)[%s]\n",
goto done;
}
}
done:
if (in_transaction) {
} else {
}
}
return ret;
}