sysdb.c revision 95d3cb8d4ff2e3e8fdc186f2ebf617fd29ddfdec
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd System Database
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd This program is free software; you can redistribute it and/or modify
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd it under the terms of the GNU General Public License as published by
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd the Free Software Foundation; either version 3 of the License, or
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd (at your option) any later version.
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd This program is distributed in the hope that it will be useful,
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd but WITHOUT ANY WARRANTY; without even the implied warranty of
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "util/strtonum.h"
#include "db/sysdb_private.h"
#include <time.h>
int ret;
const char *mod_path;
return EINVAL;
if (!ldb) {
return EIO;
return EIO;
return EIO;
return EOK;
char **sanitized)
return ENOMEM;
if (!*sanitized) {
return ret;
const char *domain,
const char *subtree_name)
char *clean_subtree;
return NULL;
if (dn) {
return dn;
const char *subtree_name)
char *clean_name;
char *clean_subtree;
if (!tmp_ctx) {
return NULL;
goto done;
goto done;
done:
return dn;
char *clean_name;
return NULL;
return dn;
char *clean_name;
return NULL;
return dn;
char *clean_name;
return NULL;
return dn;
const char *domain)
if (!tmp_ctx) {
return ENOMEM;
goto done;
if (_name) {
goto done;
if (!*_name) {
goto done;
goto done;
if (!*_val) {
goto done;
done:
return ret;
const char *domain)
e = &(attrs->a[i]);
if (!e && alloc) {
if (!e) return ENOMEM;
attrs->a = e;
return ENOENT;
*el = e;
return EOK;
const char **string)
int ret;
if (ret) {
return ret;
return ERANGE;
return EOK;
int ret;
char *endptr;
if (ret) {
return ret;
return ERANGE;
errno = 0;
return EOK;
bool *value)
int ret;
if (ret) {
return ret;
return ERANGE;
*value = true;
*value = false;
return EOK;
int ret;
if (ret) {
return ret;
if (a == NULL) {
return ENOMEM;
if (a[u] == NULL) {
talloc_free(a);
return ENOMEM;
*string = a;
return EOK;
int ret;
return ret;
return ENOMEM;
return EOK;
struct ldb_val v;
if(value) {
int ret;
return ret;
return EOK;
struct ldb_val v;
char *str;
int ret;
return ret;
struct ldb_val v;
char *str;
int ret;
return ret;
struct ldb_val v;
char *str;
int ret;
return ret;
const char *attr_name,
const char *domain,
const char *const *list)
int i, j, num;
char *member;
int ret;
if (ret) {
return ret;
if (!vals) {
return ENOMEM;
if (!member) {
return EOK;
const char *attr_name,
const char *domain,
int num_values)
char *member;
int ret;
if (ret) {
return ret;
if (!vals) {
return ENOMEM;
if (!member) {
return ENOMEM;
return EOK;
char *ret;
struct ldb_val v;
char *tmp;
if (!tmp) {
return NULL;
if (!ret) {
return NULL;
return ret;
if (!ret) {
return NULL;
return ret;
switch (ldberr) {
case LDB_SUCCESS:
return EOK;
case LDB_ERR_OPERATIONS_ERROR:
return EIO;
case LDB_ERR_NO_SUCH_OBJECT:
return ENOENT;
case LDB_ERR_BUSY:
return EBUSY;
return EEXIST;
return EFAULT;
int ret;
int ret;
int ret;
const char *db_path,
bool allow_upgrade,
char *ldb_file;
if (!ldb_file) {
return ENOMEM;
return EOK;
return ret;
const char **ver)
const char *mdn;
char *domain;
int ret, i, j;
if (!tmp_ctx) {
goto done;
if (!basedn) {
goto done;
goto done;
goto done;
if (!el) {
if (!msg) {
goto done;
goto done;
goto done;
if (!domain) {
goto done;
if (!mem_dn) {
goto done;
if (!mdn) {
goto done;
goto done;
goto done;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
goto done;
done:
return ret;
const char *db_path)
char *ldb_file;
bool do_02_upgrade = false;
bool ctx_trans = false;
int ret;
if (!tmp_ctx) {
return ENOMEM;
goto exit;
return ret;
if (!verdn) {
goto exit;
goto exit;
goto exit;
if (el) {
goto exit;
if (!version) {
goto exit;
goto exit;
do_02_upgrade = true;
if (!do_02_upgrade) {
goto exit;
goto exit;
return ret;
goto exit;
goto done;
goto done;
ctx_trans = true;
if (!domain_dn) {
goto done;
goto done;
if (!users_dn) {
goto done;
if (!groups_dn) {
goto done;
goto done;
goto done;
ctx_trans = false;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
goto done;
goto exit;
done:
if (ctx_trans) {
exit:
return ret;
int ret;
if (!tmp_ctx) {
return ENOMEM;
goto done;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
goto done;
done:
return ret;
int ret;
if (!tmp_ctx) {
return ENOMEM;
goto done;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
goto done;
if (!msg) {
goto done;
goto done;
goto done;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
goto done;
done:
return ret;
int ret;
if (!tmp_ctx) {
return ENOMEM;
goto done;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
goto done;
done:
return ret;
int ret;
if (!tmp_ctx) {
return ENOMEM;
goto done;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
goto done;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
goto done;
done:
return ret;
const char *db_path,
bool allow_upgrade,
const char *base_ldif;
int ret;
if (!sysdb) {
return ENOMEM;
goto done;
goto done;
if (!tmp_ctx) {
goto done;
if (!verdn) {
goto done;
goto done;
goto done;
if (el) {
goto done;
if (!version) {
goto done;
goto done;
if (!allow_upgrade) {
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
done:
return ret;
const char *alt_db_path,
bool allow_upgrade,
int ret;
if (!ctx_list) {
return ENOMEM;
if (alt_db_path) {
return ENOMEM;
return ret;
if (allow_upgrade) {
return ret;
struct sysdb_ctx *,
return ENOMEM;
return ret;
return ENOENT;
return EOK;
const char *db_path,
const char *path,
int ret;
if (!list) {
return ENOMEM;
goto fail;
if (sysdb) {
goto fail;
return EOK;
fail:
return ret;
return EOK;
return EOK;
return ENOENT;
struct ldb_message);
struct ldb_message);
const char *newname)
const char *dummy;
e = &(attrs->a[i]);
return EEXIST;
if (e != NULL) {
return ENOMEM;
return EOK;
int attr_count,
const char *attr_name,
char ***_list)
int attr_idx;
char **list;
char **tmp_list;
int list_idx;
if (!list) {
return ENOMEM;
list_idx = 0;
list,
return ENOMEM;
list_idx++;
if (!tmp_list) {
return ENOMEM;
return EOK;
bool *has_enumerated)
int lret;
NULL};
if (!tmp_ctx) {
goto done;
if (!base_dn) {
goto done;
goto done;
*has_enumerated = false;
goto done;
goto done;
done:
return ret;
bool enumerated)
int lret;
if (!tmp_ctx) {
goto done;
if (!dn) {
goto done;
goto done;
if (!msg) {
goto done;
goto done;
goto done;
goto done;
goto done;
done:
return ret;
const char *ldap_attr,
const char **_primary)
size_t i;
if (!tmp_ctx) {
return ENOMEM;
goto done;
goto done;
if (ret) {
goto done;
goto done;
&rdn_attr,
&rdn_val);
goto done;
goto done;
goto done;
goto done;
done:
return ret;
const char *primary,
const char ***_aliases)
const char *name;
if (!tmp_ctx) {
return ENOMEM;
goto done;
if (!aliases) {
goto done;
ai = 0;
ai++;
done:
return ret;
const char *ldap_attr,
char ***name_list)
size_t i, j;
char **list;
const char *name;
if (!list) {
return ENOMEM;
for (i = 0; i < attr_count; i++) {
attr_list[i],
&name);
if (!list[j]) {
goto done;
done:
return ret;