summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb_search.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2010-03-21 00:09:04 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-04-12 09:22:16 -0400
commitaacf8781c61e928c74fcc89f02225374b283b872 (patch)
tree0547820fd01df558084a399450cf30ddad93fd8d /src/db/sysdb_search.c
parentaafa0393524bacc5ba48e79ab536f9deb3972e38 (diff)
downloadsssd-aacf8781c61e928c74fcc89f02225374b283b872.tar.gz
sssd-aacf8781c61e928c74fcc89f02225374b283b872.tar.xz
sssd-aacf8781c61e928c74fcc89f02225374b283b872.zip
sysdb: remove obsolete helpers from sysdb
Diffstat (limited to 'src/db/sysdb_search.c')
-rw-r--r--src/db/sysdb_search.c150
1 files changed, 0 insertions, 150 deletions
diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c
index e0b35b9d2..6029b99d8 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,