diff options
author | Simo Sorce <ssorce@redhat.com> | 2010-03-21 00:09:04 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-04-12 09:22:16 -0400 |
commit | aacf8781c61e928c74fcc89f02225374b283b872 (patch) | |
tree | 0547820fd01df558084a399450cf30ddad93fd8d /src | |
parent | aafa0393524bacc5ba48e79ab536f9deb3972e38 (diff) | |
download | sssd_unused-aacf8781c61e928c74fcc89f02225374b283b872.tar.gz sssd_unused-aacf8781c61e928c74fcc89f02225374b283b872.tar.xz sssd_unused-aacf8781c61e928c74fcc89f02225374b283b872.zip |
sysdb: remove obsolete helpers from sysdb
Diffstat (limited to 'src')
-rw-r--r-- | src/db/sysdb.h | 8 | ||||
-rw-r--r-- | src/db/sysdb_search.c | 150 |
2 files changed, 0 insertions, 158 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h index 08af3125..87a5ec56 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -243,9 +243,6 @@ int sysdb_get_ctx_from_list(struct sysdb_ctx_list *ctx_list, struct sss_domain_info *domain, struct sysdb_ctx **_ctx); -/* FIXME: REMOVE */ -typedef void (*sysdb_callback_t)(void *, int, struct ldb_result *); - /* functions to retrieve information from sysdb * These functions automatically starts an operation * therefore they cannot be called within a transaction */ @@ -424,11 +421,6 @@ int sysdb_mod_group_member(TALLOC_CTX *mem_ctx, struct ldb_dn *group_dn, int mod_op); -int sysdb_set_group_gid(struct sysdb_handle *handle, - struct sss_domain_info *domain, - const char *name, gid_t gid, - sysdb_callback_t fn, void *pvt); - int sysdb_store_user(TALLOC_CTX *mem_ctx, struct sysdb_ctx *ctx, struct sss_domain_info *domain, diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c index e0b35b9d..6029b99d 100644 --- a/src/db/sysdb_search.c +++ b/src/db/sysdb_search.c @@ -24,156 +24,6 @@ #include "confdb/confdb.h" #include <time.h> -struct sysdb_search_ctx; - -typedef void (*gen_callback)(struct sysdb_search_ctx *); - -struct sysdb_search_ctx { - struct tevent_context *ev; - struct sysdb_ctx *ctx; - struct sysdb_handle *handle; - - struct sss_domain_info *domain; - - const char *expression; - - sysdb_callback_t callback; - void *ptr; - - gen_callback gen_aux_fn; - bool gen_conv_mpg_users; - - struct ldb_result *res; - - const char **attrs; - - int error; -}; - -static struct sysdb_search_ctx *init_src_ctx(TALLOC_CTX *mem_ctx, - struct sss_domain_info *domain, - struct sysdb_ctx *ctx, - sysdb_callback_t fn, - void *ptr) -{ - struct sysdb_search_ctx *sctx; - - sctx = talloc_zero(mem_ctx, struct sysdb_search_ctx); - if (!sctx) { - return NULL; - } - sctx->ctx = ctx; - sctx->ev = ctx->ev; - sctx->callback = fn; - sctx->ptr = ptr; - sctx->res = talloc_zero(sctx, struct ldb_result); - if (!sctx->res) { - talloc_free(sctx); - return NULL; - } - sctx->domain = domain; - - return sctx; -} - -static void request_ldberror(struct sysdb_search_ctx *sctx, int error) -{ - sysdb_operation_done(sctx->handle); - sctx->callback(sctx->ptr, sysdb_error_to_errno(error), NULL); -} - -static void request_error(struct sysdb_search_ctx *sctx, int error) -{ - sysdb_operation_done(sctx->handle); - sctx->callback(sctx->ptr, error, NULL); -} - -static void request_done(struct sysdb_search_ctx *sctx) -{ - sysdb_operation_done(sctx->handle); - sctx->callback(sctx->ptr, EOK, sctx->res); -} - -static int mpg_convert(struct ldb_message *msg); - -static int get_gen_callback(struct ldb_request *req, - struct ldb_reply *rep) -{ - struct sysdb_search_ctx *sctx; - struct ldb_result *res; - int n, ret; - - sctx = talloc_get_type(req->context, struct sysdb_search_ctx); - res = sctx->res; - - if (!rep) { - request_ldberror(sctx, LDB_ERR_OPERATIONS_ERROR); - return LDB_ERR_OPERATIONS_ERROR; - } - if (rep->error != LDB_SUCCESS) { - request_ldberror(sctx, rep->error); - return rep->error; - } - - switch (rep->type) { - case LDB_REPLY_ENTRY: - - if (sctx->gen_conv_mpg_users) { - ret = mpg_convert(rep->message); - if (ret != EOK) { - request_ldberror(sctx, LDB_ERR_OPERATIONS_ERROR); - return LDB_ERR_OPERATIONS_ERROR; - } - } - - res->msgs = talloc_realloc(res, res->msgs, - struct ldb_message *, - res->count + 2); - if (!res->msgs) { - request_ldberror(sctx, LDB_ERR_OPERATIONS_ERROR); - return LDB_ERR_OPERATIONS_ERROR; - } - - res->msgs[res->count + 1] = NULL; - - res->msgs[res->count] = talloc_steal(res->msgs, rep->message); - res->count++; - break; - - case LDB_REPLY_REFERRAL: - if (res->refs) { - for (n = 0; res->refs[n]; n++) /*noop*/ ; - } else { - n = 0; - } - - res->refs = talloc_realloc(res, res->refs, char *, n + 2); - if (! res->refs) { - request_ldberror(sctx, LDB_ERR_OPERATIONS_ERROR); - return LDB_ERR_OPERATIONS_ERROR; - } - - res->refs[n] = talloc_steal(res->refs, rep->referral); - res->refs[n + 1] = NULL; - break; - - case LDB_REPLY_DONE: - res->controls = talloc_steal(res, rep->controls); - - /* check if we need to call any aux function */ - if (sctx->gen_aux_fn) { - sctx->gen_aux_fn(sctx); - } else { - /* no aux functions, this means the request is done */ - request_done(sctx); - } - return LDB_SUCCESS; - } - - talloc_free(rep); - return LDB_SUCCESS; -} - /* users */ int sysdb_getpwnam(TALLOC_CTX *mem_ctx, |