~ubuntu-branches/ubuntu/raring/389-ds-base/raring

« back to all changes in this revision

Viewing changes to ldap/servers/plugins/replication/repl5_plugins.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2013-02-06 18:06:31 UTC
  • mfrom: (11.1.1 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20130206180631-h6ldv3k506hmm46e
Tags: 1.3.0.2-0ubuntu2
debian/*: Fix time stamps due to clock skew (FTBFS).

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
                        }
134
134
                        else
135
135
                        {
136
 
                                local_purl = slapi_ch_smprintf("ldap://%s:%s", host, port);
 
136
                                if(slapi_is_ipv6_addr(host)){
 
137
                                        /* need to put brackets around the ipv6 address */
 
138
                                        local_purl = slapi_ch_smprintf("ldap://[%s]:%s", host, port);
 
139
                                } else {
 
140
                                        local_purl = slapi_ch_smprintf("ldap://%s:%s", host, port);
 
141
                                }
137
142
                        }
138
143
 
139
144
                        /* slapi_ch_free acceptS NULL pointer */
474
479
            }
475
480
            else
476
481
            {
477
 
                PR_ASSERT(0); /* JCMREPL - A Replicated Operation with no Repl Baggage control... What does that mean? */
 
482
                /*  PR_ASSERT(0); JCMREPL - A Replicated Operation with no Repl Baggage control... What does that mean? */
 
483
                /*
 
484
                 *  This could be RI plugin responding to a replicated update from AD or some other master that is not
 
485
                 *  using the RI plugin, so don't PR_ASSERT here.  This only happens if we configure the RI plugin with
 
486
                 *  "nsslapd-pluginAllowReplUpdates: on", also the RI plugin only issues "modifies".
 
487
                 */
478
488
            }
479
489
        }
480
490
        else
690
700
        }
691
701
}
692
702
 
 
703
/* pure bepreop's -- should be done before transaction starts */
693
704
int 
694
705
multimaster_bepreop_add (Slapi_PBlock *pb)
695
706
{
706
717
        if (!is_fixup_operation)
707
718
        {
708
719
                slapi_pblock_set(pb, SLAPI_TXN_RUV_MODS_FN,
709
 
                        (void *)replica_ruv_smods_for_op);
710
 
                if (is_replicated_operation) { 
 
720
                                 (void *)replica_ruv_smods_for_op);
 
721
                if (!repl5_is_betxn && is_replicated_operation) { 
 
722
                        /* if is_betxn is on, urp is called at betxn preop */
711
723
                        rc = urp_add_operation(pb);
712
724
                }
713
725
        }
731
743
        if(!is_fixup_operation)
732
744
        {
733
745
                slapi_pblock_set(pb, SLAPI_TXN_RUV_MODS_FN,
734
 
                        (void *)replica_ruv_smods_for_op);
735
 
                if (is_replicated_operation) {
 
746
                                 (void *)replica_ruv_smods_for_op);
 
747
                if (!repl5_is_betxn && is_replicated_operation) { 
 
748
                        /* if is_betxn is on, urp is called at betxn preop */
736
749
                        rc = urp_delete_operation(pb);
737
750
                }
738
751
        }
756
769
        if(!is_fixup_operation)
757
770
        {
758
771
                slapi_pblock_set(pb, SLAPI_TXN_RUV_MODS_FN,
759
 
                        (void *)replica_ruv_smods_for_op);
760
 
                if (is_replicated_operation) {
 
772
                                 (void *)replica_ruv_smods_for_op);
 
773
                if (!repl5_is_betxn && is_replicated_operation) { 
 
774
                        /* if is_betxn is on, urp is called at betxn preop */
761
775
                        rc = urp_modify_operation(pb);
762
776
                }
763
777
        }
784
798
        if(!is_fixup_operation)
785
799
        {
786
800
                slapi_pblock_set(pb, SLAPI_TXN_RUV_MODS_FN,
787
 
                        (void *)replica_ruv_smods_for_op);
788
 
                if (is_replicated_operation) {
 
801
                                 (void *)replica_ruv_smods_for_op);
 
802
                if (!repl5_is_betxn && is_replicated_operation) { 
 
803
                        /* if is_betxn is on, urp is called at betxn preop */
789
804
                        rc = urp_modrdn_operation(pb);
790
805
                }
791
806
        }
796
811
        return rc;
797
812
}
798
813
 
 
814
/* betxn preop's */
 
815
int 
 
816
multimaster_betxnpreop_add (Slapi_PBlock *pb)
 
817
{
 
818
        int rc= 0;
 
819
        Slapi_Operation *op;
 
820
        int is_replicated_operation;
 
821
        int is_fixup_operation;
 
822
 
 
823
        slapi_pblock_get(pb, SLAPI_OPERATION, &op);
 
824
        is_replicated_operation= operation_is_flag_set(op,OP_FLAG_REPLICATED);
 
825
        is_fixup_operation= operation_is_flag_set(op,OP_FLAG_REPL_FIXUP);
 
826
 
 
827
        /* For replicated operations, apply URP algorithm */
 
828
        if (!is_fixup_operation)
 
829
        {
 
830
                if (is_replicated_operation) { 
 
831
                        rc = urp_add_operation(pb);
 
832
                }
 
833
        }
 
834
 
 
835
        return rc;
 
836
}
 
837
 
 
838
int 
 
839
multimaster_betxnpreop_delete (Slapi_PBlock *pb)
 
840
{
 
841
        int rc= 0;
 
842
        Slapi_Operation *op;
 
843
        int is_replicated_operation;
 
844
        int is_fixup_operation;
 
845
 
 
846
        slapi_pblock_get(pb, SLAPI_OPERATION, &op);
 
847
        is_replicated_operation= operation_is_flag_set(op,OP_FLAG_REPLICATED);
 
848
        is_fixup_operation= operation_is_flag_set(op,OP_FLAG_REPL_FIXUP);
 
849
 
 
850
        /* For replicated operations, apply URP algorithm */
 
851
        if(!is_fixup_operation)
 
852
        {
 
853
                if (is_replicated_operation) {
 
854
                        rc = urp_delete_operation(pb);
 
855
                }
 
856
        }
 
857
 
 
858
        return rc;
 
859
}
 
860
 
 
861
int 
 
862
multimaster_betxnpreop_modify (Slapi_PBlock *pb)
 
863
{
 
864
        int rc= 0;
 
865
        Slapi_Operation *op;
 
866
        int is_replicated_operation;
 
867
        int is_fixup_operation;
 
868
 
 
869
        slapi_pblock_get(pb, SLAPI_OPERATION, &op);
 
870
        is_replicated_operation= operation_is_flag_set(op,OP_FLAG_REPLICATED);
 
871
        is_fixup_operation= operation_is_flag_set(op,OP_FLAG_REPL_FIXUP);
 
872
 
 
873
        /* For replicated operations, apply URP algorithm */
 
874
        if(!is_fixup_operation)
 
875
        {
 
876
                if (is_replicated_operation) {
 
877
                        rc = urp_modify_operation(pb);
 
878
                }
 
879
        }
 
880
 
 
881
        return rc;
 
882
}
 
883
 
 
884
int 
 
885
multimaster_betxnpreop_modrdn (Slapi_PBlock *pb)
 
886
{
 
887
        int rc= 0;
 
888
        Slapi_Operation *op;
 
889
        int is_replicated_operation;
 
890
        int is_fixup_operation;
 
891
 
 
892
        slapi_pblock_get(pb, SLAPI_OPERATION, &op);
 
893
        is_replicated_operation= operation_is_flag_set(op,OP_FLAG_REPLICATED);
 
894
        is_fixup_operation= operation_is_flag_set(op,OP_FLAG_REPL_FIXUP);
 
895
 
 
896
        /* For replicated operations, apply URP algorithm */
 
897
        if(!is_fixup_operation)
 
898
        {
 
899
                if (is_replicated_operation) {
 
900
                        rc = urp_modrdn_operation(pb);
 
901
                }
 
902
        }
 
903
 
 
904
        return rc;
 
905
}
 
906
 
799
907
int 
800
908
multimaster_bepostop_modrdn (Slapi_PBlock *pb)
801
909
{
877
985
    return write_changelog_and_ruv(pb);
878
986
}
879
987
 
 
988
/* If nsslapd-pluginbetxn is on */
 
989
int
 
990
multimaster_be_betxnpostop_delete (Slapi_PBlock *pb)
 
991
{
 
992
    int rc = 0;
 
993
    /* original betxnpost */
 
994
    rc = write_changelog_and_ruv(pb);
 
995
    /* original bepost */
 
996
    rc |= multimaster_bepostop_delete(pb);
 
997
    return rc;
 
998
}
 
999
 
 
1000
int
 
1001
multimaster_be_betxnpostop_modrdn (Slapi_PBlock *pb)
 
1002
{
 
1003
    int rc = 0;
 
1004
    /* original betxnpost */
 
1005
    rc = write_changelog_and_ruv(pb);
 
1006
    /* original bepost */
 
1007
    rc |= multimaster_bepostop_modrdn(pb);
 
1008
    return rc;
 
1009
}
 
1010
 
 
1011
int
 
1012
multimaster_be_betxnpostop_add (Slapi_PBlock *pb)
 
1013
{
 
1014
    int rc = 0;
 
1015
    /* original betxnpost */
 
1016
    rc = write_changelog_and_ruv(pb);
 
1017
    return rc;
 
1018
}
 
1019
 
 
1020
int
 
1021
multimaster_be_betxnpostop_modify (Slapi_PBlock *pb)
 
1022
{
 
1023
    int rc = 0;
 
1024
    /* original betxnpost */
 
1025
    rc = write_changelog_and_ruv(pb);
 
1026
    return rc;
 
1027
}
 
1028
 
880
1029
/* Helper functions */
881
1030
 
882
1031
/*