1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00

s4-kcc: remove stale repsFrom entries in kcc run

This commit is contained in:
Andrew Tridgell 2009-09-28 13:10:13 +10:00
parent f279b57f19
commit 0b0edbb606

View File

@ -75,6 +75,7 @@ static NTSTATUS kccsrv_add_repsFrom(struct kccsrv_service *s, TALLOC_CTX *mem_ct
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
/* add any new ones */
for (i=0; i<count; i++) {
if (!reps_in_list(&reps[i], old_reps, old_count)) {
old_reps = talloc_realloc(mem_ctx, old_reps, struct repsFromToBlob, old_count+1);
@ -85,6 +86,16 @@ static NTSTATUS kccsrv_add_repsFrom(struct kccsrv_service *s, TALLOC_CTX *mem_ct
}
}
/* remove any stale ones */
for (i=0; i<old_count; i++) {
if (!reps_in_list(&old_reps[i], reps, count)) {
memmove(&old_reps[i], &old_reps[i+1], (old_count-(i+1))*sizeof(old_reps[0]));
old_count--;
i--;
modified = true;
}
}
if (modified) {
werr = dsdb_savereps(s->samdb, mem_ctx, p->dn, "repsFrom", old_reps, old_count);
if (!W_ERROR_IS_OK(werr)) {