sysdb.c revision 2c5bf74c71443f1680fef4fc0daa4a4c9dd10ad8
fa9e4066f08beec538e775443c5be79dd423fcabahrens System Database
fa9e4066f08beec538e775443c5be79dd423fcabahrens Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock This program is free software; you can redistribute it and/or modify
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock it under the terms of the GNU General Public License as published by
fa9e4066f08beec538e775443c5be79dd423fcabahrens the Free Software Foundation; either version 3 of the License, or
fa9e4066f08beec538e775443c5be79dd423fcabahrens (at your option) any later version.
fa9e4066f08beec538e775443c5be79dd423fcabahrens This program is distributed in the hope that it will be useful,
fa9e4066f08beec538e775443c5be79dd423fcabahrens but WITHOUT ANY WARRANTY; without even the implied warranty of
fa9e4066f08beec538e775443c5be79dd423fcabahrens MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa9e4066f08beec538e775443c5be79dd423fcabahrens GNU General Public License for more details.
fa9e4066f08beec538e775443c5be79dd423fcabahrens You should have received a copy of the GNU General Public License
fa9e4066f08beec538e775443c5be79dd423fcabahrens along with this program. If not, see <http://www.gnu.org/licenses/>.
fa9e4066f08beec538e775443c5be79dd423fcabahrensstruct ldb_dn *sysdb_custom_subtree_dn(struct sysdb_ctx *ctx, void *memctx,
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock const char *domain,
fa9e4066f08beec538e775443c5be79dd423fcabahrens return ldb_dn_new_fmt(memctx, ctx->ldb, SYSDB_TMPL_CUSTOM_SUBTREE,
fa9e4066f08beec538e775443c5be79dd423fcabahrensstruct ldb_dn *sysdb_custom_dn(struct sysdb_ctx *ctx, void *memctx,
fa9e4066f08beec538e775443c5be79dd423fcabahrens return ldb_dn_new_fmt(memctx, ctx->ldb, SYSDB_TMPL_CUSTOM, object_name,
95173954d2b811ceb583a9012c3b16e1d0dd6438ekstruct ldb_dn *sysdb_user_dn(struct sysdb_ctx *ctx, void *memctx,
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;
return ENOMEM;
return EOK;
struct ldb_val v;
int 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 **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;
if (!te) {
bool start_next = false;
int ret;
start_next = true;
struct sysdb_get_handle_state {
if (!handle) {
return NULL;
return req;
struct sysdb_get_handle_state);
return EOK;
struct sysdb_transaction_state {
if (!subreq) {
return NULL;
return req;
struct tevent_req);
struct sysdb_transaction_state);
int ret;
if (ret) {
struct sysdb_transaction_state);
return EOK;
int ret;
return req;
struct sysdb_transaction_state);
return EOK;
struct tevent_req);
int ret;
if (ret) {
struct sysdb_operation_state {
if (!subreq) {
return NULL;
return req;
struct tevent_req);
struct sysdb_operation_state);
int ret;
if (ret) {
struct sysdb_operation_state);
return EOK;
const char *db_path,
bool allow_upgrade,
char *ldb_file;
if (!ldb_file) {
return ENOMEM;
return EOK;
const char **ver)
const char *mdn;
char *domain;
int ret, i, j;
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 EIO;
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;
if (!ldb) {
goto exit;
goto exit;
#ifdef SYSDB_TEST
goto exit;
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;
if (!ldb) {
goto exit;
goto exit;
goto exit;
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;
const char *db_path,
bool allow_upgrade,
const char *base_ldif;
int ret;
if (!ctx) {
return ENOMEM;
return ret;
return EIO;
return EIO;
#ifdef SYSDB_TEST
return EIO;
if (!tmp_ctx) {
return ENOMEM;
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;
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,
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;