Re: [devel] [PATCH 1/1] ntf: Don't use old style SaNameT with 255 chars DN in ntfimcnd [#2850]

2018-05-15 Thread Minh Hon Chau

Hi Hoa,

Ack

Thanks

Minh


On 14/05/18 19:17, Hoa Le wrote:

osafntfimcnd uses old style SaNameT when sending notification. The
SaNameT's length will be adjusted to 256 when it's value contains
255 characters excluded the NULL character. This SaNameT is now
not a valid extended name and causes osafntfimcnd to exit.

This patch helps avoid the above issue by using the new style of
SaNameT if the SaNameT' value is a 255 chars DN.
---
  src/ntf/common/ntfsv_mem.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/ntf/common/ntfsv_mem.c b/src/ntf/common/ntfsv_mem.c
index d570d64..64228de 100644
--- a/src/ntf/common/ntfsv_mem.c
+++ b/src/ntf/common/ntfsv_mem.c
@@ -1448,7 +1448,8 @@ void ntfs_sanamet_alloc(SaConstStringT value, size_t 
length, SaNameT *pName)
/* Accept the old SaNameT which's @.length counting the null termination
 */
if (!osaf_is_an_extended_name(pName) &&
-   ((ntfs_sanamet_length(pName) + 1) == length)) {
+   (length < SA_MAX_UNEXTENDED_NAME_LENGTH) &&
+   ((ntfs_sanamet_length(pName) + 1) == length)) {
*((SaUint16T *)pName) += 1;
}
  }
@@ -1466,7 +1467,8 @@ void ntfs_sanamet_steal(SaStringT value, size_t length, 
SaNameT *pName)
/* Accept the old SaNameT which's @.length counting the null termination
 */
if (!osaf_is_an_extended_name(pName) &&
-   ((ntfs_sanamet_length(pName) + 1) == length)) {
+   (length < SA_MAX_UNEXTENDED_NAME_LENGTH) &&
+   ((ntfs_sanamet_length(pName) + 1) == length)) {
*((SaUint16T *)pName) += 1;
}
  }



--
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
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] ntf: Don't use old style SaNameT with 255 chars DN in ntfimcnd [#2850]

2018-05-15 Thread Lennart Lund
Ack

Thanks
Lennart

> -Original Message-
> From: Hoa Le [mailto:hoa...@dektech.com.au]
> Sent: den 14 maj 2018 11:17
> To: Minh Hon Chau ; Lennart Lund
> ; srinivas.mangip...@oracle.com
> Cc: opensaf-devel@lists.sourceforge.net; Hoa Le 
> Subject: [PATCH 1/1] ntf: Don't use old style SaNameT with 255 chars DN in
> ntfimcnd [#2850]
> 
> osafntfimcnd uses old style SaNameT when sending notification. The
> SaNameT's length will be adjusted to 256 when it's value contains
> 255 characters excluded the NULL character. This SaNameT is now
> not a valid extended name and causes osafntfimcnd to exit.
> 
> This patch helps avoid the above issue by using the new style of
> SaNameT if the SaNameT' value is a 255 chars DN.
> ---
>  src/ntf/common/ntfsv_mem.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/ntf/common/ntfsv_mem.c b/src/ntf/common/ntfsv_mem.c
> index d570d64..64228de 100644
> --- a/src/ntf/common/ntfsv_mem.c
> +++ b/src/ntf/common/ntfsv_mem.c
> @@ -1448,7 +1448,8 @@ void ntfs_sanamet_alloc(SaConstStringT value,
> size_t length, SaNameT *pName)
>   /* Accept the old SaNameT which's @.length counting the null
> termination
>*/
>   if (!osaf_is_an_extended_name(pName) &&
> - ((ntfs_sanamet_length(pName) + 1) == length)) {
> + (length < SA_MAX_UNEXTENDED_NAME_LENGTH)
> &&
> + ((ntfs_sanamet_length(pName) + 1) == length)) {
>   *((SaUint16T *)pName) += 1;
>   }
>  }
> @@ -1466,7 +1467,8 @@ void ntfs_sanamet_steal(SaStringT value, size_t
> length, SaNameT *pName)
>   /* Accept the old SaNameT which's @.length counting the null
> termination
>*/
>   if (!osaf_is_an_extended_name(pName) &&
> - ((ntfs_sanamet_length(pName) + 1) == length)) {
> + (length < SA_MAX_UNEXTENDED_NAME_LENGTH)
> &&
> + ((ntfs_sanamet_length(pName) + 1) == length)) {
>   *((SaUint16T *)pName) += 1;
>   }
>  }
> --
> 2.7.4


--
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
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel