- struct samldb_ctx *ac;
- int ret;
-
- ac = talloc_get_type(req->context, struct samldb_ctx);
-
- if (ares->error != LDB_SUCCESS) {
- return ldb_module_done(ac->req, ares->controls,
- ares->response, ares->error);
- }
-
- switch (ares->type) {
- case LDB_REPLY_ENTRY:
- /* if we get an entry it means this samAccountName
- * already exists */
- return ldb_module_done(ac->req, NULL, NULL,
- LDB_ERR_ENTRY_ALREADY_EXISTS);
-
- case LDB_REPLY_REFERRAL:
- /* ignore */
- talloc_free(ares);
- ret = LDB_SUCCESS;
- break;
-
- case LDB_REPLY_DONE:
- /* not found, go on */
- talloc_free(ares);
- ret = samldb_next_step(ac);
- break;
- }
-
- if (ret != LDB_SUCCESS) {
- return ldb_module_done(ac->req, NULL, NULL, ret);
- }
-
- return LDB_SUCCESS;
-}
-
-static int samldb_check_samAccountName(struct samldb_ctx *ac)
-{
- struct ldb_context *ldb;
- struct ldb_request *req;