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

⟦b94d2c542⟧ TextFile

    Length: 4177 (0x1051)
    Types: TextFile
    Names: »ds_compare.c«

Derivation

└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
    └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« 
        └─⟦d3ac74d73⟧ 
            └─⟦this⟧ »isode-5.0/quipu/ds_compare.c« 

TextFile

/* ds_compare.c - */

#ifndef lint
static char *rcsid = "$Header: /f/osi/quipu/RCS/ds_compare.c,v 6.0 89/03/18 23:41:16 mrose Rel $";
#endif

/*
 * $Header: /f/osi/quipu/RCS/ds_compare.c,v 6.0 89/03/18 23:41:16 mrose Rel $
 *
 *
 * $Log:	ds_compare.c,v $
 * Revision 6.0  89/03/18  23:41:16  mrose
 * Release 5.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/entry.h"
#include "quipu/compare.h"

extern LLog * log_dsap;

#ifndef NO_STATS
extern LLog * log_stat;
extern int dn_print ();
#endif


do_ds_compare (arg, error, result, binddn, target)
    struct ds_compare_arg       *arg;
    struct ds_compare_result    *result;
    struct DSError              *error;
    DN                          binddn;
    DN                          target;
{
register Entry  entryptr;
register Attr_Sequence  as;
struct acl_info  * acl;
register int i;

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

	if (target == NULLDN)
		target = arg->cma_object;

#ifndef NO_STATS
	dn_decode (target);
	pslog (log_stat,LLOG_NOTICE,"compare",dn_print,(caddr_t)target);
#endif

	if ((entryptr = find_entry (target,&arg->cma_common,error,binddn)) != NULLENTRY) {
		if (entryptr->e_parent == NULLENTRY) {
			error->dse_type = DSE_NAMEERROR;
			error->ERR_NAME.DSE_na_problem = DSE_NA_NOSUCHOBJECT;
			error->ERR_NAME.DSE_na_matched = NULLDN;
			return (DS_ERROR_REMOTE);
		}
		ava_decode (&arg->cma_purported);
		if (arg->cma_purported.ava_type->at_table == NULLTABLE_ATTR)
			return (invalid_matching (arg->cma_purported.ava_type,error));
		switch (arg->cma_purported.ava_type->at_table->oa_syntax) {
			case AV_ACL:
			case AV_SCHEMA:
			case AV_UPDATE:
				return (invalid_matching (arg->cma_purported.ava_type,error));
		}

		if ((as = as_find_type (entryptr->e_attributes, arg->cma_purported.ava_type)) == NULLATTR) {
			error->dse_type = DSE_ATTRIBUTEERROR;
			error->ERR_ATTRIBUTE.DSE_at_name = get_copy_dn(entryptr);
			error->ERR_ATTRIBUTE.DSE_at_plist.DSE_at_what = DSE_AT_NOSUCHATTRIBUTE;
			error->ERR_ATTRIBUTE.DSE_at_plist.DSE_at_type = AttrT_cpy(arg->cma_purported.ava_type);
			error->ERR_ATTRIBUTE.DSE_at_plist.DSE_at_value = NULLAttrV;
			error->ERR_ATTRIBUTE.DSE_at_plist.dse_at_next = DSE_AT_NOPROBLEM;
			return (DS_ERROR_REMOTE);
		}

		acl =  as->attr_acl;

		if (check_acl (binddn,ACL_COMPARE, acl,target) == NOTOK) {
			error->dse_type = DSE_SECURITYERROR;
			error->ERR_SECURITY.DSE_sc_problem = DSE_SC_ACCESSRIGHTS;
			return (DS_ERROR_REMOTE);
		}

		result->cmr_iscopy = FALSE;
		result->cmr_common.cr_requestor = NULLDN;

		/* if no error and NOT SVC_OPT_DONTDEREFERENCEALIASES then */
		/* the alias will have been derefeferenced -signified by   */
		/* NO_ERROR !!! */
		if (error->dse_type == DSE_NOERROR) {
			result->cmr_common.cr_aliasdereferenced =  FALSE;
			result->cmr_object = NULLDN;
		} else {
			result->cmr_common.cr_aliasdereferenced =  TRUE;
			result->cmr_object = get_copy_dn (entryptr);
		}
		i = AttrV_cmp (as->attr_value->avseq_av, arg->cma_purported.ava_value,error);
		switch (i) {
		    case 0 :
			result->cmr_matched= TRUE;
			return (DS_OK);
		    case 1:
		    case -1:
			result->cmr_matched= FALSE;
			return (DS_OK);
		    default:
			error->ERR_ATTRIBUTE.DSE_at_name = get_copy_dn (entryptr);
			error->ERR_ATTRIBUTE.DSE_at_plist.DSE_at_type = AttrT_cpy(as->attr_type);
			return (NOTOK);
		}
	} else if (error->dse_type == DSE_REFERRAL)
		return (DS_ERROR_CONNECT);

	return (DS_ERROR_REMOTE);
}

invalid_matching (at,error)
AttributeType at;
struct DSError *error;
{
	error->dse_type = DSE_ATTRIBUTEERROR;
	error->ERR_ATTRIBUTE.DSE_at_name = NULLDN;
	error->ERR_ATTRIBUTE.DSE_at_plist.DSE_at_what = DSE_AT_INAPPROPRIATEMATCHING;
	error->ERR_ATTRIBUTE.DSE_at_plist.DSE_at_type = AttrT_cpy (at);
	error->ERR_ATTRIBUTE.DSE_at_plist.DSE_at_value = NULLAttrV;
	error->ERR_ATTRIBUTE.DSE_at_plist.dse_at_next = DSE_AT_NOPROBLEM;
	return (DS_ERROR_REMOTE);
}