struct ldb_dn_ext_component {
- char *name;
+ const char *name;
struct ldb_val value;
};
goto failed;
}
- dn->ext_components[dn->ext_comp_num].name = talloc_strdup(dn->ext_components, ex_name);
- if (!dn->ext_components[dn->ext_comp_num].name) {
- /* ouch */
- goto failed;
- }
+ dn->ext_components[dn->ext_comp_num].name = ext_syntax->name;
ret = ext_syntax->read_fn(dn->ldb, dn->ext_components,
&ex_val, &dn->ext_components[dn->ext_comp_num].value);
if (ret != LDB_SUCCESS) {
struct ldb_dn_ext_component *p;
unsigned int i;
struct ldb_val v2;
-
+ const struct ldb_dn_extended_syntax *ext_syntax;
+
if ( ! ldb_dn_validate(dn)) {
return LDB_ERR_OTHER;
}
- if (!ldb_dn_extended_syntax_by_name(dn->ldb, name)) {
+ ext_syntax = ldb_dn_extended_syntax_by_name(dn->ldb, name);
+ if (ext_syntax == NULL) {
/* We don't know how to handle this type of thing */
return LDB_ERR_INVALID_DN_SYNTAX;
}
dn->ext_components[i].value =
ldb_val_dup(dn->ext_components, val);
- dn->ext_components[i].name =
- talloc_strdup(dn->ext_components, name);
- if (!dn->ext_components[i].name ||
- !dn->ext_components[i].value.data) {
+ dn->ext_components[i].name = ext_syntax->name;
+ if (!dn->ext_components[i].value.data) {
ldb_dn_mark_invalid(dn);
return LDB_ERR_OPERATIONS_ERROR;
}
*/
for (i = 1; i < dn->ext_comp_num; i++) {
- LDB_FREE(dn->ext_components[i].name);
LDB_FREE(dn->ext_components[i].value.data);
}
dn->ext_comp_num = 1;