|
|
@@ -60,6 +60,7 @@ static int usn_bepreop_delete(Slapi_PBlock *pb);
|
|
|
static int usn_bepreop_modify(Slapi_PBlock *pb);
|
|
|
static int usn_bepostop(Slapi_PBlock *pb);
|
|
|
static int usn_bepostop_delete (Slapi_PBlock *pb);
|
|
|
+static int usn_bepostop_modify (Slapi_PBlock *pb);
|
|
|
static int usn_start(Slapi_PBlock *pb);
|
|
|
static int usn_close(Slapi_PBlock *pb);
|
|
|
static int usn_get_attr(Slapi_PBlock *pb, const char* type, void *value);
|
|
|
@@ -180,7 +181,7 @@ usn_bepostop_init(Slapi_PBlock *pb)
|
|
|
slapi_pblock_set(pb, SLAPI_PLUGIN_BE_POST_DELETE_FN,
|
|
|
(void *)usn_bepostop_delete) != 0 ||
|
|
|
slapi_pblock_set(pb, SLAPI_PLUGIN_BE_POST_MODIFY_FN,
|
|
|
- (void *)usn_bepostop) != 0 ||
|
|
|
+ (void *)usn_bepostop_modify) != 0 ||
|
|
|
slapi_pblock_set(pb, SLAPI_PLUGIN_BE_POST_MODRDN_FN,
|
|
|
(void *)usn_bepostop) != 0) {
|
|
|
slapi_log_error(SLAPI_LOG_FATAL, USN_PLUGIN_SUBSYSTEM,
|
|
|
@@ -517,6 +518,53 @@ bail:
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
|
+/* count up the counter */
|
|
|
+static int
|
|
|
+usn_bepostop_modify (Slapi_PBlock *pb)
|
|
|
+{
|
|
|
+ int rc = -1;
|
|
|
+ Slapi_Backend *be = NULL;
|
|
|
+ LDAPMod **mods = NULL;
|
|
|
+ int i;
|
|
|
+
|
|
|
+ slapi_log_error(SLAPI_LOG_TRACE, USN_PLUGIN_SUBSYSTEM,
|
|
|
+ "--> usn_bepostop_mod\n");
|
|
|
+
|
|
|
+ /* if op is not successful, don't increment the counter */
|
|
|
+ slapi_pblock_get(pb, SLAPI_RESULT_CODE, &rc);
|
|
|
+ if (LDAP_SUCCESS != rc) {
|
|
|
+ goto bail;
|
|
|
+ }
|
|
|
+
|
|
|
+ slapi_pblock_get(pb, SLAPI_MODIFY_MODS, &mods);
|
|
|
+ for (i = 0; mods && mods[i]; i++) {
|
|
|
+ if (0 == strcasecmp(mods[i]->mod_type, SLAPI_ATTR_ENTRYUSN)) {
|
|
|
+ if (mods[i]->mod_op & LDAP_MOD_IGNORE) {
|
|
|
+ slapi_log_error(SLAPI_LOG_TRACE, USN_PLUGIN_SUBSYSTEM,
|
|
|
+ "usn_bepostop_mod: MOD_IGNORE detected\n");
|
|
|
+ goto bail; /* conflict occurred.
|
|
|
+ skip incrementing the counter. */
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ slapi_pblock_get(pb, SLAPI_BACKEND, &be);
|
|
|
+ if (NULL == be) {
|
|
|
+ rc = LDAP_PARAM_ERROR;
|
|
|
+ goto bail;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (be->be_usn_counter) {
|
|
|
+ slapi_counter_increment(be->be_usn_counter);
|
|
|
+ }
|
|
|
+bail:
|
|
|
+ slapi_log_error(SLAPI_LOG_TRACE, USN_PLUGIN_SUBSYSTEM,
|
|
|
+ "<-- usn_bepostop_mod\n");
|
|
|
+ return rc;
|
|
|
+}
|
|
|
+
|
|
|
/* count up the counter */
|
|
|
/* if the op is delete and the op was not successful, remove preventryusn */
|
|
|
static int
|