Lines Matching refs:mod_ctx

144     struct mbof_mod_ctx *mod_ctx;
2309 static int mbof_mod_add(struct mbof_mod_ctx *mod_ctx,
2828 static int mbof_collect_child_ghosts(struct mbof_mod_ctx *mod_ctx);
2832 static int mbof_orig_mod(struct mbof_mod_ctx *mod_ctx);
2835 static int mbof_inherited_mod(struct mbof_mod_ctx *mod_ctx);
2838 static int mbof_mod_process(struct mbof_mod_ctx *mod_ctx, bool *done);
2850 static int mbof_mod_delete(struct mbof_mod_ctx *mod_ctx,
2868 struct mbof_mod_ctx *mod_ctx;
2907 mod_ctx = talloc_zero(ctx, struct mbof_mod_ctx);
2908 if (!mod_ctx) {
2912 mod_ctx->ctx = ctx;
2914 mod_ctx->msg = ldb_msg_copy(mod_ctx, req->op.mod.message);
2915 if (!mod_ctx->msg) {
2919 mod_ctx->membel = ldb_msg_find_element(mod_ctx->msg, DB_MEMBER);
2920 mod_ctx->ghel = ldb_msg_find_element(mod_ctx->msg, DB_GHOST);
2923 if (mod_ctx->membel == NULL && mod_ctx->ghel == NULL) {
2924 mod_ctx->terminate = true;
2925 return mbof_orig_mod(mod_ctx);
2930 ret = ldb_build_search_req(&search, ldb, mod_ctx,
2931 mod_ctx->msg->dn, LDB_SCOPE_BASE,
2933 mod_ctx, mbof_mod_callback,
2947 struct mbof_mod_ctx *mod_ctx;
2952 mod_ctx = talloc_get_type(req->context, struct mbof_mod_ctx);
2953 ctx = mod_ctx->ctx;
2969 if (mod_ctx->entry != NULL) {
2972 ldb_dn_get_linearized(mod_ctx->msg->dn));
2978 mod_ctx->entry = talloc_steal(mod_ctx, ares->message);
2979 if (mod_ctx->entry == NULL) {
2989 if (mod_ctx->entry == NULL) {
2991 ldb_dn_get_linearized(mod_ctx->msg->dn));
2997 ret = mbof_collect_child_ghosts(mod_ctx);
3008 static int mbof_collect_child_ghosts(struct mbof_mod_ctx *mod_ctx)
3013 member = ldb_msg_find_element(mod_ctx->entry, DB_MEMBER);
3016 mod_ctx->ghel == NULL || mod_ctx->ghel->flags != LDB_FLAG_MOD_REPLACE) {
3017 ret = mbof_orig_mod(mod_ctx);
3025 mod_ctx->igh = talloc_zero(mod_ctx, struct mbof_mod_del_op);
3026 if (mod_ctx->igh == NULL) {
3029 mod_ctx->igh->mod_ctx = mod_ctx;
3031 ret = hash_create_ex(1024, &mod_ctx->igh->inherited_gh, 0, 0, 0, 0,
3032 hash_alloc, hash_free, mod_ctx, NULL, NULL);
3038 return mbof_get_ghost_from_parent(mod_ctx->igh);
3052 ctx = igh->mod_ctx->ctx;
3055 dn = ldb_dn_get_linearized(igh->mod_ctx->entry->dn);
3101 ctx = igh->mod_ctx->ctx;
3158 ret = mbof_orig_mod(igh->mod_ctx);
3170 static int mbof_orig_mod(struct mbof_mod_ctx *mod_ctx)
3177 ctx = mod_ctx->ctx;
3181 mod_ctx->msg, ctx->req->controls,
3182 mod_ctx, mbof_orig_mod_callback,
3195 struct mbof_mod_ctx *mod_ctx;
3199 mod_ctx = talloc_get_type(req->context, struct mbof_mod_ctx);
3200 ctx = mod_ctx->ctx;
3226 if (!mod_ctx->terminate) {
3228 if (mod_ctx->igh && mod_ctx->igh->inherited_gh &&
3229 hash_count(mod_ctx->igh->inherited_gh) > 0) {
3230 ret = mbof_inherited_mod(mod_ctx);
3232 ret = mbof_mod_process(mod_ctx, &mod_ctx->terminate);
3241 if (mod_ctx->terminate) {
3253 static int mbof_inherited_mod(struct mbof_mod_ctx *mod_ctx)
3267 ctx = mod_ctx->ctx;
3271 msg = ldb_msg_new(mod_ctx);
3274 msg->dn = mod_ctx->entry->dn;
3284 ret = hash_values(mod_ctx->igh->inherited_gh, &num_values, &values);
3297 dupval = ldb_msg_find_val(mod_ctx->ghel, val);
3318 mod_ctx->igh->mod_msg = msg;
3319 mod_ctx->igh->el = el;
3323 mod_ctx, mbof_inherited_mod_callback,
3336 struct mbof_mod_ctx *mod_ctx;
3340 mod_ctx = talloc_get_type(req->context, struct mbof_mod_ctx);
3341 ctx = mod_ctx->ctx;
3363 ret = mbof_mod_process(mod_ctx, &mod_ctx->terminate);
3369 if (mod_ctx->terminate) {
3381 static int mbof_mod_process(struct mbof_mod_ctx *mod_ctx, bool *done)
3387 ctx = mod_ctx->ctx;
3390 ret = mbof_mod_process_membel(mod_ctx, ldb, mod_ctx->entry, mod_ctx->membel,
3391 &mod_ctx->mb_add, &mod_ctx->mb_remove);
3396 ret = mbof_mod_process_ghel(mod_ctx, mod_ctx->entry, mod_ctx->ghel,
3397 mod_ctx->igh ? mod_ctx->igh->el : NULL,
3398 &mod_ctx->gh_add, &mod_ctx->gh_remove);
3405 if ((mod_ctx->mb_remove && mod_ctx->mb_remove->num) ||
3406 (mod_ctx->gh_remove && mod_ctx->gh_remove->num)) {
3407 return mbof_mod_delete(mod_ctx, mod_ctx->mb_remove, mod_ctx->gh_remove);
3412 if ((mod_ctx->mb_add && mod_ctx->mb_add->num) ||
3413 (mod_ctx->gh_add && mod_ctx->gh_add->num)) {
3414 return mbof_mod_add(mod_ctx, mod_ctx->mb_add, mod_ctx->gh_add);
3632 static int mbof_mod_add(struct mbof_mod_ctx *mod_ctx,
3643 ctx = mod_ctx->ctx;
3646 el = ldb_msg_find_element(mod_ctx->entry, DB_MEMBEROF);
3649 ret = mbof_fill_dn_array(mod_ctx, ldb, el, &parents);
3654 add_ctx = talloc_zero(mod_ctx, struct mbof_add_ctx);
3659 add_ctx->msg_dn = mod_ctx->msg->dn;
3663 ret = mbof_add_fill_ghop_ex(add_ctx, mod_ctx->entry,
3677 parents->dns[parents->num] = mod_ctx->entry->dn;
3694 static int mbof_mod_delete(struct mbof_mod_ctx *mod_ctx,
3703 ctx = mod_ctx->ctx;
3705 del_ctx = talloc_zero(mod_ctx, struct mbof_del_ctx);
3722 if ((mod_ctx->mb_add && mod_ctx->mb_add->num > 0) ||
3723 (mod_ctx->gh_add && mod_ctx->gh_add->num > 0)) {
3724 del_ctx->follow_mod = mod_ctx;
3728 first->entry = mod_ctx->entry;
3729 first->entry_dn = mod_ctx->entry->dn;