~ubuntu-branches/debian/experimental/389-ds-base/experimental

« back to all changes in this revision

Viewing changes to ldap/servers/plugins/cos/cos_cache.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2014-07-08 15:50:11 UTC
  • mfrom: (0.2.2)
  • Revision ID: package-import@ubuntu.com-20140708155011-r66lvtioamqwaype
Tags: 1.3.2.19-1
* New upstream release.
* admin_scripts.diff: Updated to fix more bashisms.
* watch: Update the url.
* Install failedbinds.py and logregex.py scripts.
* init: Use status from init-functions.
* control: Update my email.

Show diffs side-by-side

added added

removed removed

Lines of Context:
727
727
 * if a particular attempt to add a definition fails: info.ret gets set to
728
728
 * zero only if we succed to add a def.
729
729
*/
730
 
static int      cos_dn_defs_cb (Slapi_Entry* e, void *callback_data)
 
730
static int 
 
731
cos_dn_defs_cb (Slapi_Entry* e, void *callback_data)
731
732
{
732
733
        struct dn_defs_info *info;
733
734
        cosAttrValue **pSneakyVal = 0;
877
878
                                                              dnVals[valIndex]->bv_val);
878
879
                                }
879
880
 
880
 
                                if(!pCosTargetTree)
881
 
                                {
882
 
                                        /* get the parent of the definition */
883
 
                                        char *orig = slapi_dn_parent(pDn->val);
884
 
                                        Slapi_DN *psdn = slapi_sdn_new_dn_byval(orig);
885
 
                                        char *parent = (char *)slapi_sdn_get_dn(psdn);
886
 
                                        if (!parent) {
887
 
                                                parent = (char *)slapi_sdn_get_udn(psdn);
888
 
                                                LDAPDebug(LDAP_DEBUG_ANY, 
889
 
                                                  "cos_cache_build_definition_list: "
890
 
                                                  "failed to normalize parent dn %s. "
891
 
                                                  "Adding the pre normalized dn.\n", 
892
 
                                                  parent, 0, 0);
893
 
                                        }
894
 
                                        cos_cache_add_attrval(&pCosTargetTree, parent);
895
 
                                        if (!pCosTemplateDn) {
896
 
                                                cos_cache_add_attrval(&pCosTemplateDn, parent);
897
 
                                        }
898
 
                                        slapi_sdn_free(&psdn);
899
 
                                }
900
 
                                
901
881
                                slapi_vattrspi_regattr((vattr_sp_handle *)vattr_handle,
902
882
                                                        dnVals[valIndex]->bv_val, NULL, NULL);
903
883
                        } /* if(attrType is cosAttribute) */
904
 
                                                                                
 
884
 
905
885
                        /*
906
886
                         * Add the attributetype to the appropriate
907
887
                         * list.
913
893
                ber_bvecfree( dnVals );
914
894
                dnVals = NULL;
915
895
        } while(!slapi_entry_next_attr(e, dnAttr, &dnAttr));
 
896
 
 
897
        if (pCosAttribute && (!pCosTargetTree || !pCosTemplateDn)) {
 
898
                /* get the parent of the definition */
 
899
                char *orig = slapi_dn_parent(pDn->val);
 
900
                char *parent = NULL;
 
901
                if (orig) {
 
902
                        parent = slapi_create_dn_string("%s", orig);
 
903
                        if (!parent) {
 
904
                                parent = orig;
 
905
                                LDAPDebug1Arg(LDAP_DEBUG_ANY, 
 
906
                                              "cos_dn_defs_cb: "
 
907
                                              "failed to normalize parent dn %s. "
 
908
                                              "Adding the pre normalized dn.\n", 
 
909
                                              parent);
 
910
                        }
 
911
                        if (!pCosTargetTree) {
 
912
                                cos_cache_add_attrval(&pCosTargetTree, parent);
 
913
                        }
 
914
                        if (!pCosTemplateDn) {
 
915
                                cos_cache_add_attrval(&pCosTemplateDn, parent);
 
916
                        }
 
917
                        if (parent != orig) {
 
918
                                slapi_ch_free_string(&parent);
 
919
                        }
 
920
                        slapi_ch_free_string(&orig);
 
921
                } else {
 
922
                        LDAPDebug1Arg(LDAP_DEBUG_ANY, 
 
923
                                      "cos_dn_defs_cb: "
 
924
                                      "failed to get parent dn of cos definition %s.\n",
 
925
                                      pDn->val);
 
926
                        if (!pCosTemplateDn) {
 
927
                                if (!pCosTargetTree) {
 
928
                                        LDAPDebug0Args(LDAP_DEBUG_ANY, "cosTargetTree and cosTemplateDn are not set.\n");
 
929
                                } else {
 
930
                                        LDAPDebug0Args(LDAP_DEBUG_ANY, "cosTemplateDn is not set.\n");
 
931
                                }
 
932
                        } else if (!pCosTargetTree) {
 
933
                                LDAPDebug0Args(LDAP_DEBUG_ANY, "cosTargetTree is not set.\n");
 
934
                        }
 
935
                }
 
936
        }
916
937
        
917
938
        /*
918
939
        determine the type of class of service scheme 
951
972
        */
952
973
        
953
974
        /* these must exist */
954
 
        if(             pDn &&
955
 
                pObjectclass && 
956
 
                
 
975
        if(pDn && pObjectclass && 
957
976
                (
958
977
                (cosType == COSTYPE_CLASSIC &&
959
978
                pCosTemplateDn && 
3582
3601
                        {
3583
3602
                                pObj = (char*)slapi_value_get_string(val);
3584
3603
 
3585
 
                                /*
3586
 
                                 * objectclasses are ascii--maybe strcasecmp() is faster than
3587
 
                                 * slapi_utf8casecmp()
3588
 
                                */
3589
 
                                if(     !strcasecmp(pObj, "cosdefinition") ||
3590
 
                                        !strcasecmp(pObj, "cossuperdefinition") ||
3591
 
                                        !strcasecmp(pObj, "costemplate")
3592
 
                                        )
 
3604
                                if(!strcasecmp(pObj, "cosdefinition") ||
 
3605
                                   !strcasecmp(pObj, "cossuperdefinition") ||
 
3606
                                   !strcasecmp(pObj, "costemplate"))
3593
3607
                                {
3594
3608
                                        rc = 1;
3595
3609
                                }