|
|
1.1 ! root 1: /* dsp_cache.c - */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/quipu/RCS/dsp_cache.c,v 7.0 89/11/23 22:17:27 mrose Rel $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/quipu/RCS/dsp_cache.c,v 7.0 89/11/23 22:17:27 mrose Rel $ ! 9: * ! 10: * ! 11: * $Log: dsp_cache.c,v $ ! 12: * Revision 7.0 89/11/23 22:17:27 mrose ! 13: * Release 6.0 ! 14: * ! 15: */ ! 16: ! 17: /* ! 18: * NOTICE ! 19: * ! 20: * Acquisition, use, and distribution of this module and related ! 21: * materials are subject to the restrictions of a license agreement. ! 22: * Consult the Preface in the User's Manual for the full terms of ! 23: * this agreement. ! 24: * ! 25: */ ! 26: ! 27: ! 28: #include "quipu/util.h" ! 29: #include "quipu/dua.h" ! 30: #include "quipu/list.h" ! 31: #include "quipu/entry.h" ! 32: #include "quipu/common.h" ! 33: #include "quipu/dsargument.h" ! 34: #include "quipu/dsap.h" ! 35: ! 36: extern time_t timenow; ! 37: extern LLog * log_dsap; ! 38: extern int local_cache_size; ! 39: ! 40: Entry cache_dsp_entry (ptr) ! 41: EntryInfo *ptr; ! 42: { ! 43: /* assumes entry passed is complete */ ! 44: ! 45: Entry make_path (); ! 46: Entry eptr; ! 47: ! 48: Attr_Sequence asptr; ! 49: extern oid_table_attr * tab_acl; ! 50: ! 51: struct DSError error; ! 52: DN dnptr; ! 53: char aclfound = FALSE; ! 54: ! 55: for (asptr = ptr->ent_attr; asptr != NULLATTR; asptr = asptr->attr_link) { ! 56: if (asptr->attr_type == tab_acl) { ! 57: aclfound = TRUE; ! 58: break; ! 59: } ! 60: } ! 61: ! 62: if (!aclfound) { ! 63: LLOG (log_dsap,LLOG_NOTICE,("No ACL in dsp_cache")); ! 64: return NULLENTRY; /* don't cache if no acl */ ! 65: } ! 66: ! 67: for (dnptr = ptr->ent_dn; dnptr->dn_parent != NULLDN; dnptr = dnptr->dn_parent) ! 68: ; ! 69: ! 70: if ((eptr = local_find_entry (ptr->ent_dn, FALSE)) != NULLENTRY) { ! 71: if ((eptr->e_data == E_TYPE_CACHE_FROM_MASTER) || ! 72: (eptr->e_data == E_TYPE_CONSTRUCTOR)) { ! 73: as_free (eptr->e_attributes); ! 74: eptr->e_attributes = as_cpy(ptr->ent_attr); ! 75: eptr->e_complete = TRUE; ! 76: eptr->e_data = E_TYPE_CACHE_FROM_MASTER; ! 77: eptr->e_age = timenow; ! 78: } ! 79: } else { ! 80: local_cache_size++; ! 81: eptr = make_path (ptr->ent_dn); ! 82: eptr->e_name = rdn_cpy (dnptr->dn_rdn); ! 83: eptr->e_complete = TRUE; ! 84: eptr->e_data = E_TYPE_CACHE_FROM_MASTER; ! 85: eptr->e_attributes = as_cpy(ptr->ent_attr); ! 86: eptr->e_age = timenow; ! 87: } ! 88: ! 89: if (unravel_attribute (eptr,&error) == NOTOK) { ! 90: /* Keep name, but throw away attributes */ ! 91: local_cache_size--; ! 92: eptr->e_data = E_TYPE_CONSTRUCTOR; ! 93: eptr->e_complete = FALSE; ! 94: as_free (eptr->e_attributes); ! 95: eptr->e_attributes = NULLATTR; ! 96: log_ds_error (&error); ! 97: ds_error_free (&error); ! 98: return NULLENTRY; ! 99: } ! 100: return (eptr); ! 101: } ! 102: ! 103: ! 104: ! 105: dsp_cache (arg,res,ctx,binddn) ! 106: struct DSArgument *arg; ! 107: struct DSResult *res; ! 108: char ctx; ! 109: DN binddn; ! 110: { ! 111: EntryInfo *ptr; ! 112: Entry entryptr; ! 113: Attr_Sequence eis_select (); ! 114: ! 115: switch(arg->arg_type) { ! 116: case OP_READ: ! 117: if (((entryptr = cache_dsp_entry (&res->res_rd.rdr_entry)) != NULLENTRY) && ctx == DS_CTX_X500_DAP) { ! 118: /* remove acl if DAP user not allowed it */ ! 119: as_free (res->res_rd.rdr_entry.ent_attr); ! 120: res->res_rd.rdr_entry.ent_attr = eis_select (arg->arg_rd.rda_eis,entryptr,binddn,FALSE); ! 121: } ! 122: break; ! 123: case OP_SEARCH: ! 124: if ((arg->arg_sr.sra_eis.eis_allattributes == TRUE) && ! 125: (arg->arg_sr.sra_eis.eis_infotypes == EIS_ATTRIBUTESANDVALUES)) { ! 126: for (ptr = res->res_sr.CSR_entries; ptr != NULLENTRYINFO; ptr = ptr->ent_next) ! 127: (void) cache_dsp_entry (ptr); ! 128: } ! 129: break; ! 130: case OP_LIST: ! 131: if (ctx == DS_CTX_QUIPU_DSP) ! 132: cache_list (res->res_ls.lsr_subordinates, ! 133: res->res_ls.lsr_limitproblem, ! 134: arg->arg_ls.lsa_object, ! 135: arg->arg_ls.lsa_common.ca_servicecontrol.svc_sizelimit); ! 136: break; ! 137: ! 138: /* the following change an entry - the easiest thing is to ! 139: deleted the cached entry and start again */ ! 140: case OP_ADDENTRY: ! 141: delete_cache (arg->arg_ad.ada_object); ! 142: break; ! 143: case OP_REMOVEENTRY: ! 144: delete_cache (arg->arg_rm.rma_object); ! 145: break; ! 146: case OP_MODIFYENTRY: ! 147: delete_cache (arg->arg_me.mea_object); ! 148: break; ! 149: case OP_MODIFYRDN: ! 150: delete_cache (arg->arg_mr.mra_object); ! 151: break; ! 152: default: ! 153: break; ! 154: } ! 155: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.