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

⟦67e6b6a25⟧ TextFile

    Length: 3094 (0xc16)
    Types: TextFile
    Names: »ds_remove.c«

Derivation

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

TextFile

/* ds_remove.c - */

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

/*
 * $Header: /f/osi/quipu/RCS/ds_remove.c,v 6.0 89/03/18 23:41:23 mrose Rel $
 *
 *
 * $Log:	ds_remove.c,v $
 * Revision 6.0  89/03/18  23:41:23  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/remove.h"

extern LLog * log_dsap;

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


do_ds_removeentry (arg, error, binddn, target)
    struct ds_removeentry_arg      *arg;
    struct DSError              *error;
    DN                          binddn;
    DN				target;
{
Entry  entryptr;
Entry  parent;
char * new_version ();

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

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

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

	if ((entryptr = find_master_entry (target,&arg->rma_common,error,binddn)) != NULLENTRY) {
		/* entry found, so remove it  */

		if ((entryptr->e_parent != NULL) && (entryptr->e_parent->e_lock)) {
			error->dse_type = DSE_SERVICEERROR;
			error->ERR_SERVICE.DSE_sv_problem = DSE_SV_UNAVAILABLE;
			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);
		}


		/* we can assume entryptr will be the first sibling */
		if ((parent = 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);
		}

		if (check_acl (binddn, ACL_WRITE, 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...
*/
			error->dse_type = DSE_UPDATEERROR;
			error->ERR_UPDATE.DSE_up_problem = DSE_UP_AFFECTSMULTIPLEDSAS;
			return (DS_ERROR_REMOTE);
		}

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

		if (journal (entryptr->e_sibling) != OK) {
			fatal (-35,"remove rewrite fail - check database");
			return (DS_ERROR_REMOTE);
		}
		entry_free (entryptr);
		return (DS_OK);

	} else if (error->dse_type == DSE_REFERRAL)
		return (DS_ERROR_CONNECT);

	return (DS_ERROR_REMOTE);

}