summaryrefslogtreecommitdiff
path: root/source4/torture/ldap/schema.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture/ldap/schema.c')
-rw-r--r--source4/torture/ldap/schema.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/source4/torture/ldap/schema.c b/source4/torture/ldap/schema.c
index f754880d0b..30fd9877e6 100644
--- a/source4/torture/ldap/schema.c
+++ b/source4/torture/ldap/schema.c
@@ -31,6 +31,8 @@
#include "torture/torture.h"
#include "torture/ldap/proto.h"
+#include "param/param.h"
+
struct test_rootDSE {
const char *defaultdn;
const char *rootdn;
@@ -41,13 +43,13 @@ struct test_rootDSE {
struct test_schema_ctx {
struct ldb_paged_control *ctrl;
uint32_t count;
- BOOL pending;
+ bool pending;
int (*callback)(void *, struct ldb_context *ldb, struct ldb_message *);
void *private_data;
};
-static BOOL test_search_rootDSE(struct ldb_context *ldb, struct test_rootDSE *root)
+static bool test_search_rootDSE(struct ldb_context *ldb, struct test_rootDSE *root)
{
int ret;
struct ldb_message *msg;
@@ -58,10 +60,10 @@ static BOOL test_search_rootDSE(struct ldb_context *ldb, struct test_rootDSE *ro
ret = ldb_search(ldb, ldb_dn_new(ldb, ldb, NULL), LDB_SCOPE_BASE,
NULL, NULL, &r);
if (ret != LDB_SUCCESS) {
- return False;
+ return false;
} else if (r->count != 1) {
talloc_free(r);
- return False;
+ return false;
}
msg = r->msgs[0];
@@ -77,7 +79,7 @@ static BOOL test_search_rootDSE(struct ldb_context *ldb, struct test_rootDSE *ro
talloc_free(r);
- return True;
+ return true;
}
static int test_schema_search_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares)
@@ -113,7 +115,7 @@ static int test_schema_search_callback(struct ldb_context *ldb, void *context, s
actx->ctrl->cookie_len = ctrl->cookie_len;
if (actx->ctrl->cookie_len > 0) {
- actx->pending = True;
+ actx->pending = true;
}
}
break;
@@ -136,7 +138,7 @@ static int test_schema_search_callback(struct ldb_context *ldb, void *context, s
return LDB_SUCCESS;
}
-static BOOL test_create_schema_type(struct ldb_context *ldb, struct test_rootDSE *root,
+static bool test_create_schema_type(struct ldb_context *ldb, struct test_rootDSE *root,
const char *filter,
int (*callback)(void *, struct ldb_context *ldb, struct ldb_message *),
void *private_data)
@@ -153,7 +155,7 @@ static BOOL test_create_schema_type(struct ldb_context *ldb, struct test_rootDSE
ctrl = talloc_array(req, struct ldb_control *, 2);
ctrl[0] = talloc(ctrl, struct ldb_control);
ctrl[0]->oid = LDB_CONTROL_PAGED_RESULTS_OID;
- ctrl[0]->critical = True;
+ ctrl[0]->critical = true;
control = talloc(ctrl[0], struct ldb_paged_control);
control->size = 1000;
control->cookie = NULL;
@@ -177,25 +179,25 @@ static BOOL test_create_schema_type(struct ldb_context *ldb, struct test_rootDSE
actx->callback = callback;
actx->private_data = private_data;
again:
- actx->pending = False;
+ actx->pending = false;
ret = ldb_request(ldb, req);
if (ret != LDB_SUCCESS) {
d_printf("search failed - %s\n", ldb_errstring(ldb));
- return False;
+ return false;
}
ret = ldb_wait(req->handle, LDB_WAIT_ALL);
if (ret != LDB_SUCCESS) {
d_printf("search error - %s\n", ldb_errstring(ldb));
- return False;
+ return false;
}
if (actx->pending)
goto again;
d_printf("filter[%s] count[%u]\n", filter, actx->count);
- return True;
+ return true;
}
static int test_add_attribute(void *ptr, struct ldb_context *ldb, struct ldb_message *msg)
@@ -243,9 +245,9 @@ failed:
return LDB_ERR_OTHER;
}
-static BOOL test_create_schema(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema **_schema)
+static bool test_create_schema(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema **_schema)
{
- BOOL ret = True;
+ bool ret = true;
struct dsdb_schema *schema;
schema = talloc_zero(ldb, struct dsdb_schema);
@@ -257,13 +259,13 @@ static BOOL test_create_schema(struct ldb_context *ldb, struct test_rootDSE *roo
ret &= test_create_schema_type(ldb, root, "(objectClass=classSchema)",
test_add_class, schema);
- if (ret == True) {
+ if (ret == true) {
*_schema = schema;
}
return ret;
}
-static BOOL test_dump_not_replicated(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema)
+static bool test_dump_not_replicated(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema)
{
struct dsdb_attribute *a;
uint32_t a_i = 1;
@@ -276,10 +278,10 @@ static BOOL test_dump_not_replicated(struct ldb_context *ldb, struct test_rootDS
a->lDAPDisplayName);
}
- return True;
+ return true;
}
-static BOOL test_dump_partial(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema)
+static bool test_dump_partial(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema)
{
struct dsdb_attribute *a;
uint32_t a_i = 1;
@@ -293,10 +295,10 @@ static BOOL test_dump_partial(struct ldb_context *ldb, struct test_rootDSE *root
a->lDAPDisplayName);
}
- return True;
+ return true;
}
-static BOOL test_dump_contructed(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema)
+static bool test_dump_contructed(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema)
{
struct dsdb_attribute *a;
uint32_t a_i = 1;
@@ -309,10 +311,10 @@ static BOOL test_dump_contructed(struct ldb_context *ldb, struct test_rootDSE *r
a->lDAPDisplayName);
}
- return True;
+ return true;
}
-static BOOL test_dump_sorted_syntax(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema)
+static bool test_dump_sorted_syntax(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema)
{
struct dsdb_attribute *a;
uint32_t a_i = 1;
@@ -348,7 +350,7 @@ static BOOL test_dump_sorted_syntax(struct ldb_context *ldb, struct test_rootDSE
om_hex = data_blob_hex_string(ldb, &a->oMObjectClass);
if (!om_hex) {
- return False;
+ return false;
}
d_printf("attr[%4u]: %s %u '%s' '%s'\n", a_i++,
@@ -358,13 +360,13 @@ static BOOL test_dump_sorted_syntax(struct ldb_context *ldb, struct test_rootDSE
}
}
- return True;
+ return true;
}
-BOOL torture_ldap_schema(struct torture_context *torture)
+bool torture_ldap_schema(struct torture_context *torture)
{
struct ldb_context *ldb;
- BOOL ret = True;
+ bool ret = true;
const char *host = torture_setting_string(torture, "host", NULL);
char *url;
struct test_rootDSE rootDSE;
@@ -374,7 +376,7 @@ BOOL torture_ldap_schema(struct torture_context *torture)
url = talloc_asprintf(torture, "ldap://%s/", host);
- ldb = ldb_wrap_connect(torture, url,
+ ldb = ldb_wrap_connect(torture, global_loadparm, url,
NULL,
cmdline_credentials,
0, NULL);