diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-09-28 13:10:13 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-09-28 13:11:25 +1000 |
commit | 0b0edbb606eb291b293e1bd0f3adfbbe76318d89 (patch) | |
tree | e0c6fc59376755775be8a217d7fe8e9a80c96d87 /source4/dsdb/kcc | |
parent | f279b57f194d1be3600215b98e7e5fc6431d31c3 (diff) | |
download | samba-0b0edbb606eb291b293e1bd0f3adfbbe76318d89.tar.gz samba-0b0edbb606eb291b293e1bd0f3adfbbe76318d89.tar.bz2 samba-0b0edbb606eb291b293e1bd0f3adfbbe76318d89.zip |
s4-kcc: remove stale repsFrom entries in kcc run
Diffstat (limited to 'source4/dsdb/kcc')
-rw-r--r-- | source4/dsdb/kcc/kcc_periodic.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source4/dsdb/kcc/kcc_periodic.c b/source4/dsdb/kcc/kcc_periodic.c index dae0c1e235..dfbbf2404b 100644 --- a/source4/dsdb/kcc/kcc_periodic.c +++ b/source4/dsdb/kcc/kcc_periodic.c @@ -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); @@ -84,6 +85,16 @@ static NTSTATUS kccsrv_add_repsFrom(struct kccsrv_service *s, TALLOC_CTX *mem_ct modified = true; } } + + /* 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); |