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 e

⟦da51216b5⟧ TextFile

    Length: 4265 (0x10a9)
    Types: TextFile
    Names: »eis_select.c«

Derivation

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

TextFile

/* eis_select.c - */

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

/*
 * $Header: /f/osi/quipu/RCS/eis_select.c,v 7.0 89/11/23 22:17:29 mrose Rel $
 *
 *
 * $Log:	eis_select.c,v $
 * Revision 7.0  89/11/23  22:17:29  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/commonarg.h"
#include "quipu/entry.h"

extern LLog * log_dsap;

#define EIS_SELECT eis.eis_select

static Attr_Sequence  cpy_as_comp_type ();
static Attr_Sequence  cpy_as_comp ();

Attr_Sequence eis_select (eis,entryptr,dn, qctx)
EntryInfoSelection eis;
Entry entryptr;
DN dn;
char qctx;	/* If TRUE - it is a Quipu context association */
		/* So treat as if "-allattributes -typesandvalves" */
		/* Plus - make sure the ACL is sent		*/
{
Attr_Sequence result = NULLATTR;
register Attr_Sequence trail;
register Attr_Sequence temp;
Attr_Sequence temp2;
register Attr_Sequence eptr;
DN node;
extern AttributeType at_acl;

	DLOG (log_dsap,LLOG_TRACE,("eis_select"));

	node = get_copy_dn (entryptr);

	if (eis.eis_allattributes || qctx) {
	    for(temp=entryptr->e_attributes; temp != NULLATTR; temp=temp->attr_link) {

		if ( ! (qctx && (AttrT_cmp (at_acl,&temp->attr_type) == 0)))
			if ( (temp->attr_acl != NULLACL_INFO) && 
				(check_acl(dn,ACL_READ,temp->attr_acl,node ) != OK ))
					continue;

		if ((eis.eis_infotypes == EIS_ATTRIBUTETYPESONLY) && !qctx)
			temp2 = cpy_as_comp_type (temp);
		else
			temp2 = cpy_as_comp (temp);

		if (result == NULLATTR) {
			result = temp2;
			trail = result;
		} else {
			trail->attr_link = temp2;
			trail = temp2;
		}
	    }
	} else {
 	    (void) as_decode (EIS_SELECT);
	    for(eptr=EIS_SELECT; eptr != NULLATTR; eptr=eptr->attr_link) {

		if ((temp = as_find_type (entryptr->e_attributes,&eptr->attr_type)) == NULLATTR)
			continue;

		if ( (temp->attr_acl != NULLACL_INFO)&& (check_acl(dn,ACL_READ,temp->attr_acl,node ) != OK ))
			continue;

		if (eis.eis_infotypes == EIS_ATTRIBUTETYPESONLY)
			temp2 = cpy_as_comp_type (temp);
		else
			temp2 = cpy_as_comp (temp);

		if (result == NULLATTR) {
			result = temp2;
			trail = result;
		} else {
			trail->attr_link = temp2;
			trail = temp2;
		}
	    }
	}
	dn_free (node);

	return (result);
}

static Attr_Sequence  cpy_as_comp (as)
Attr_Sequence  as;
{
Attr_Sequence ptr;

	if (as==NULLATTR) {
		LLOG (log_dsap,LLOG_EXCEPTIONS,("copy of null as"));
		return (NULLATTR);
	}
	ptr = as_comp_alloc();
	AttrT_cpy_aux(&as->attr_type,&ptr->attr_type);
	ptr->attr_value = as->attr_value;
	ptr->attr_link = NULLATTR;
	ptr->attr_acl = NULLACL_INFO;

	return (ptr);
}


static Attr_Sequence  cpy_as_comp_type (as)
Attr_Sequence  as;
{
Attr_Sequence ptr;

	if (as==NULLATTR) {
		LLOG (log_dsap,LLOG_EXCEPTIONS,("copy of null as"));
		return (NULLATTR);
	}
	ptr = as_comp_alloc();
	AttrT_cpy_aux(&as->attr_type,&ptr->attr_type);
	ptr->attr_value = NULLAV;
	ptr->attr_link = NULLATTR;
	ptr->attr_acl = NULLACL_INFO;
	return (ptr);
}



eis_check (eis,entryptr,dn)
EntryInfoSelection eis;
Entry entryptr;
DN dn;
{
register Attr_Sequence temp;
register Attr_Sequence as;
DN node;

	DLOG (log_dsap,LLOG_TRACE,("eis_check"));

	node = get_copy_dn (entryptr);

	if (eis.eis_allattributes) {
	    for(temp=entryptr->e_attributes; temp != NULLATTR; temp=temp->attr_link)
		if (temp->attr_acl != NULLACL_INFO)
			if (check_acl(NULLDN,ACL_READ,temp->attr_acl,node ) != OK )
				if (check_acl(dn,ACL_READ,temp->attr_acl,node ) == OK ) {
					dn_free (node);
					return NOTOK;
				}
	} else {
 	    (void) as_decode (EIS_SELECT);
	    for(temp=EIS_SELECT; temp != NULLATTR; temp=temp->attr_link) {
		if ((as = as_find_type (entryptr->e_attributes,&temp->attr_type)) == NULLATTR)
			continue;
		if (as->attr_acl != NULLACL_INFO)
			if (check_acl(NULLDN,ACL_READ,as->attr_acl,node ) != OK )
				if (check_acl(dn,ACL_READ,as->attr_acl,node ) == OK ) {
					dn_free (node);
					return NOTOK;
				}
	    }
	}
	dn_free (node);
	return OK;
}