From d4fbc870cb8cb083158b465be8b7a2f26bb5155b Mon Sep 17 00:00:00 2001 From: "junsuk77.oh" Date: Mon, 21 Oct 2013 13:55:45 +0900 Subject: [PATCH] add mdm server check api Change-Id: Ie2cfbe63606543ffa76fcf0eb01f69d8ebb1ea08 Signed-off-by: junsuk77.oh --- include/pkgmgr-info-debug.h | 1 + packaging/pkgmgr-info.spec | 2 +- parser/pkgmgr_parser.c | 33 +++++++++++++++++++++++++-------- parser/pkgmgr_parser.h | 6 ++++++ src/pkgmgr-info.c | 14 +++++++------- 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/include/pkgmgr-info-debug.h b/include/pkgmgr-info-debug.h index 8bd898c..4588c82 100644 --- a/include/pkgmgr-info-debug.h +++ b/include/pkgmgr-info-debug.h @@ -26,6 +26,7 @@ #define _LOGE(fmt, arg...) LOGE(fmt, ##arg) #define _LOGD(fmt, arg...) LOGD(fmt, ##arg) +#define _LOGS(fmt, arg...) LOGD(fmt, ##arg) #define PKGMGR_INFO_ENABLE_DLOG diff --git a/packaging/pkgmgr-info.spec b/packaging/pkgmgr-info.spec index c7ca35b..db9f4df 100755 --- a/packaging/pkgmgr-info.spec +++ b/packaging/pkgmgr-info.spec @@ -1,6 +1,6 @@ Name: pkgmgr-info Summary: Packager Manager infomation api for package -Version: 0.0.143 +Version: 0.0.144 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 diff --git a/parser/pkgmgr_parser.c b/parser/pkgmgr_parser.c index 3233e36..9e94389 100755 --- a/parser/pkgmgr_parser.c +++ b/parser/pkgmgr_parser.c @@ -945,7 +945,7 @@ static int __run_parser_prestep(xmlTextReaderPtr reader, ACTION_TYPE action, con } value = xmlTextReaderConstValue(reader); - _LOGD("%d %d %s %d %d", + _LOGS("%d %d %s %d %d", xmlTextReaderDepth(reader), xmlTextReaderNodeType(reader), name, @@ -966,7 +966,7 @@ static int __run_parser_prestep(xmlTextReaderPtr reader, ACTION_TYPE action, con } xmlDocPtr docPtr = xmlTextReaderCurrentDoc(reader); - _LOGD("docPtr->URL %s\n", (char *)docPtr->URL); + _LOGS("docPtr->URL %s\n", (char *)docPtr->URL); xmlDocPtr copyDocPtr = xmlCopyDoc(docPtr, 1); if (copyDocPtr == NULL) return -1; @@ -1007,7 +1007,7 @@ static int __run_parser_prestep(xmlTextReaderPtr reader, ACTION_TYPE action, con #ifdef __DEBUG__ //#else - _LOGD("node type: %d, name: %s children->name: %s last->name: %s\n" + _LOGS("node type: %d, name: %s children->name: %s last->name: %s\n" "parent->name: %s next->name: %s prev->name: %s\n", cur_node->type, cur_node->name, cur_node->children ? cur_node->children->name : "NULL", @@ -1310,10 +1310,10 @@ __streamFile(const char *filename, ACTION_TYPE action, char *const tagv[], const xmlFreeTextReader(reader); if (ret != 0) { - _LOGD("%s : failed to parse", filename); + _LOGS("%s : failed to parse", filename); } } else { - _LOGD("Unable to open %s", filename); + _LOGS("Unable to open %s", filename); } __plugin_process_tag(tagv, action, PLUGIN_POST_PROCESS, pkgid); @@ -2444,10 +2444,10 @@ int __ps_process_tag_parser(manifest_x *mfx, const char *filename, ACTION_TYPE a xmlFreeTextReader(reader); if (ret != 0) { - _LOGD("%s : failed to parse", filename); + _LOGS("%s : failed to parse", filename); } } else { - _LOGD("Unable to open %s", filename); + _LOGS("Unable to open %s", filename); } ret = __parser_send_tag(lib_handle, action, PLUGIN_POST_PROCESS, mfx->package); @@ -4400,7 +4400,7 @@ static int __ps_make_nativeapp_desktop(manifest_x * mfx, const char *manifest, A file = fopen(filepath, "w"); if(file == NULL) { - _LOGD("Can't open %s", filepath); + _LOGS("Can't open %s", filepath); free(buf); free(buftemp); return -1; @@ -4861,6 +4861,17 @@ static int __check_preload_updated(manifest_x * mfx, const char *manifest) return 0; } +static int __ps_check_mdm_policy(manifest_x * mfx, ACTION_TYPE action) +{ + int ret = PMINFO_R_OK; + return ret; +} + +API int pkgmgr_parser_check_mdm_policy_for_uninstallation(const char *manifest) +{ + int ret = PMINFO_R_OK; + return ret; +} API int pkgmgr_parser_create_desktop_file(manifest_x *mfx) { @@ -5163,6 +5174,9 @@ API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char _LOGD("Parsing Finished\n"); + ret = __ps_check_mdm_policy(mfx, ACTION_INSTALL); + retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "pkg[%s] violate mdm policy.", mfx->package); + // __streamFile(manifest, ACTION_INSTALL, temp, mfx->package); __ps_process_tag_parser(mfx, manifest, ACTION_INSTALL); __add_preload_info(mfx, manifest); @@ -5298,6 +5312,9 @@ API int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, ch _LOGD("Parsing Finished\n"); + ret = __ps_check_mdm_policy(mfx, ACTION_UNINSTALL); + retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "pkg[%s] violate mdm policy.", mfx->package); + // __streamFile(manifest, ACTION_UNINSTALL, temp, mfx->package); __ps_process_tag_parser(mfx, manifest, ACTION_UNINSTALL); diff --git a/parser/pkgmgr_parser.h b/parser/pkgmgr_parser.h index c04918f..7160ba3 100755 --- a/parser/pkgmgr_parser.h +++ b/parser/pkgmgr_parser.h @@ -490,6 +490,12 @@ typedef struct manifest_x { } manifest_x; /** + * @fn char int pkgmgr_parser_check_mdm_policy_for_uninstallation(manifest_x * mfx) + * @brief This API gets the mdm policy form mdm server + */ +int pkgmgr_parser_check_mdm_policy_for_uninstallation(const char *manifest); + +/** * @fn char *pkgmgr_parser_get_manifest_file(const char *pkgid) * @brief This API gets the manifest file of the package. * diff --git a/src/pkgmgr-info.c b/src/pkgmgr-info.c index fe2a84c..ba680fd 100755 --- a/src/pkgmgr-info.c +++ b/src/pkgmgr-info.c @@ -5717,18 +5717,18 @@ API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle, if (link) { ptr = (pkgmgrinfo_node_x *)link->data; strncpy(prev, ptr->value, PKG_STRING_LEN_MAX - 1); - _LOGE("Previous value is %s\n", prev); + _LOGS("Previous value is %s\n", prev); filter->list = g_slist_delete_link(filter->list, link); snprintf(temp, PKG_STRING_LEN_MAX - 1, "%s , '%s'", prev, value); strncpy(val, temp, PKG_STRING_LEN_MAX - 1); - _LOGE("New value is %s\n", val); + _LOGS("New value is %s\n", val); node->value = val; filter->list = g_slist_append(filter->list, (gpointer)node); memset(temp, '\0', PKG_STRING_LEN_MAX); } else { snprintf(temp, PKG_STRING_LEN_MAX - 1, "'%s'", value); strncpy(val, temp, PKG_STRING_LEN_MAX - 1); - _LOGE("First value is %s\n", val); + _LOGS("First value is %s\n", val); node->value = val; filter->list = g_slist_append(filter->list, (gpointer)node); memset(temp, '\0', PKG_STRING_LEN_MAX); @@ -5787,12 +5787,12 @@ API int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int where[sizeof(where) - 1] = '\0'; } } - _LOGE("where = %s\n", where); + _LOGS("where = %s\n", where); if (strlen(where) > 0) { strncat(query, where, sizeof(query) - strlen(query) - 1); query[sizeof(query) - 1] = '\0'; } -// SECURE_LOGD("query = %s\n", query); + _LOGS("query = %s\n", query); /*To get filtered list*/ pkgmgr_pkginfo_x *info = NULL; info = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x)); @@ -5938,12 +5938,12 @@ API int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h ha where[sizeof(where) - 1] = '\0'; } } - _LOGE("where = %s\n", where); + _LOGS("where = %s\n", where); if (strlen(where) > 0) { strncat(query, where, sizeof(query) - strlen(query) - 1); query[sizeof(query) - 1] = '\0'; } - _LOGE("query = %s\n", query); + _LOGS("query = %s\n", query); /*To get filtered list*/ pkgmgr_pkginfo_x *info = NULL; info = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x)); -- 2.7.4