DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T d

⟦648b50759⟧ TextFile

    Length: 4154 (0x103a)
    Types: TextFile
    Names: »dsp_cache.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z« 
        └─⟦de7628f85⟧ 
            └─⟦this⟧ »isode-6.0/quipu/dsp_cache.c« 

TextFile

/* dsp_cache.c - */

#ifndef	lint
static char *rcsid = "$Header: /f/osi/quipu/RCS/dsp_cache.c,v 7.0 89/11/23 22:17:27 mrose Rel $";
#endif

/* 
 * $Header: /f/osi/quipu/RCS/dsp_cache.c,v 7.0 89/11/23 22:17:27 mrose Rel $
 *
 *
 * $Log:	dsp_cache.c,v $
 * Revision 7.0  89/11/23  22:17:27  mrose
 * Release 6.0
 * 
 */

/*
 *				  NOTICE
 *
 *    Acquisition, use, and distribution of this module and related
 *    materials are subject to the restrictions of a license agreement.
 *    Consult the Preface in the User's Manual for the full terms of
 *    this agreement.
 *
 */


#include "quipu/util.h"
#include "quipu/dua.h"
#include "quipu/list.h"
#include "quipu/entry.h"
#include "quipu/common.h"
#include "quipu/dsargument.h"

extern time_t time();
extern LLog * log_dsap;
extern int local_cache_size;

Entry cache_dsp_entry (ptr)
EntryInfo      *ptr;
{
	/* assumes entry passed is complete */

	Entry           make_path ();
	Entry		eptr;

	Attr_Sequence   asptr;
	extern oid_table_attr * tab_acl;

	struct DSError  error;
	DN              dnptr;
	char		aclfound = FALSE;

	if (dn_decode (ptr->ent_dn) == NOTOK) {
		LLOG (log_dsap,LLOG_NOTICE,("dn_decode failed in dsp_cache"));
		return NULLENTRY;
	}
	if (as_decode (ptr->ent_attr) == NOTOK) {
		LLOG (log_dsap,LLOG_NOTICE,("as_decode failed in dsp_cache"));
		return NULLENTRY;
	}

	for (asptr = ptr->ent_attr; asptr != NULLATTR; asptr = asptr->attr_link) {
		if (asptr->attr_type.at_table == tab_acl) {
			aclfound = TRUE;
			break; 
		}
	}

	if (!aclfound) {
		LLOG (log_dsap,LLOG_NOTICE,("No ACL in dsp_cache"));
		return NULLENTRY;		/* don't cache if no acl */
	}

	for (dnptr = ptr->ent_dn; dnptr->dn_parent != NULLDN; dnptr = dnptr->dn_parent)
		;

	if ((eptr = local_find_entry (ptr->ent_dn, FALSE)) != NULLENTRY) {
		if ((eptr->e_data == E_TYPE_CACHE_FROM_MASTER) ||
		    (eptr->e_data == E_TYPE_CONSTRUCTOR)) {	
			as_free (eptr->e_attributes);
			eptr->e_attributes = as_cpy(ptr->ent_attr);
			eptr->e_complete = TRUE;
			eptr->e_data = E_TYPE_CACHE_FROM_MASTER;
			eptr->e_age = time((time_t *)0);
		    }
	} else {
		local_cache_size++;
		eptr = make_path (ptr->ent_dn);
		eptr->e_name = rdn_cpy (dnptr->dn_rdn);
		eptr->e_complete = TRUE;
		eptr->e_data = E_TYPE_CACHE_FROM_MASTER;
		eptr->e_attributes = as_cpy(ptr->ent_attr);
		eptr->e_age = time((time_t *)0);
	}

	if (unravel_attribute (eptr,&error,FALSE) == NOTOK) {
		/* Keep name, but throw away attributes */
		local_cache_size--;
		eptr->e_data = E_TYPE_CONSTRUCTOR;
		eptr->e_complete = FALSE;
		as_free (eptr->e_attributes);
		eptr->e_attributes = NULLATTR;
		log_ds_error (&error);
		ds_error_free (&error);
		return NULLENTRY;
	}
	return (eptr);
}



dsp_cache (arg,res,ctx,binddn)
struct DSArgument *arg;
struct DSResult   *res;
char ctx;
DN binddn;
{
EntryInfo *ptr;
Entry entryptr;
Attr_Sequence eis_select ();

    switch(arg->arg_type) {    
    case OP_READ:
	if (((entryptr = cache_dsp_entry (&res->res_rd.rdr_entry)) != NULLENTRY) && ctx == CN_CTX_X500_DAP) {
		/* remove acl if DAP user not allowed it */
		as_free (res->res_rd.rdr_entry.ent_attr);
		res->res_rd.rdr_entry.ent_attr = eis_select (arg->arg_rd.rda_eis,entryptr,binddn,FALSE);
	}
	break;
    case OP_SEARCH:
 	if ((arg->arg_sr.sra_eis.eis_allattributes == TRUE) &&
 	    (arg->arg_sr.sra_eis.eis_infotypes == EIS_ATTRIBUTESANDVALUES)) {
	 	for (ptr = res->res_sr.CSR_entries; ptr != NULLENTRYINFO; ptr = ptr->ent_next) 
 			(void) cache_dsp_entry (ptr);
	}
     	break;
    case OP_LIST:
	if (ctx == CN_CTX_QUIPU_DSP)
		cache_list (res->res_ls.lsr_subordinates,
 		    res->res_ls.lsr_limitproblem,
 		    arg->arg_ls.lsa_object,
 		    arg->arg_ls.lsa_common.ca_servicecontrol.svc_sizelimit);
     	break;

    /* the following change an entry - the easiest thing is to
       deleted the cached entry and start again */
    case OP_ADDENTRY:
	delete_cache (arg->arg_ad.ada_object);
	break;
    case OP_REMOVEENTRY:
	delete_cache (arg->arg_rm.rma_object);
    	break;
    case OP_MODIFYENTRY:
	delete_cache (arg->arg_me.mea_object);
	break;
    case OP_MODIFYRDN:
	delete_cache (arg->arg_mr.mra_object);
	break;
    default:    
	break;
    }
}