s4-kcc: Assert when unexpected repsFromToBlob version is passed
authorKamen Mazdrashki <kamenim@samba.org>
Fri, 27 Aug 2010 14:25:56 +0000 (17:25 +0300)
committerKamen Mazdrashki <kamenim@samba.org>
Sat, 28 Aug 2010 20:38:58 +0000 (23:38 +0300)
At present we only support v1 structures (Win2k3 and earlier),
so it is good to make it obvious.
In case we start supporting v2 we will be able to notice this
function should be refactored right away

source4/dsdb/kcc/kcc_periodic.c

index 3f37208dec4c94ad6bc140d213460b6a629460ec..4deb9124ebfce7d6f9d7bdde728fb23bf609cb2a 100644 (file)
@@ -59,11 +59,13 @@ static bool reps_in_list(struct repsFromToBlob *r, struct repsFromToBlob *reps,
 static bool check_MasterNC(struct kccsrv_partition *p, struct repsFromToBlob *r,
                           struct ldb_result *res)
 {
-       struct repsFromTo1 *r1;
-       r1 = &r->ctr.ctr1;
+       struct repsFromTo1 *r1 = &r->ctr.ctr1;
        struct GUID invocation_id = r1->source_dsa_invocation_id;
        unsigned int i, j;
 
+       /* we are expecting only version 1 */
+       SMB_ASSERT(r->version == 1);
+
        for (i=0; i<res->count; i++) {
                struct ldb_message *msg = res->msgs[i];
                struct ldb_message_element *el;