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

⟦0dd469d1f⟧ TextFile

    Length: 4310 (0x10d6)
    Types: TextFile
    Names: »ds_remove.c«

Derivation

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

TextFile

/* ds_remove.c - */

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

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

extern int encode_DAS_RemoveEntryArgumentData();
extern LLog * log_dsap;
extern int local_master_size;

do_ds_removeentry (arg, error, binddn, target, di_p, dsp)
    struct ds_removeentry_arg      *arg;
    struct DSError              *error;
    DN                          binddn;
    DN				target;
    struct di_block		**di_p;
    char 			dsp;
{
Entry  entryptr;
char * new_version ();
int retval;
extern int read_only;

	DLOG (log_dsap,LLOG_TRACE,("ds remove entry"));

	if (!dsp)
		target = arg->rma_object;

	(void) dn_decode (target);

	/* stop aliases being dereferenced */
	arg->rma_common.ca_servicecontrol.svc_options |= SVC_OPT_DONTDEREFERENCEALIAS;

	if (target == NULLDN) {
		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);
	}

	switch(find_entry(target,&(arg->rma_common),binddn,NULLDNSEQ,TRUE,&(entryptr), error, di_p))
	{
	case DS_OK:
	    /* Filled out entryptr - carry on */
	    break;
	case DS_CONTINUE:
	    /* Filled out di_p - what do we do with it ?? */
	    return(DS_CONTINUE);

	case DS_X500_ERROR:
	    /* Filled out error - what do we do with it ?? */
	    return(DS_X500_ERROR);
	default:
	    /* SCREAM */
	    LLOG(log_dsap, LLOG_EXCEPTIONS, ("do_ds_remove() - find_entry failed"));
	    return(DS_ERROR_LOCAL);
	}

	/* entry found, so remove it  */

	/* Strong authentication  */
	if ((retval = check_security_parms((caddr_t) arg,
			encode_DAS_RemoveEntryArgumentData,
			arg->rma_common.ca_security,
			arg->rma_common.ca_sig, &binddn)) != 0)
	{
		error->dse_type = DSE_SECURITYERROR;
		error->ERR_SECURITY.DSE_sc_problem = retval;
		return (DS_ERROR_REMOTE);
	}

	if (read_only || entryptr->e_parent->e_lock) {
		error->dse_type = DSE_SERVICEERROR;
		error->ERR_SERVICE.DSE_sv_problem = DSE_SV_UNAVAILABLE;
		return (DS_ERROR_REMOTE);
	}

	/* not prepared to accept operation over DSP */
	if (dsp) {
		error->dse_type = DSE_SECURITYERROR;
		error->ERR_SECURITY.DSE_sc_problem = DSE_SC_AUTHENTICATION;
		return (DS_ERROR_REMOTE);
	}

	if ( ! (entryptr->e_leaf)) {
		error->dse_type = DSE_UPDATEERROR;
		error->ERR_UPDATE.DSE_up_problem = DSE_UP_NOTONNONLEAF;
		return (DS_ERROR_REMOTE);
	}

	if ( ((entryptr->e_parent->e_data == E_TYPE_CONSTRUCTOR) && (check_acl (binddn,ACL_WRITE,entryptr->e_acl->ac_entry, target) == NOTOK))
	     || (check_acl (binddn, ACL_WRITE, entryptr->e_parent->e_acl->ac_child, target) == NOTOK)) {
		error->dse_type = DSE_SECURITYERROR;
		error->ERR_SECURITY.DSE_sc_problem = DSE_SC_ACCESSRIGHTS;
		return (DS_ERROR_REMOTE);
	}


	if (entryptr->e_sibling == NULLENTRY) {
/* This is a complex situation.
   We have been asked to remove the last node at one level,
   This means the parent has become a leaf.  The parent however may be
   held in another DSA - which will need updating.
   Also the edbinfo attribute will need modifing.
   Leave till later...
*/
		if (entryptr->e_parent->e_data != E_DATA_MASTER) {
			error->dse_type = DSE_UPDATEERROR;
			error->ERR_UPDATE.DSE_up_problem = DSE_UP_AFFECTSMULTIPLEDSAS;
		} else {
			error->dse_type = DSE_SERVICEERROR;
			error->ERR_SERVICE.DSE_sv_problem = DSE_SV_UNWILLINGTOPERFORM;
		}
		return (DS_ERROR_REMOTE);
	}

	/* unlink the removed node it */
	entryptr->e_parent->e_child = entryptr->e_sibling;
	if (entryptr->e_parent->e_edbversion)
		free (entryptr->e_parent->e_edbversion);
	entryptr->e_parent->e_edbversion = new_version();

	if (journal (entryptr->e_sibling) != OK) 
		fatal (-35,"remove rewrite fail - check database");

	entry_free (entryptr);
	local_master_size--;
	return (DS_OK);

}