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

« back to all changes in this revision

Viewing changes to ldap/servers/plugins/memberof/memberof.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2013-08-30 00:31:55 UTC
  • mfrom: (1.2.1)
  • Revision ID: package-import@ubuntu.com-20130830003155-oimuzdqopkvp2cd0
Tags: 1.3.1.7-0ubuntu1
Sync from unreleased debian git.

Show diffs side-by-side

added added

removed removed

Lines of Context:
380
380
 */
381
381
int memberof_postop_del(Slapi_PBlock *pb)
382
382
{
383
 
        int ret = 0;
 
383
        int ret = SLAPI_PLUGIN_SUCCESS;
384
384
        MemberOfConfig configCopy = {0, 0, 0, 0};
385
385
        Slapi_DN *sdn;
386
386
        void *caller_id = NULL;
393
393
        slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY, &caller_id);
394
394
        if (caller_id == memberof_get_plugin_id()) {
395
395
                /* Just return without processing */
396
 
                return 0;
 
396
                return SLAPI_PLUGIN_SUCCESS;
397
397
        }
398
398
 
399
399
        if(memberof_oktodo(pb) && (sdn = memberof_getsdn(pb)))
460
460
        /* Loop through each grouping attribute to find groups that have
461
461
         * dn as a member.  For any matches, delete the dn value from the
462
462
         * same grouping attribute. */
463
 
        for (i = 0; config->groupattrs[i]; i++)
 
463
        for (i = 0; config->groupattrs && config->groupattrs[i]; i++)
464
464
        {
465
465
                memberof_del_dn_data data = {(char *)slapi_sdn_get_dn(sdn),
466
466
                                             config->groupattrs[i]};
626
626
 */
627
627
int memberof_postop_modrdn(Slapi_PBlock *pb)
628
628
{
629
 
        int ret = 0;
 
629
        int ret = SLAPI_PLUGIN_SUCCESS;
630
630
        void *caller_id = NULL;
631
631
 
632
632
        slapi_log_error( SLAPI_LOG_TRACE, MEMBEROF_PLUGIN_SUBSYSTEM,
637
637
        slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY, &caller_id);
638
638
        if (caller_id == memberof_get_plugin_id()) {
639
639
                /* Just return without processing */
640
 
                return 0;
 
640
                return SLAPI_PLUGIN_SUCCESS;
641
641
        }
642
642
 
643
643
        if(memberof_oktodo(pb))
724
724
        /* Loop through each grouping attribute to find groups that have
725
725
         * pre_dn as a member.  For any matches, replace pre_dn with post_dn
726
726
         * using the same grouping attribute. */
727
 
        for (i = 0; config->groupattrs[i]; i++)
 
727
        for (i = 0; config->groupattrs && config->groupattrs[i]; i++)
728
728
        {
729
729
                replace_dn_data data = {(char *)slapi_sdn_get_ndn(pre_sdn),
730
730
                                        (char *)slapi_sdn_get_ndn(post_sdn),
801
801
 */
802
802
int memberof_postop_modify(Slapi_PBlock *pb)
803
803
{
804
 
        int ret = 0;
 
804
        int ret = SLAPI_PLUGIN_SUCCESS;
805
805
        Slapi_DN *sdn = NULL;
806
806
        Slapi_Mods *smods = 0;
807
807
        Slapi_Mod *smod = 0;
817
817
        slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY, &caller_id);
818
818
        if (caller_id == memberof_get_plugin_id()) {
819
819
                /* Just return without processing */
820
 
                return 0;
 
820
                return SLAPI_PLUGIN_SUCCESS;
821
821
        }
822
822
 
823
823
        if(memberof_oktodo(pb) && (sdn = memberof_getsdn(pb)))
945
945
 */
946
946
int memberof_postop_add(Slapi_PBlock *pb)
947
947
{
948
 
        int ret = 0;
 
948
        int ret = SLAPI_PLUGIN_SUCCESS;
949
949
        int interested = 0;
950
950
        Slapi_DN *sdn = 0;
951
951
        void *caller_id = NULL;
958
958
        slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY, &caller_id);
959
959
        if (caller_id == memberof_get_plugin_id()) {
960
960
                /* Just return without processing */
961
 
                return 0;
 
961
                return SLAPI_PLUGIN_SUCCESS;
962
962
        }
963
963
 
964
964
        if(memberof_oktodo(pb) && (sdn = memberof_getsdn(pb)))
2218
2218
 */
2219
2219
int memberof_compare(MemberOfConfig *config, const void *a, const void *b)
2220
2220
{
2221
 
        Slapi_Value *val1 = *((Slapi_Value **)a);
2222
 
        Slapi_Value *val2 = *((Slapi_Value **)b);
 
2221
        Slapi_Value *val1;
 
2222
        Slapi_Value *val2;
 
2223
 
 
2224
        if(a == NULL && b != NULL){
 
2225
                return 1;
 
2226
        } else if(a != NULL && b == NULL){
 
2227
                return -1;
 
2228
        } else if(a == NULL && b == NULL){
 
2229
                return 0;
 
2230
        }
 
2231
        val1 = *((Slapi_Value **)a);
 
2232
        val2 = *((Slapi_Value **)b);
2223
2233
 
2224
2234
        /* We only need to provide a Slapi_Attr here for it's syntax.  We
2225
2235
         * already validated all grouping attributes to use the Distinguished
2393
2403
                goto out;
2394
2404
        }
2395
2405
 
2396
 
        if ((filter = fetch_attr(e, "filter", "(objectclass=inetuser)")) == NULL)
 
2406
        if ((filter = fetch_attr(e, "filter", "(|(objectclass=inetuser)(objectclass=inetadmin))")) == NULL)
2397
2407
        {
2398
2408
                *returncode = LDAP_OBJECT_CLASS_VIOLATION;
2399
2409
                rv = SLAPI_DSE_CALLBACK_ERROR;