openldap/servers/slapd/back-monitor/modify.c

85 lines
1.9 KiB
C
Raw Normal View History

2001-12-11 05:49:07 +08:00
/* modify.c - monitor backend modify routine */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
2004-01-02 03:15:16 +08:00
* Copyright 2001-2004 The OpenLDAP Foundation.
2003-12-09 01:41:40 +08:00
* Portions Copyright 2001-2003 Pierangelo Masarati.
* 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 */
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 ) {
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 {
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 );
}