|
Lines 303-308
WERROR dns_common_replace(struct ldb_context *samdb,
Link Here
|
| 303 |
TALLOC_CTX *mem_ctx, |
303 |
TALLOC_CTX *mem_ctx, |
| 304 |
struct ldb_dn *dn, |
304 |
struct ldb_dn *dn, |
| 305 |
bool needs_add, |
305 |
bool needs_add, |
|
|
306 |
bool tombstoned, |
| 306 |
uint32_t serial, |
307 |
uint32_t serial, |
| 307 |
struct dnsp_DnssrvRpcRecord *records, |
308 |
struct dnsp_DnssrvRpcRecord *records, |
| 308 |
uint16_t rec_count) |
309 |
uint16_t rec_count) |
|
Lines 312-318
WERROR dns_common_replace(struct ldb_context *samdb,
Link Here
|
| 312 |
int ret; |
313 |
int ret; |
| 313 |
WERROR werr; |
314 |
WERROR werr; |
| 314 |
struct ldb_message *msg = NULL; |
315 |
struct ldb_message *msg = NULL; |
| 315 |
bool was_tombstoned = false; |
316 |
bool tombstoned_marker = false; |
| 316 |
bool become_tombstoned = false; |
317 |
bool become_tombstoned = false; |
| 317 |
|
318 |
|
| 318 |
msg = ldb_msg_new(mem_ctx); |
319 |
msg = ldb_msg_new(mem_ctx); |
|
Lines 352-358
WERROR dns_common_replace(struct ldb_context *samdb,
Link Here
|
| 352 |
|
353 |
|
| 353 |
if (records[i].wType == DNS_TYPE_TOMBSTONE) { |
354 |
if (records[i].wType == DNS_TYPE_TOMBSTONE) { |
| 354 |
if (records[i].data.timestamp != 0) { |
355 |
if (records[i].data.timestamp != 0) { |
| 355 |
was_tombstoned = true; |
356 |
tombstoned_marker = true; |
| 356 |
} |
357 |
} |
| 357 |
continue; |
358 |
continue; |
| 358 |
} |
359 |
} |
|
Lines 391-423
WERROR dns_common_replace(struct ldb_context *samdb,
Link Here
|
| 391 |
enum ndr_err_code ndr_err; |
392 |
enum ndr_err_code ndr_err; |
| 392 |
struct timeval tv; |
393 |
struct timeval tv; |
| 393 |
|
394 |
|
| 394 |
if (was_tombstoned) { |
395 |
if (tombstoned && tombstoned_marker) { |
| 395 |
/* |
396 |
/* |
| 396 |
* This is already a tombstoned object. |
397 |
* This is already a tombstoned object. |
| 397 |
* Just leave it instead of updating the time stamp. |
398 |
* Just leave it instead of updating the time stamp. |
| 398 |
*/ |
399 |
*/ |
| 399 |
return WERR_OK; |
400 |
return WERR_OK; |
| 400 |
} |
401 |
} else if (!tombstoned_marker) { |
|
|
402 |
tv = timeval_current(); |
| 403 |
tbs = (struct dnsp_DnssrvRpcRecord) { |
| 404 |
.wType = DNS_TYPE_TOMBSTONE, |
| 405 |
.dwSerial = serial, |
| 406 |
.data.timestamp = timeval_to_nttime(&tv), |
| 407 |
}; |
| 401 |
|
408 |
|
| 402 |
tv = timeval_current(); |
409 |
ndr_err = ndr_push_struct_blob(v, el->values, &tbs, |
| 403 |
tbs = (struct dnsp_DnssrvRpcRecord) { |
410 |
(ndr_push_flags_fn_t)ndr_push_dnsp_DnssrvRpcRecord); |
| 404 |
.wType = DNS_TYPE_TOMBSTONE, |
411 |
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { |
| 405 |
.dwSerial = serial, |
412 |
DEBUG(0, ("Failed to push dnsp_DnssrvRpcRecord\n")); |
| 406 |
.data.timestamp = timeval_to_nttime(&tv), |
413 |
return DNS_ERR(SERVER_FAILURE); |
| 407 |
}; |
414 |
} |
|
|
415 |
el->num_values++; |
| 408 |
|
416 |
|
| 409 |
ndr_err = ndr_push_struct_blob(v, el->values, &tbs, |
417 |
become_tombstoned = true; |
| 410 |
(ndr_push_flags_fn_t)ndr_push_dnsp_DnssrvRpcRecord); |
|
|
| 411 |
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { |
| 412 |
DEBUG(0, ("Failed to push dnsp_DnssrvRpcRecord\n")); |
| 413 |
return DNS_ERR(SERVER_FAILURE); |
| 414 |
} |
418 |
} |
| 415 |
el->num_values++; |
|
|
| 416 |
|
| 417 |
become_tombstoned = true; |
| 418 |
} |
419 |
} |
| 419 |
|
420 |
|
| 420 |
if (was_tombstoned || become_tombstoned) { |
421 |
if (tombstoned || tombstoned_marker || become_tombstoned) { |
| 421 |
ret = ldb_msg_add_empty(msg, "dNSTombstoned", |
422 |
ret = ldb_msg_add_empty(msg, "dNSTombstoned", |
| 422 |
LDB_FLAG_MOD_REPLACE, NULL); |
423 |
LDB_FLAG_MOD_REPLACE, NULL); |
| 423 |
if (ret != LDB_SUCCESS) { |
424 |
if (ret != LDB_SUCCESS) { |