Browse Source

Ticket 47817 - The error result text message should be obtained just prior to sending result

Bug Description:  We do not get pblock result message after the betxn postop plugins
                  are called.  If a betxn plugin modified the ldap result message, then
                  when the backend returns the results it does an invalid read on the
                  old pointer of the old result message.

Fix Description:  Get the result message after we call the betxn postop plugins.

https://fedorahosted.org/389/ticket/47817

jenkins: passed

Reviewed by: nhosoi(Thanks!)
Mark Reynolds 11 years ago
parent
commit
68e766891d

+ 4 - 2
ldap/servers/slapd/back-ldbm/ldbm_add.c

@@ -94,8 +94,8 @@ ldbm_back_add( Slapi_PBlock *pb )
 	char *msg;
 	int	managedsait;
 	int	ldap_result_code = LDAP_SUCCESS;
-	char *ldap_result_message= NULL;
-	char *ldap_result_matcheddn= NULL;
+	char *ldap_result_message = NULL;
+	char *ldap_result_matcheddn = NULL;
 	int	retry_count = 0;
 	int	disk_full = 0;
 	modify_context parent_modify_c = {0};
@@ -1227,6 +1227,8 @@ diskfull_return:
 					/* tell frontend not to free this entry */
 					slapi_pblock_set(pb, SLAPI_ADD_ENTRY, NULL);
 				}
+
+				slapi_pblock_get(pb, SLAPI_PB_RESULT_TEXT, &ldap_result_message);
 			}
 
 			/* Release SERIAL LOCK */

+ 2 - 1
ldap/servers/slapd/back-ldbm/ldbm_delete.c

@@ -75,7 +75,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
 	modify_context ruv_c = {0};
 	int rc = 0;
 	int ldap_result_code= LDAP_SUCCESS;
-	char *ldap_result_message= NULL;
+	char *ldap_result_message = NULL;
 	Slapi_DN *sdnp = NULL;
 	char *e_uniqueid = NULL;
 	Slapi_DN nscpEntrySDN;
@@ -1331,6 +1331,7 @@ error_return:
 			if (!opreturn) {
 				slapi_pblock_set( pb, SLAPI_PLUGIN_OPRETURN, ldap_result_code ? &ldap_result_code : &retval );
 			}
+			slapi_pblock_get(pb, SLAPI_PB_RESULT_TEXT, &ldap_result_message);
 		}
 
 		/* Release SERIAL LOCK */

+ 1 - 0
ldap/servers/slapd/back-ldbm/ldbm_modify.c

@@ -901,6 +901,7 @@ error_return:
 				LDAPDebug1Arg( LDAP_DEBUG_TRACE, "SLAPI_PLUGIN_BE_TXN_POST_MODIFY_FN plugin "
 							   "returned error code %d\n", retval );
 				slapi_pblock_get(pb, SLAPI_RESULT_CODE, &ldap_result_code);
+				slapi_pblock_get(pb, SLAPI_PB_RESULT_TEXT, &ldap_result_message);
 				slapi_pblock_get(pb, SLAPI_PLUGIN_OPRETURN, &opreturn);
 				if (!opreturn) {
 					slapi_pblock_set(pb, SLAPI_PLUGIN_OPRETURN, ldap_result_code ? &ldap_result_code : &retval);

+ 1 - 0
ldap/servers/slapd/back-ldbm/ldbm_modrdn.c

@@ -1430,6 +1430,7 @@ error_return:
                 if (!opreturn) {
                     slapi_pblock_set( pb, SLAPI_PLUGIN_OPRETURN, ldap_result_code ? &ldap_result_code : &retval );
                 }
+                slapi_pblock_get(pb, SLAPI_PB_RESULT_TEXT, &ldap_result_message);
             }
 
             /* Release SERIAL LOCK */