Hi Canh,

Ack with comments:

- The patch #2006 introduced another check against 
MAX_ADDITIONAL_TEXT_LENGTH, it's equal to SA_LOG_MAX_RECORD_SIZE too 
(65535). So we need to add the same check of #2006 for #2300 so that NTF 
server copes with possibly invalid input.
- We encounter the upgrade problem because NTF Agent in Opensaf 5.0 does 
not have patch of #2006, so when we move on and Opensaf 5.0 is no longer 
maintained, then this workaround should be removed from NTF server side. 
The reason is this kind of check (or auto-adjustment) should be done in 
NTF Agent only, not in NTF Server side. So I think we should add comment 
besides this workaround as a reminder.

Thanks,
Minh

On 14/02/17 17:20, Canh Van Truong wrote:
>   src/ntf/ntfd/NtfLogger.cc |  9 +++++++++
>   1 files changed, 9 insertions(+), 0 deletions(-)
>
>
> During cluster upgrade from an old OpenSAF version which have not included the
> fix #2006 to one that have the fix in, if there is an code fault related to
> inconsistent in additionalText and lengthAdditionalText in NTF application, 
> could lead to upgadate failed.
>
> This patch fix to add an workwround in NTFs, adjust lengthAdditionalText to 
> correct one if NTFs find the mismatch
>
> Note: The patch applies on branch 5.0 has little differences. There are some 
> changes in test cases
> ntftest 30 3... to change the length of additionalText+1  and 
> lengthAdditionalText are the same.
>
> diff --git a/src/ntf/ntfd/NtfLogger.cc b/src/ntf/ntfd/NtfLogger.cc
> --- a/src/ntf/ntfd/NtfLogger.cc
> +++ b/src/ntf/ntfd/NtfLogger.cc
> @@ -197,6 +197,15 @@ SaAisErrorT NtfLogger::logNotification(N
>   
>     sendNotInfo = notif->getNotInfo();
>     ntfsv_get_ntf_header(sendNotInfo, &ntfHeader);
> +
> +  // Workaround to fix with failed upgrade
> +  // Auto correction if there is inconsistent b/w lengthAdditionalText and 
> additionalText
> +  if (ntfHeader->additionalText != NULL &&
> +      ntfHeader->lengthAdditionalText > strlen(ntfHeader->additionalText) + 
> 1) {
> +    LOG_WA("Mismatch b/w lengthAdditionalText and additionalText. 
> Re-Adjust!");
> +    ntfHeader->lengthAdditionalText = strlen(ntfHeader->additionalText) + 1;
> +  }
> +
>     logBuffer.logBufSize = ntfHeader->lengthAdditionalText;
>     logBuffer.logBuf = (SaUint8T*)&addTextBuf[0];
>   
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to