#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
+#include <string.h>
#include <setjmp.h>
#include <cmocka.h>
const char *attrs[] = {"foo", NULL};
- uint8_t value[] = "The value.......end";
+ char value[] = "The value.......end";
struct ldb_val value_1 = {
- .data = value,
- .length = (sizeof(value))
+ .data = (uint8_t *)value,
+ .length = strlen(value)
};
struct ldb_message_element element_1 = {
.name = "foo",
assert_string_equal(filtered_msg->elements[0].name, "foo");
assert_int_equal(filtered_msg->elements[0].num_values, 1);
assert_int_equal(filtered_msg->elements[0].values[0].length,
- sizeof(value));
+ strlen(value));
assert_memory_equal(filtered_msg->elements[0].values[0].data,
- value, sizeof(value));
+ value, strlen(value));
}
/*
const char *attrs[] = {"foo", "bar", "baz", NULL};
- uint8_t value[] = "The value.......end";
+ char value[] = "The value.......end";
struct ldb_val value_1 = {
- .data = value,
- .length = (sizeof(value))
+ .data = (uint8_t *)value,
+ .length = strlen(value)
};
struct ldb_message_element element_1 = {
.name = "foo",
assert_string_equal(filtered_msg->elements[0].name, "foo");
assert_int_equal(filtered_msg->elements[0].num_values, 1);
assert_int_equal(filtered_msg->elements[0].values[0].length,
- sizeof(value));
+ strlen(value));
assert_memory_equal(filtered_msg->elements[0].values[0].data,
- value, sizeof(value));
+ value, strlen(value));
}
/*
/* deliberatly the other order */
const char *attrs[] = {"bar", "foo", NULL};
- uint8_t value1[] = "The value.......end";
- uint8_t value2[] = "The value..MUST.end";
+ char value1[] = "The value.......end";
+ char value2[] = "The value..MUST.end";
struct ldb_val value_1 = {
- .data = value1,
- .length = (sizeof(value1))
+ .data = (uint8_t *)value1,
+ .length = strlen(value1)
};
struct ldb_val value_2 = {
- .data = value2,
- .length = (sizeof(value2))
+ .data = (uint8_t *)value2,
+ .length = strlen(value2)
};
/* foo and bar are the other order to in attrs */
assert_string_equal(filtered_msg->elements[0].name, "foo");
assert_int_equal(filtered_msg->elements[0].num_values, 1);
assert_int_equal(filtered_msg->elements[0].values[0].length,
- sizeof(value1));
+ strlen(value1));
assert_memory_equal(filtered_msg->elements[0].values[0].data,
- value1, sizeof(value1));
+ value1, strlen(value1));
assert_string_equal(filtered_msg->elements[1].name, "bar");
assert_int_equal(filtered_msg->elements[1].num_values, 1);
assert_int_equal(filtered_msg->elements[1].values[0].length,
- sizeof(value2));
+ strlen(value2));
assert_memory_equal(filtered_msg->elements[1].values[0].data,
- value2, sizeof(value2));
+ value2, strlen(value2));
}
/*
/* deliberatly the other order */
const char *attrs[] = {"bar", NULL};
- uint8_t value1[] = "The value.......end";
- uint8_t value2[] = "The value..MUST.end";
+ char value1[] = "The value.......end";
+ char value2[] = "The value..MUST.end";
struct ldb_val value_1 = {
- .data = value1,
- .length = (sizeof(value1))
+ .data = (uint8_t *)value1,
+ .length = strlen(value1)
};
struct ldb_val value_2 = {
- .data = value2,
- .length = (sizeof(value2))
+ .data = (uint8_t *)value2,
+ .length = strlen(value2)
};
/* foo and bar are the other order to in attrs */
assert_string_equal(filtered_msg->elements[0].name, "bar");
assert_int_equal(filtered_msg->elements[0].num_values, 1);
assert_int_equal(filtered_msg->elements[0].values[0].length,
- sizeof(value2));
+ strlen(value2));
assert_memory_equal(filtered_msg->elements[0].values[0].data,
- value2, sizeof(value2));
+ value2, strlen(value2));
}
/*
/* deliberatly the other order */
const char *attrs[] = {"bar", NULL};
- uint8_t value1[] = "The value.......end";
- uint8_t value2[] = "The value..MUST.end";
+ char value1[] = "The value.......end";
+ char value2[] = "The value..MUST.end";
struct ldb_val value_1 = {
- .data = value1,
- .length = (sizeof(value1))
+ .data = (uint8_t *)value1,
+ .length = strlen(value1)
};
struct ldb_val value_2 = {
- .data = value2,
- .length = (sizeof(value2))
+ .data = (uint8_t *)value2,
+ .length = strlen(value2)
};
/* foo and bar are the other order to in attrs */
const char *attrs[] = {"bar", "bar", NULL};
- uint8_t value1[] = "The value.......end";
- uint8_t value2[] = "The value..MUST.end";
+ char value1[] = "The value.......end";
+ char value2[] = "The value..MUST.end";
struct ldb_val value_1 = {
- .data = value1,
- .length = (sizeof(value1))
+ .data = (uint8_t *)value1,
+ .length = strlen(value1)
};
struct ldb_val value_2 = {
- .data = value2,
- .length = (sizeof(value2))
+ .data = (uint8_t *)value2,
+ .length = strlen(value2)
};
/* foo and bar are the other order to in attrs */
assert_string_equal(filtered_msg->elements[0].name, "bar");
assert_int_equal(filtered_msg->elements[0].num_values, 1);
assert_int_equal(filtered_msg->elements[0].values[0].length,
- sizeof(value1));
+ strlen(value1));
assert_memory_equal(filtered_msg->elements[0].values[0].data,
- value1, sizeof(value1));
+ value1, strlen(value1));
assert_string_equal(filtered_msg->elements[1].name, "bar");
assert_int_equal(filtered_msg->elements[1].num_values, 1);
assert_int_equal(filtered_msg->elements[1].values[0].length,
- sizeof(value2));
+ strlen(value2));
assert_memory_equal(filtered_msg->elements[1].values[0].data,
- value2, sizeof(value2));
+ value2, strlen(value2));
}
/*
const char *attrs[] = {"bar", "foo", NULL};
- uint8_t value1[] = "The value.......end";
- uint8_t value2[] = "The value..MUST.end";
+ char value1[] = "The value.......end";
+ char value2[] = "The value..MUST.end";
struct ldb_val value_1 = {
- .data = value1,
- .length = (sizeof(value1))
+ .data = (uint8_t *)value1,
+ .length = strlen(value1)
};
struct ldb_val value_2 = {
- .data = value2,
- .length = (sizeof(value2))
+ .data = (uint8_t *)value2,
+ .length = strlen(value2)
};
/* foo and bar are the other order to in attrs */
assert_string_equal(filtered_msg->elements[0].name, "bar");
assert_int_equal(filtered_msg->elements[0].num_values, 1);
assert_int_equal(filtered_msg->elements[0].values[0].length,
- sizeof(value1));
+ strlen(value1));
assert_memory_equal(filtered_msg->elements[0].values[0].data,
- value1, sizeof(value1));
+ value1, strlen(value1));
assert_string_equal(filtered_msg->elements[1].name, "bar");
assert_int_equal(filtered_msg->elements[1].num_values, 1);
assert_int_equal(filtered_msg->elements[1].values[0].length,
- sizeof(value2));
+ strlen(value2));
assert_memory_equal(filtered_msg->elements[1].values[0].data,
- value2, sizeof(value2));
+ value2, strlen(value2));
}
/*
const char *attrs[] = {"*", "foo", NULL};
- uint8_t value1[] = "The value.......end";
- uint8_t value2[] = "The value..MUST.end";
+ char value1[] = "The value.......end";
+ char value2[] = "The value..MUST.end";
struct ldb_val value_1 = {
- .data = value1,
- .length = (sizeof(value1))
+ .data = (uint8_t *)value1,
+ .length = strlen(value1)
};
struct ldb_val value_2 = {
- .data = value2,
- .length = (sizeof(value2))
+ .data = (uint8_t *)value2,
+ .length = strlen(value2)
};
/* foo and bar are the other order to in attrs */
assert_string_equal(filtered_msg->elements[0].name, "bar");
assert_int_equal(filtered_msg->elements[0].num_values, 1);
assert_int_equal(filtered_msg->elements[0].values[0].length,
- sizeof(value1));
+ strlen(value1));
assert_memory_equal(filtered_msg->elements[0].values[0].data,
- value1, sizeof(value1));
+ value1, strlen(value1));
assert_string_equal(filtered_msg->elements[1].name, "bar");
assert_int_equal(filtered_msg->elements[1].num_values, 1);
assert_int_equal(filtered_msg->elements[1].values[0].length,
- sizeof(value2));
+ strlen(value2));
assert_memory_equal(filtered_msg->elements[1].values[0].data,
- value2, sizeof(value2));
+ value2, strlen(value2));
/*
* assert the ldb_filter_attrs does not modify filtered_msg.dn
* in this case
const char *attrs[] = {"*", NULL};
- uint8_t value[] = "The value.......end";
+ char value[] = "The value.......end";
struct ldb_val value_1 = {
- .data = value,
- .length = (sizeof(value))
+ .data = (uint8_t *)value,
+ .length = strlen(value)
};
struct ldb_message_element element_1 = {
.name = "foo",
const char *attrs[] = {"*", NULL};
- uint8_t value1[] = "The value.......end";
- uint8_t value2[] = "The value..MUST.end";
+ char value1[] = "The value.......end";
+ char value2[] = "The value..MUST.end";
struct ldb_val value_1 = {
- .data = value1,
- .length = (sizeof(value1))
+ .data = (uint8_t *)value1,
+ .length = strlen(value1)
};
struct ldb_val value_2 = {
- .data = value2,
- .length = (sizeof(value2))
+ .data = (uint8_t *)value2,
+ .length = strlen(value2)
};
struct ldb_message_element elements[] = {
{
const char *attrs[] = {"*", NULL};
- uint8_t value[] = "The value.......end";
+ char value[] = "The value.......end";
struct ldb_val value_1 = {
- .data = value,
- .length = (sizeof(value))
+ .data = (uint8_t *)value,
+ .length = strlen(value)
};
struct ldb_message_element element_1 = {
.name = "foo",
const char *attrs[] = {"*", "distinguishedName", NULL};
- uint8_t value[] = "The value.......end";
+ char value[] = "The value.......end";
struct ldb_val value_1 = {
- .data = value,
- .length = (sizeof(value))
+ .data = (uint8_t *)value,
+ .length = strlen(value)
};
struct ldb_message_element element_1 = {
.name = "foo",
const char *attrs[] = {"distinguishedName", NULL};
- uint8_t value[] = "The value.......end";
+ char value[] = "The value.......end";
struct ldb_val value_1 = {
- .data = value,
- .length = (sizeof(value))
+ .data = (uint8_t *)value,
+ .length = strlen(value)
};
struct ldb_message_element element_1 = {
.name = "foo",
const char *attrs[] = {NULL};
- uint8_t value[] = "The value.......end";
+ char value[] = "The value.......end";
struct ldb_val value_1 = {
- .data = value,
- .length = (sizeof(value))
+ .data = (uint8_t *)value,
+ .length = strlen(value)
};
struct ldb_message_element element_1 = {
.name = "foo",