Browse Source

Ticket #129 - Should only update modifyTimestamp/modifiersName on MODIFY ops

Bug Description:  Some internal updates should not rewrite the modifersname and timestamp

Fix Description:  Since the orginal bug was filed, we created a new pblock flag
                  to "skip modifier attrs" updates.  But we did not have the option
                  of setting this flag from a plugin.

                  So, while this has already been fixed in regards to password
                  policy.  I added a set pblock function, which allows plugins
                  to set this flag.  I also used it in the acctpolicy plugin.
Mark Reynolds 14 years ago
parent
commit
3e60f7fc43
2 changed files with 10 additions and 1 deletions
  1. 1 0
      ldap/servers/plugins/acctpolicy/acct_plugin.c
  2. 9 1
      ldap/servers/slapd/pblock.c

+ 1 - 0
ldap/servers/plugins/acctpolicy/acct_plugin.c

@@ -126,6 +126,7 @@ acct_record_login( const char *dn, void *txn )
 	 	plugin_id, SLAPI_OP_FLAG_NO_ACCESS_CHECK |
 			SLAPI_OP_FLAG_BYPASS_REFERRALS );
 	slapi_pblock_set( modpb, SLAPI_TXN, txn );
+	slapi_pblock_set( modpb, SLAPI_SKIP_MODIFIED_ATTRS, 1);
 	slapi_modify_internal_pb( modpb );
 
 	slapi_pblock_get( modpb, SLAPI_PLUGIN_INTOP_RESULT, &ldrc );

+ 9 - 1
ldap/servers/slapd/pblock.c

@@ -2823,7 +2823,15 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
 			pblock->pb_operation_notes |= *((unsigned int *)value );
 		}
 		break;
-
+	case SLAPI_SKIP_MODIFIED_ATTRS:
+		if(pblock->pb_op == NULL)
+			break;
+		if(value == 0){
+			pblock->pb_op->o_flags &= ~OP_FLAG_SKIP_MODIFIED_ATTRS;
+		} else {
+			pblock->pb_op->o_flags |= OP_FLAG_SKIP_MODIFIED_ATTRS;
+		}
+		break;
 	/* controls we know about */
 	case SLAPI_MANAGEDSAIT:
 		pblock->pb_managedsait = *((int *) value);