2001-12-11 05:49:07 +08:00
|
|
|
/* modify.c - monitor backend modify routine */
|
2003-11-27 10:35:20 +08:00
|
|
|
/* $OpenLDAP$ */
|
|
|
|
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
|
*
|
2009-01-22 08:40:04 +08:00
|
|
|
* Copyright 2001-2009 The OpenLDAP Foundation.
|
2003-12-09 01:41:40 +08:00
|
|
|
* Portions Copyright 2001-2003 Pierangelo Masarati.
|
2003-11-27 10:35:20 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted only as authorized by the OpenLDAP
|
|
|
|
* Public License.
|
|
|
|
*
|
|
|
|
* A copy of this license is available in file LICENSE in the
|
|
|
|
* top-level directory of the distribution or, alternatively, at
|
|
|
|
* <http://www.OpenLDAP.org/license.html>.
|
|
|
|
*/
|
|
|
|
/* ACKNOWLEDGEMENTS:
|
|
|
|
* This work was initially developed by Pierangelo Masarati for inclusion
|
|
|
|
* in OpenLDAP Software.
|
|
|
|
*/
|
2001-12-11 05:49:07 +08:00
|
|
|
|
|
|
|
#include "portable.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <ac/string.h>
|
|
|
|
#include <ac/socket.h>
|
|
|
|
|
|
|
|
#include "slap.h"
|
|
|
|
#include "back-monitor.h"
|
|
|
|
#include "proto-back-monitor.h"
|
|
|
|
|
|
|
|
int
|
2003-04-01 03:45:52 +08:00
|
|
|
monitor_back_modify( Operation *op, SlapReply *rs )
|
2001-12-11 05:49:07 +08:00
|
|
|
{
|
2004-11-09 02:52:27 +08:00
|
|
|
int rc = 0;
|
|
|
|
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
|
|
|
|
Entry *matched;
|
|
|
|
Entry *e;
|
2001-12-11 05:49:07 +08:00
|
|
|
|
|
|
|
Debug(LDAP_DEBUG_ARGS, "monitor_back_modify:\n", 0, 0, 0);
|
|
|
|
|
|
|
|
/* acquire and lock entry */
|
2005-04-28 05:30:35 +08:00
|
|
|
monitor_cache_dn2entry( op, rs, &op->o_req_ndn, &e, &matched );
|
2001-12-11 05:49:07 +08:00
|
|
|
if ( e == NULL ) {
|
2003-04-01 03:45:52 +08:00
|
|
|
rs->sr_err = LDAP_NO_SUCH_OBJECT;
|
|
|
|
if ( matched ) {
|
2005-04-09 07:33:03 +08:00
|
|
|
if ( !access_allowed_mask( op, matched,
|
|
|
|
slap_schema.si_ad_entry,
|
|
|
|
NULL, ACL_DISCLOSE, NULL, NULL ) )
|
|
|
|
{
|
|
|
|
/* do nothing */ ;
|
2006-04-12 13:53:26 +08:00
|
|
|
} else {
|
2005-04-09 07:33:03 +08:00
|
|
|
rs->sr_matched = matched->e_dn;
|
|
|
|
}
|
2003-04-01 03:45:52 +08:00
|
|
|
}
|
|
|
|
send_ldap_result( op, rs );
|
2001-12-11 05:49:07 +08:00
|
|
|
if ( matched != NULL ) {
|
2003-04-01 03:45:52 +08:00
|
|
|
rs->sr_matched = NULL;
|
2001-12-11 05:49:07 +08:00
|
|
|
monitor_cache_release( mi, matched );
|
|
|
|
}
|
2005-04-09 07:33:03 +08:00
|
|
|
return rs->sr_err;
|
2001-12-11 05:49:07 +08:00
|
|
|
}
|
|
|
|
|
2007-08-16 17:48:53 +08:00
|
|
|
if ( !acl_check_modlist( op, e, op->orm_modlist )) {
|
2001-12-11 05:49:07 +08:00
|
|
|
rc = LDAP_INSUFFICIENT_ACCESS;
|
2005-04-27 10:43:38 +08:00
|
|
|
|
2001-12-11 05:49:07 +08:00
|
|
|
} else {
|
2005-10-14 18:02:50 +08:00
|
|
|
assert( !SLAP_SHADOW( op->o_bd ) );
|
2005-11-18 08:00:39 +08:00
|
|
|
slap_mods_opattrs( op, &op->orm_modlist, 0 );
|
2005-10-14 18:02:50 +08:00
|
|
|
|
2005-04-28 05:30:35 +08:00
|
|
|
rc = monitor_entry_modify( op, rs, e );
|
2001-12-11 05:49:07 +08:00
|
|
|
}
|
|
|
|
|
2005-04-09 07:33:03 +08:00
|
|
|
if ( rc != LDAP_SUCCESS ) {
|
|
|
|
if ( !access_allowed_mask( op, e, slap_schema.si_ad_entry,
|
|
|
|
NULL, ACL_DISCLOSE, NULL, NULL ) )
|
|
|
|
{
|
|
|
|
rc = LDAP_NO_SUCH_OBJECT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-01 03:45:52 +08:00
|
|
|
rs->sr_err = rc;
|
|
|
|
send_ldap_result( op, rs );
|
2001-12-11 05:49:07 +08:00
|
|
|
|
|
|
|
monitor_cache_release( mi, e );
|
|
|
|
|
2005-04-09 07:33:03 +08:00
|
|
|
return rs->sr_err;
|
2001-12-11 05:49:07 +08:00
|
|
|
}
|
|
|
|
|