return result;
}
- /* there are existing records. We need to see if this will
- * replace a record or add to it
- */
el = ldb_msg_find_element(res->msgs[0], "dnsRecord");
if (el == NULL) {
- state->log(ISC_LOG_ERROR, "samba_dlz: no dnsRecord attribute for %s",
- ldb_dn_get_linearized(dn));
- talloc_free(rec);
- return ISC_R_FAILURE;
+ ret = ldb_msg_add_empty(res->msgs[0], "dnsRecord", LDB_FLAG_MOD_ADD, &el);
+ if (ret != LDB_SUCCESS) {
+ state->log(ISC_LOG_ERROR, "samba_dlz: failed to add dnsRecord for %s",
+ ldb_dn_get_linearized(dn));
+ talloc_free(rec);
+ return ISC_R_FAILURE;
+ }
}
+ /* there are existing records. We need to see if this will
+ * replace a record or add to it
+ */
for (i=0; i<el->num_values; i++) {
struct dnsp_DnssrvRpcRecord rec2;
}
if (el->num_values == 0) {
- ldb_msg_remove_element(res->msgs[0], el);
+ el->flags = LDB_FLAG_MOD_DELETE;
+ } else {
+ el->flags = LDB_FLAG_MOD_REPLACE;
}
- el->flags = LDB_FLAG_MOD_REPLACE;
ret = ldb_modify(state->samdb, res->msgs[0]);
b9_reset_session_info(state);
}
if (el->num_values == 0) {
- ldb_msg_remove_element(res->msgs[0], el);
+ el->flags = LDB_FLAG_MOD_DELETE;
+ } else {
+ el->flags = LDB_FLAG_MOD_REPLACE;
}
- el->flags = LDB_FLAG_MOD_REPLACE;
ret = ldb_modify(state->samdb, res->msgs[0]);
b9_reset_session_info(state);