Hi Vu,
Ack and tested.
Best regards,
Giang
On 29/09/2015 09:24, Vu Minh Nguyen wrote:
> osaf/services/saf/logsv/lgs/lgs_imm.c | 8 +++++++
> tests/logsv/tet_LogOiOps.c | 39
> +++++++++++++++++++++++++++++++++++
> 2 files changed, 47 insertions(+), 0 deletions(-)
>
>
> logsv did not check if the operation is perfomed on configuration class
> or runtime one. Therefore, once the input valid, logsv did update
> the attribute and though that was runtime one. So, it caused the trouble.
>
> Add the check will fix this issue.
>
> diff --git a/osaf/services/saf/logsv/lgs/lgs_imm.c
> b/osaf/services/saf/logsv/lgs/lgs_imm.c
> --- a/osaf/services/saf/logsv/lgs/lgs_imm.c
> +++ b/osaf/services/saf/logsv/lgs/lgs_imm.c
> @@ -384,6 +384,14 @@ static void adminOperationCallback(SaImm
>
> if (opId == SA_LOG_ADMIN_CHANGE_FILTER) {
> /* Only allowed to update runtime objects (application streams)
> */
> + SaImmClassNameT className = immutil_get_className(objectName);
> +
> + if (!strcmp(className, "SaLogStreamConfig")) {
> + (void)immutil_saImmOiAdminOperationResult(immOiHandle,
> + invocation,
> SA_AIS_ERR_NOT_SUPPORTED);
> + goto done;
> + }
> +
> if (stream->streamType != STREAM_TYPE_APPLICATION) {
> report_om_error(immOiHandle, invocation,
> "Admin op change filter for non app
> stream");
> diff --git a/tests/logsv/tet_LogOiOps.c b/tests/logsv/tet_LogOiOps.c
> --- a/tests/logsv/tet_LogOiOps.c
> +++ b/tests/logsv/tet_LogOiOps.c
> @@ -3263,6 +3263,44 @@ void verCCBWithInvalidValues(void)
> }
> }
>
> +/**
> + * Add test case for ticket #1420
> + * logsv crashed if performing admin op on configurable obj class.
> + * Test steps:
> + * 1. Create an configurable obj class for app stream.
> + * 2. Perform admin op - changing saLogStreamSeverityFilter with valid value.
> + * 3. Verify that it fails to perform that op.
> + * 4. Delete previous created class.
> + */
> +void verAdminOpOnConfClass(void)
> +{
> + int rc;
> + char command[256];
> +
> + /* Create an configurable obj class */
> + strcpy(command, "immcfg -c SaLogStreamConfig
> safLgStrCfg=adminOp,safApp=safLogService "
> + "-a saLogStreamFileName=adminOp -a saLogStreamPathName=. -a
> saLogStreamMaxFilesRotated=4 "
> + "2> /dev/null");
> + rc = system(command);
> +
> + if (WEXITSTATUS(rc) == 1) {
> + /* Failed to perfom command. Report test failed and return. */
> + fprintf(stderr, "Failed to perform command = %s \n", command);
> + rc_validate(WEXITSTATUS(rc), 0);
> + return;
> + }
> +
> + /* Perfom admin operation on the configurable obj class */
> + strcpy(command, "immadm -o 1 -p
> saLogStreamSeverityFilter:SA_UINT32_T:100 "
> + "safLgStrCfg=adminOp,safApp=safLogService 2> /dev/null");
> + rc = system(command);
> + rc_validate(WEXITSTATUS(rc), 1);
> +
> + /* Delete the created class */
> + strcpy(command, "immcfg -d safLgStrCfg=adminOp,safApp=safLogService");
> + rc = system(command);
> +}
> +
> __attribute__ ((constructor)) static void saOiOperations_constructor(void)
> {
> /* Stream objects */
> @@ -3383,6 +3421,7 @@ void verCCBWithInvalidValues(void)
> test_case_add(6, saLogOi_77, "Create: saLogStreamMaxFilesRotated > 128,
> ERR");
> test_case_add(6, saLogOi_78, "Create: saLogStreamMaxFilesRotated ==
> 128, ERR");
> test_case_add(6, verMaxFilesRotated, "Create:
> saLogStreamMaxFilesRotated = 0, ERR");
> + test_case_add(6, verAdminOpOnConfClass, "Perform admin op on
> configurable obj class, ERR");
>
> /* Tests for modify */
> test_case_add(6, saLogOi_100, "Modify: saLogStreamSeverityFilter <
> 0x7f, Ok");
>
------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel