struct ldb_context *ldb,
const char *name)
{
- /* for binary search we need signed variables */
- long long int i, e, b;
- int r;
+ int i, e, b = 0, r;
const struct ldb_schema_attribute *def = &ldb_attribute_default;
- b = 0;
-
/* as handlers are sorted, '*' must be the first if present */
if (strcmp(ldb->schema.attributes[0].name, "*") == 0) {
def = &ldb->schema.attributes[0];
e = ldb->schema.num_attributes - 1;
while (b <= e) {
+
i = (b + e) / 2;
r = ldb_attr_cmp(name, ldb->schema.attributes[i].name);
/* returns NULL if not found */
struct ldb_control *ldb_request_get_control(struct ldb_request *req, const char *oid)
{
- unsigned int i;
+ int i;
if (req->controls != NULL) {
for (i = 0; req->controls[i]; i++) {
/* returns NULL if not found */
struct ldb_control *ldb_reply_get_control(struct ldb_reply *rep, const char *oid)
{
- unsigned int i;
+ int i;
if (rep->controls != NULL) {
for (i = 0; rep->controls[i]; i++) {
int save_controls(struct ldb_control *exclude, struct ldb_request *req, struct ldb_control ***saver)
{
struct ldb_control **lcs;
- unsigned int i, j;
+ int i, j;
*saver = req->controls;
for (i = 0; req->controls[i]; i++);
struct ldb_control *exclude)
{
struct ldb_control **lcs = NULL;
- unsigned int i, j;
+ int i, j;
for (i = 0; controls_in && controls_in[i]; i++);
/* return True if any, False if none */
int check_critical_controls(struct ldb_control **controls)
{
- unsigned int i;
+ int i;
if (controls == NULL) {
return 0;
int ldb_request_add_control(struct ldb_request *req, const char *oid, bool critical, void *data)
{
- unsigned int i, n;
+ unsigned i, n;
struct ldb_control **ctrls;
struct ldb_control *ctrl;
struct ldb_control **ldb_parse_control_strings(struct ldb_context *ldb, void *mem_ctx, const char **control_strings)
{
- unsigned int i;
+ int i;
struct ldb_control **ctrl;
char *error_string = NULL;
struct ldb_dirsync_control *control;
const char *p;
char cookie[1024];
- int crit, flags, ret;
- unsigned max_attrs;
+ int crit, flags, max_attrs, ret;
cookie[0] = '\0';
p = &(control_strings[i][8]);
const char *ldb_dn_get_linearized(struct ldb_dn *dn)
{
- unsigned int i, len;
+ int i, len;
char *d, *n;
if ( ! dn || ( dn->invalid)) return NULL;
char *ldb_dn_get_extended_linearized(void *mem_ctx, struct ldb_dn *dn, int mode)
{
const char *linearized = ldb_dn_get_linearized(dn);
- char *p = NULL;
- unsigned int i;
+ char *p;
+ int i;
if (!linearized) {
return NULL;
static bool ldb_dn_casefold_internal(struct ldb_dn *dn)
{
- unsigned int i;
- int ret;
+ int i, ret;
if ( ! dn || dn->invalid) return false;
const char *ldb_dn_get_casefold(struct ldb_dn *dn)
{
- unsigned int i, len;
+ int i, len;
char *d, *n;
if (dn->casefold) return dn->casefold;
int ldb_dn_compare(struct ldb_dn *dn0, struct ldb_dn *dn1)
{
- unsigned int i;
- int ret;
+ int i, ret;
if (( ! dn0) || dn0->invalid || ! dn1 || dn1->invalid) {
return -1;
bool ldb_dn_remove_base_components(struct ldb_dn *dn, unsigned int num)
{
- long long int i;
+ int i;
if ( ! ldb_dn_validate(dn)) {
return false;
bool ldb_dn_remove_child_components(struct ldb_dn *dn, unsigned int num)
{
- unsigned int i, j;
+ int i, j;
if ( ! ldb_dn_validate(dn)) {
return false;
*/
static char *ldb_dn_canonical(void *mem_ctx, struct ldb_dn *dn, int ex_format) {
- long long int i;
+ int i;
TALLOC_CTX *tmpctx;
char *cracked = NULL;
const char *format = (ex_format ? "\n" : "/" );
tmpctx = talloc_new(mem_ctx);
/* Walk backwards down the DN, grabbing 'dc' components at first */
- for (i = dn->comp_num - 1; i >= 0; i--) {
+ for (i = dn->comp_num - 1 ; i >= 0; i--) {
if (ldb_attr_cmp(dn->components[i].name, "dc") != 0) {
break;
}
const struct ldb_val *ldb_dn_get_extended_component(struct ldb_dn *dn,
const char *name)
{
- unsigned int i;
+ int i;
if ( ! ldb_dn_validate(dn)) {
return NULL;
}
const char *name, const struct ldb_val *val)
{
struct ldb_dn_ext_component *p;
- unsigned int i;
+ int i;
struct ldb_val v2;
if ( ! ldb_dn_validate(dn)) {
*/
void ldb_msg_remove_element(struct ldb_message *msg, struct ldb_message_element *el)
{
- ptrdiff_t n = (el - msg->elements);
+ int n = (el - msg->elements);
if (n >= msg->num_elements) {
/* should we abort() here? */
return;
convert a ldb_message structure to a list of ldap_mod structures
ready for ildap_add() or ildap_modify()
*/
-static struct ldap_mod **ildb_msg_to_mods(void *mem_ctx, unsigned int *num_mods,
+static struct ldap_mod **ildb_msg_to_mods(void *mem_ctx, int *num_mods,
const struct ldb_message *msg,
int use_flags)
{
struct ldap_mod **mods;
unsigned int i;
- unsigned int n = 0;
+ int n = 0;
/* allocate maximum number of elements needed */
mods = talloc_array(mem_ctx, struct ldap_mod *, msg->num_elements+1);
char *referral;
bool callback_failed;
bool request_done;
- unsigned int i;
int ret;
+ int i;
ac = talloc_get_type(req->async.private_data, struct ildb_context);
ldb = ldb_module_get_ctx(ac->module);
struct ldb_context *ldb;
struct ldb_request *req = ac->req;
struct ldap_message *msg;
- unsigned int n;
+ int n;
ldb = ldb_module_get_ctx(ac->module);
struct ldb_request *req = ac->req;
struct ldap_message *msg;
struct ldap_mod **mods;
- unsigned int i,n;
+ int i,n;
msg = new_ldap_message(req);
if (msg == NULL) {
struct ldb_request *req = ac->req;
struct ldap_message *msg;
struct ldap_mod **mods;
- unsigned int i,n;
+ int i,n;
msg = new_ldap_message(req);
if (msg == NULL) {
struct ldb_message *msg,
const char *attr, struct berval **bval)
{
- unsigned int count, i;
+ int count, i;
struct ldb_message_element *el;
count = ldap_count_values_len(bval);
bool callback_failed;
bool request_done;
bool lret;
- unsigned int i;
int ret;
+ int i;
ldb = ldb_module_get_ctx(ac->module);
enum ldb_map_attr_type map_type;
const char *name;
struct ldb_val value;
- unsigned int i;
- int ret;
+ int i, ret;
if (dn == NULL) {
return NULL;
enum ldb_map_attr_type map_type;
const char *name;
struct ldb_val value;
- unsigned int i;
- int ret;
+ int i, ret;
if (dn == NULL) {
return NULL;
struct ldb_message_element *el;
const char * const *attrs;
struct ldb_context *ldb;
- unsigned int i;
+ int i;
ldb = ldb_module_get_ctx(ac->module);
struct lsql_context *ac;
struct ldb_message *msg;
long long eid;
- unsigned int i;
- int ret;
+ int i, ret;
ac = talloc_get_type(result, struct lsql_context);
ldb = ldb_module_get_ctx(ac->module);
struct ldb_context *ldb;
struct ldb_dn *dn_key;
const char *dn_str;
- unsigned int i;
- int ret;
+ int ret, i;
struct dn_list *list;
ldb = ldb_module_get_ctx(module);
const char * const *attrs)
{
struct ldb_message *ret;
- unsigned int i;
+ int i;
ret = talloc(mem_ctx, struct ldb_message);
if (!ret) {
*/
int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs)
{
- unsigned int i, keep_all = 0;
+ int i, keep_all = 0;
if (attrs) {
/* check for special attrs */