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/>.
|
|
|
|
*
|
2003-12-09 01:41:40 +08:00
|
|
|
* Copyright 2001-2003 The OpenLDAP Foundation.
|
|
|
|
* 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 )
|
|
|
|
/*
|
|
|
|
Backend *be,
|
|
|
|
Connection *conn,
|
|
|
|
Operation *op,
|
|
|
|
struct berval *dn,
|
|
|
|
struct berval *ndn,
|
|
|
|
Modifications *modlist
|
|
|
|
*/
|
2001-12-11 05:49:07 +08:00
|
|
|
{
|
2003-04-01 03:45:52 +08:00
|
|
|
int rc = 0;
|
|
|
|
struct monitorinfo *mi
|
|
|
|
= (struct monitorinfo *) op->o_bd->be_private;
|
|
|
|
Entry *matched;
|
|
|
|
Entry *e;
|
2001-12-11 05:49:07 +08:00
|
|
|
|
|
|
|
#ifdef NEW_LOGGING
|
2003-04-01 03:45:52 +08:00
|
|
|
LDAP_LOG( BACK_MON, ENTRY, "monitor_back_modify: enter\n", 0, 0, 0 );
|
2001-12-11 05:49:07 +08:00
|
|
|
#else
|
|
|
|
Debug(LDAP_DEBUG_ARGS, "monitor_back_modify:\n", 0, 0, 0);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* acquire and lock entry */
|
2003-04-12 09:17:05 +08:00
|
|
|
monitor_cache_dn2entry( op, &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 ) {
|
2003-04-01 12:12:18 +08:00
|
|
|
rs->sr_matched = matched->e_name.bv_val;
|
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 );
|
|
|
|
}
|
2003-04-08 07:22:27 +08:00
|
|
|
return( 0 );
|
2001-12-11 05:49:07 +08:00
|
|
|
}
|
|
|
|
|
2003-04-01 03:45:52 +08:00
|
|
|
if ( !acl_check_modlist( op, e, op->oq_modify.rs_modlist )) {
|
2001-12-11 05:49:07 +08:00
|
|
|
rc = LDAP_INSUFFICIENT_ACCESS;
|
|
|
|
} else {
|
2003-04-12 09:17:05 +08:00
|
|
|
rc = monitor_entry_modify( op, e );
|
2001-12-11 05:49:07 +08:00
|
|
|
}
|
|
|
|
|
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 );
|
|
|
|
|
|
|
|
return( 0 );
|
|
|
|
}
|
|
|
|
|