|
|
1.1 ! root 1: /* ds_remove.c - */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/quipu/RCS/ds_remove.c,v 7.0 89/11/23 22:17:15 mrose Rel $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/quipu/RCS/ds_remove.c,v 7.0 89/11/23 22:17:15 mrose Rel $ ! 9: * ! 10: * ! 11: * $Log: ds_remove.c,v $ ! 12: * Revision 7.0 89/11/23 22:17:15 mrose ! 13: * Release 6.0 ! 14: * ! 15: */ ! 16: ! 17: /* ! 18: * NOTICE ! 19: * ! 20: * Acquisition, use, and distribution of this module and related ! 21: * materials are subject to the restrictions of a license agreement. ! 22: * Consult the Preface in the User's Manual for the full terms of ! 23: * this agreement. ! 24: * ! 25: */ ! 26: ! 27: ! 28: #include "quipu/util.h" ! 29: #include "quipu/entry.h" ! 30: #include "quipu/remove.h" ! 31: ! 32: extern int encode_DAS_RemoveEntryArgumentData(); ! 33: extern LLog * log_dsap; ! 34: extern int local_master_size; ! 35: ! 36: do_ds_removeentry (arg, error, binddn, target, di_p, dsp) ! 37: struct ds_removeentry_arg *arg; ! 38: struct DSError *error; ! 39: DN binddn; ! 40: DN target; ! 41: struct di_block **di_p; ! 42: char dsp; ! 43: { ! 44: Entry entryptr; ! 45: char * new_version (); ! 46: int retval; ! 47: extern int read_only; ! 48: ! 49: DLOG (log_dsap,LLOG_TRACE,("ds remove entry")); ! 50: ! 51: if (!dsp) ! 52: target = arg->rma_object; ! 53: ! 54: /* stop aliases being dereferenced */ ! 55: arg->rma_common.ca_servicecontrol.svc_options |= SVC_OPT_DONTDEREFERENCEALIAS; ! 56: ! 57: if (target == NULLDN) { ! 58: error->dse_type = DSE_NAMEERROR; ! 59: error->ERR_NAME.DSE_na_problem = DSE_NA_NOSUCHOBJECT; ! 60: error->ERR_NAME.DSE_na_matched = NULLDN; ! 61: return (DS_ERROR_REMOTE); ! 62: } ! 63: ! 64: switch(find_entry(target,&(arg->rma_common),binddn,NULLDNSEQ,TRUE,&(entryptr), error, di_p)) ! 65: { ! 66: case DS_OK: ! 67: /* Filled out entryptr - carry on */ ! 68: break; ! 69: case DS_CONTINUE: ! 70: /* Filled out di_p - what do we do with it ?? */ ! 71: return(DS_CONTINUE); ! 72: ! 73: case DS_X500_ERROR: ! 74: /* Filled out error - what do we do with it ?? */ ! 75: return(DS_X500_ERROR); ! 76: default: ! 77: /* SCREAM */ ! 78: LLOG(log_dsap, LLOG_EXCEPTIONS, ("do_ds_remove() - find_entry failed")); ! 79: return(DS_ERROR_LOCAL); ! 80: } ! 81: ! 82: /* entry found, so remove it */ ! 83: ! 84: /* Strong authentication */ ! 85: if ((retval = check_security_parms((caddr_t) arg, ! 86: encode_DAS_RemoveEntryArgumentData, ! 87: arg->rma_common.ca_security, ! 88: arg->rma_common.ca_sig, &binddn)) != 0) ! 89: { ! 90: error->dse_type = DSE_SECURITYERROR; ! 91: error->ERR_SECURITY.DSE_sc_problem = retval; ! 92: return (DS_ERROR_REMOTE); ! 93: } ! 94: ! 95: if (read_only || entryptr->e_parent->e_lock) { ! 96: error->dse_type = DSE_SERVICEERROR; ! 97: error->ERR_SERVICE.DSE_sv_problem = DSE_SV_UNAVAILABLE; ! 98: return (DS_ERROR_REMOTE); ! 99: } ! 100: ! 101: /* not prepared to accept operation over DSP */ ! 102: if (dsp) { ! 103: error->dse_type = DSE_SECURITYERROR; ! 104: error->ERR_SECURITY.DSE_sc_problem = DSE_SC_AUTHENTICATION; ! 105: return (DS_ERROR_REMOTE); ! 106: } ! 107: ! 108: if ( ! (entryptr->e_leaf)) { ! 109: error->dse_type = DSE_UPDATEERROR; ! 110: error->ERR_UPDATE.DSE_up_problem = DSE_UP_NOTONNONLEAF; ! 111: return (DS_ERROR_REMOTE); ! 112: } ! 113: ! 114: if ( ((entryptr->e_parent->e_data == E_TYPE_CONSTRUCTOR) && (check_acl (binddn,ACL_WRITE,entryptr->e_acl->ac_entry, target) == NOTOK)) ! 115: || (check_acl (binddn, ACL_WRITE, entryptr->e_parent->e_acl->ac_child, target) == NOTOK)) { ! 116: error->dse_type = DSE_SECURITYERROR; ! 117: error->ERR_SECURITY.DSE_sc_problem = DSE_SC_ACCESSRIGHTS; ! 118: return (DS_ERROR_REMOTE); ! 119: } ! 120: ! 121: ! 122: if (entryptr->e_sibling == NULLENTRY) { ! 123: /* This is a complex situation. ! 124: We have been asked to remove the last node at one level, ! 125: This means the parent has become a leaf. The parent however may be ! 126: held in another DSA - which will need updating. ! 127: Also the edbinfo attribute will need modifing. ! 128: Leave till later... ! 129: */ ! 130: if (entryptr->e_parent->e_data != E_DATA_MASTER) { ! 131: error->dse_type = DSE_UPDATEERROR; ! 132: error->ERR_UPDATE.DSE_up_problem = DSE_UP_AFFECTSMULTIPLEDSAS; ! 133: } else { ! 134: error->dse_type = DSE_SERVICEERROR; ! 135: error->ERR_SERVICE.DSE_sv_problem = DSE_SV_UNWILLINGTOPERFORM; ! 136: } ! 137: return (DS_ERROR_REMOTE); ! 138: } ! 139: ! 140: /* unlink the removed node it */ ! 141: entryptr->e_parent->e_child = entryptr->e_sibling; ! 142: if (entryptr->e_parent->e_edbversion) ! 143: free (entryptr->e_parent->e_edbversion); ! 144: entryptr->e_parent->e_edbversion = new_version(); ! 145: ! 146: if (journal (entryptr->e_sibling) != OK) ! 147: fatal (-35,"remove rewrite fail - check database"); ! 148: ! 149: entry_free (entryptr); ! 150: local_master_size--; ! 151: return (DS_OK); ! 152: ! 153: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.