obuspa: Fix probable crash and bulk event handling

This commit is contained in:
Vivek Kumar Dutta 2024-02-06 12:40:06 +05:30
parent 9eee63b031
commit 6dbfa5897c
2 changed files with 38 additions and 20 deletions

View file

@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=obuspa
PKG_VERSION:=7.0.5.11
PKG_VERSION:=7.0.5.12
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
PKG_SOURCE_VERSION:=5200ce0b3b4b3390e241d62a9e0a0999c3861282
PKG_SOURCE_VERSION:=a8fadc3b497fe8c97f6a93d5dbf5cd4a41caca73
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
@ -87,8 +87,8 @@ endif
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
$(CP) -rf ~/git/obuspa/* $(PKG_BUILD_DIR)/
$(Build/Patch)
$(CP) -rf ~/git/obuspa/* $(PKG_BUILD_DIR)/
$(Build/Patch)
endef
endif

View file

@ -1,8 +1,6 @@
diff --git a/src/core/cli_server.c b/src/core/cli_server.c
index 1e33727..108caa2 100644
--- a/src/core/cli_server.c
+++ b/src/core/cli_server.c
@@ -784,6 +784,7 @@ int ExecuteCli_Set(char *arg1, char *arg2, char *usage)
@@ -780,6 +780,7 @@ int ExecuteCli_Set(char *arg1, char *arg
goto exit;
}
@ -10,7 +8,7 @@ index 1e33727..108caa2 100644
// Exit if unable to start a transaction
err = DM_TRANS_Start(&trans);
if (err != USP_ERR_OK)
@@ -869,6 +870,7 @@ int ExecuteCli_Add(char *arg1, char *arg2, char *usage)
@@ -865,6 +866,7 @@ int ExecuteCli_Add(char *arg1, char *arg
goto exit;
}
@ -18,7 +16,7 @@ index 1e33727..108caa2 100644
// Exit if unable to start a transaction
err = DM_TRANS_Start(&trans);
if (err != USP_ERR_OK)
@@ -980,6 +982,7 @@ int ExecuteCli_Del(char *arg1, char *arg2, char *usage)
@@ -976,6 +978,7 @@ int ExecuteCli_Del(char *arg1, char *arg
goto exit;
}
@ -26,26 +24,44 @@ index 1e33727..108caa2 100644
// Exit if unable to start a transaction
err = DM_TRANS_Start(&trans);
if (err != USP_ERR_OK)
diff --git a/src/core/data_model.h b/src/core/data_model.h
index efe4bde..4201f81 100755
--- a/src/core/data_model.h
+++ b/src/core/data_model.h
@@ -325,6 +325,7 @@ void DATA_MODEL_DumpSchema(void);
@@ -325,6 +325,8 @@ void DATA_MODEL_DumpSchema(void);
void DATA_MODEL_DumpInstances(void);
char DATA_MODEL_GetJSONParameterType(char *path);
int DATA_MODEL_SetParameterInDatabase(char *path, char *value);
+void SetControllerRoleForInternal();
+void SetControllerDummyID();
int DM_PRIV_InitSetRequest(dm_req_t *req, dm_node_t *node, char *path, dm_instances_t *inst, char *new_value);
void DM_PRIV_RequestInit(dm_req_t *req, dm_node_t *node, char *path, dm_instances_t *inst);
diff --git a/src/core/msg_handler.c b/src/core/msg_handler.c
index 8313342..b5e6d59 100644
--- a/src/core/dm_exec.c
+++ b/src/core/dm_exec.c
@@ -1207,6 +1207,7 @@ void ProcessMessageQueueSocketActivity(s
return;
}
+ SetControllerDummyID(); // To make sure session handler does not break with internal services
switch(msg.type)
{
case kDmExecMsg_ProcessUspRecord:
--- a/src/core/msg_handler.c
+++ b/src/core/msg_handler.c
@@ -891,6 +891,21 @@ char *MtpSendItemToString(mtp_send_item_t *msi)
return TEXT_UTILS_EnumToString(msi->content_type, mtp_content_types, NUM_ELEM(mtp_content_types));
}
@@ -902,6 +902,34 @@ char *MtpSendItemToString(mtp_send_item_
/*********************************************************************//**
**
+** SetControllerDummyID
+**
+** Sets the role for internal user
+**
+**
+**************************************************************************/
+void SetControllerDummyID()
+{
+ cur_msg_controller_info.endpoint_id = "";
+}
+
+/*********************************************************************//**
+**
+** SetControllerRoleForInternal
@ -58,9 +74,11 @@ index 8313342..b5e6d59 100644
+{
+ cur_msg_combined_role.inherited = kCTrustRole_Untrusted;
+ cur_msg_combined_role.assigned = kCTrustRole_FullAccess;
+ cur_msg_controller_info.endpoint_id = "";
+ SetControllerDummyID();
+}
+
/*********************************************************************//**
**
+/*********************************************************************//**
+**
** CacheControllerRoleForCurMsg
**
** Retrieves the role to use for the specified controller, and caches it locally, so that