return true;
}
- /* make sure we free this if alloced previously before replacing */
- talloc_free(dn->components);
+ /* make sure we free this if allocated previously before replacing */
+ LDB_FREE(dn->components);
+ dn->comp_num = 0;
LDB_FREE(dn->ext_components);
dn->ext_comp_num = 0;
if ( ! dn->components) {
return false;
}
- dn->comp_num = 0;
/* Components data space is allocated here once */
data = talloc_array(dn->components, char, strlen(parse_dn) + 1);
/* Wipe the ext_linearized DN,
* the GUID and SID are almost certainly no longer valid */
LDB_FREE(dn->ext_linearized);
-
LDB_FREE(dn->ext_components);
dn->ext_comp_num = 0;
+
return true;
}
unsigned int n;
long long int i, j;
+ if (dn->comp_num == 0) {
+ return false;
+ }
+
if ( ! ldb_dn_validate(child)) {
return false;
}
}
if (dn->linearized) {
+ if (dn->linearized[0] == '\0') {
+ return false;
+ }
s = ldb_dn_get_linearized(child);
if ( ! s) {
/* Wipe the ext_linearized DN,
* the GUID and SID are almost certainly no longer valid */
LDB_FREE(dn->ext_linearized);
-
LDB_FREE(dn->ext_components);
dn->ext_comp_num = 0;
/* Wipe the ext_linearized DN,
* the GUID and SID are almost certainly no longer valid */
LDB_FREE(dn->ext_linearized);
-
LDB_FREE(dn->ext_components);
dn->ext_comp_num = 0;
/* Wipe the ext_linearized DN,
* the GUID and SID are almost certainly no longer valid */
LDB_FREE(dn->ext_linearized);
-
LDB_FREE(dn->ext_components);
dn->ext_comp_num = 0;
+
return true;
}
/* Wipe the ext_linearized DN,
* the GUID and SID are almost certainly no longer valid */
LDB_FREE(dn->ext_linearized);
-
LDB_FREE(dn->ext_components);
dn->ext_comp_num = 0;
+
return new_dn;
}
/* Wipe the ext_linearized DN,
* the GUID and SID are almost certainly no longer valid */
LDB_FREE(dn->ext_linearized);
-
- dn->ext_comp_num = 0;
LDB_FREE(dn->ext_components);
+ dn->ext_comp_num = 0;
+
return LDB_SUCCESS;
}
ldb_dn_mark_invalid(dn);
return LDB_ERR_OPERATIONS_ERROR;
}
- return LDB_SUCCESS;
} else {
if (i != (dn->ext_comp_num - 1)) {
memmove(&dn->ext_components[i],
ldb_dn_mark_invalid(dn);
return LDB_ERR_OPERATIONS_ERROR;
}
- return LDB_SUCCESS;
}
LDB_FREE(dn->ext_linearized);
+
+ return LDB_SUCCESS;
}
}
dn->ext_components = p;
dn->ext_comp_num++;
+ LDB_FREE(dn->ext_linearized);
+
return LDB_SUCCESS;
}
void ldb_dn_remove_extended_components(struct ldb_dn *dn)
{
- dn->ext_comp_num = 0;
- LDB_FREE(dn->ext_components);
LDB_FREE(dn->ext_linearized);
+ LDB_FREE(dn->ext_components);
+ dn->ext_comp_num = 0;
}
bool ldb_dn_is_valid(struct ldb_dn *dn)