diff options
Diffstat (limited to '0022-2159-use-macros-to-isolate-the-password-option-of-lo.patch')
-rw-r--r-- | 0022-2159-use-macros-to-isolate-the-password-option-of-lo.patch | 223 |
1 files changed, 223 insertions, 0 deletions
diff --git a/0022-2159-use-macros-to-isolate-the-password-option-of-lo.patch b/0022-2159-use-macros-to-isolate-the-password-option-of-lo.patch new file mode 100644 index 0000000..3306ba5 --- /dev/null +++ b/0022-2159-use-macros-to-isolate-the-password-option-of-lo.patch @@ -0,0 +1,223 @@ +From 0c0bc7a873cb5377aa0d5587c28d711a09f00811 Mon Sep 17 00:00:00 2001 +From: zhongtao <zhongtao17@huawei.com> +Date: Wed, 30 Aug 2023 09:56:29 +0000 +Subject: [PATCH 22/33] !2159 use macros to isolate the password option of + login and the plugin module * use macros to isolate the password option of + login and the plugin module + +--- + cmake/options.cmake | 14 ++++++++++ + src/cmd/isula/images/login.h | 28 +++++++++++++------ + src/cmd/isulad/main.c | 2 ++ + .../executor/container_cb/execution_create.c | 2 ++ + src/daemon/modules/CMakeLists.txt | 13 +++++++-- + src/daemon/modules/api/CMakeLists.txt | 3 ++ + .../container/container_events_handler.c | 2 ++ + .../modules/service/service_container.c | 4 +++ + 8 files changed, 57 insertions(+), 11 deletions(-) + +diff --git a/cmake/options.cmake b/cmake/options.cmake +index 5fc5c221..e733fd1c 100644 +--- a/cmake/options.cmake ++++ b/cmake/options.cmake +@@ -138,6 +138,20 @@ if (ENABLE_NATIVE_NETWORK OR ENABLE_GRPC) + set(ENABLE_NETWORK 1) + endif() + ++option(ENABLE_PLUGIN "enable plugin module" OFF) ++if (ENABLE_PLUGIN STREQUAL "ON") ++ add_definitions(-DENABLE_PLUGIN=1) ++ set(ENABLE_PLUGIN 1) ++ message("${Green}-- Enable plugin module${ColourReset}") ++endif() ++ ++option(ENABLE_LOGIN_PASSWORD_OPTION "enable login password option" ON) ++if (ENABLE_LOGIN_PASSWORD_OPTION STREQUAL "ON") ++ add_definitions(-DENABLE_LOGIN_PASSWORD_OPTION=1) ++ set(ENABLE_LOGIN_PASSWORD_OPTION 1) ++ message("${Green}-- Enable login password option${ColourReset}") ++endif() ++ + option(EANBLE_IMAGE_LIBARAY "create libisulad_image.so" ON) + if (EANBLE_IMAGE_LIBARAY STREQUAL "ON") + add_definitions(-DEANBLE_IMAGE_LIBARAY) +diff --git a/src/cmd/isula/images/login.h b/src/cmd/isula/images/login.h +index 5f9a676c..38829cba 100644 +--- a/src/cmd/isula/images/login.h ++++ b/src/cmd/isula/images/login.h +@@ -24,16 +24,28 @@ + extern "C" { + #endif + ++#ifdef ENABLE_LOGIN_PASSWORD_OPTION + #define LOGIN_OPTIONS(cmdargs) \ +- { CMD_OPT_TYPE_STRING_DUP, false, "username", 'u', &(cmdargs).username, "Username", NULL }, \ +- { CMD_OPT_TYPE_STRING_DUP, false, "password", 'p', &(cmdargs).password, "Password", NULL }, \ +- { CMD_OPT_TYPE_BOOL, \ +- false, \ +- "password-stdin", \ +- 0, \ +- &(cmdargs).password_stdin, \ +- "Take the password from stdin", \ ++ { CMD_OPT_TYPE_STRING_DUP, false, "username", 'u', &(cmdargs).username, "Username", NULL }, \ ++ { CMD_OPT_TYPE_STRING_DUP, false, "password", 'p', &(cmdargs).password, "Password", NULL }, \ ++ { CMD_OPT_TYPE_BOOL, \ ++ false, \ ++ "password-stdin", \ ++ 0, \ ++ &(cmdargs).password_stdin, \ ++ "Take the password from stdin", \ + NULL }, ++#else ++#define LOGIN_OPTIONS(cmdargs) \ ++ { CMD_OPT_TYPE_STRING_DUP, false, "username", 'u', &(cmdargs).username, "Username", NULL }, \ ++ { CMD_OPT_TYPE_BOOL, \ ++ false, \ ++ "password-stdin", \ ++ 0, \ ++ &(cmdargs).password_stdin, \ ++ "Take the password from stdin", \ ++ NULL }, ++#endif + + extern const char g_cmd_login_desc[]; + extern const char g_cmd_login_usage[]; +diff --git a/src/cmd/isulad/main.c b/src/cmd/isulad/main.c +index 8369f9e2..4740f91a 100644 +--- a/src/cmd/isulad/main.c ++++ b/src/cmd/isulad/main.c +@@ -1685,10 +1685,12 @@ int main(int argc, char **argv) + goto failure; + } + ++#ifdef ENABLE_PLUGIN + if (start_plugin_manager()) { + ERROR("Failed to init plugin_manager"); + goto failure; + } ++#endif + + clock_gettime(CLOCK_MONOTONIC, &t_end); + use_time = (double)(t_end.tv_sec - t_start.tv_sec) * (double)1000000000 + (double)(t_end.tv_nsec - t_start.tv_nsec); +diff --git a/src/daemon/executor/container_cb/execution_create.c b/src/daemon/executor/container_cb/execution_create.c +index 9c097121..377aa1aa 100644 +--- a/src/daemon/executor/container_cb/execution_create.c ++++ b/src/daemon/executor/container_cb/execution_create.c +@@ -1499,6 +1499,7 @@ int container_create_cb(const container_create_request *request, container_creat + goto clean_netns; + } + ++#ifdef ENABLE_PLUGIN + /* modify oci_spec by plugin. */ + if (plugin_event_container_pre_create(id, oci_spec) != 0) { + ERROR("Plugin event pre create failed"); +@@ -1506,6 +1507,7 @@ int container_create_cb(const container_create_request *request, container_creat + cc = ISULAD_ERR_EXEC; + goto clean_netns; + } ++#endif + + host_channel = dup_host_channel(host_spec->host_channel); + if (prepare_host_channel(host_channel, host_spec->user_remap)) { +diff --git a/src/daemon/modules/CMakeLists.txt b/src/daemon/modules/CMakeLists.txt +index 5d13412b..a70c094f 100644 +--- a/src/daemon/modules/CMakeLists.txt ++++ b/src/daemon/modules/CMakeLists.txt +@@ -3,7 +3,6 @@ + aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} modules_top_srcs) + add_subdirectory(runtime) + add_subdirectory(image) +-add_subdirectory(plugin) + add_subdirectory(spec) + add_subdirectory(container) + add_subdirectory(log) +@@ -17,7 +16,6 @@ set(local_modules_srcs + ${modules_top_srcs} + ${RUNTIME_SRCS} + ${IMAGE_SRCS} +- ${PLUGIN_SRCS} + ${SPEC_SRCS} + ${MANAGER_SRCS} + ${LOG_GATHER_SRCS} +@@ -31,7 +29,6 @@ set(local_modules_incs + ${CMAKE_CURRENT_SOURCE_DIR} + ${RUNTIME_INCS} + ${IMAGE_INCS} +- ${PLUGIN_INCS} + ${SPEC_INCS} + ${MANAGER_INCS} + ${LOG_GATHER_INCS} +@@ -42,6 +39,16 @@ set(local_modules_incs + ${VOLUME_INCS} + ) + ++if (ENABLE_PLUGIN) ++ add_subdirectory(plugin) ++ list(APPEND local_modules_srcs ++ ${PLUGIN_SRCS} ++ ) ++ list(APPEND local_modules_incs ++ ${PLUGIN_INCS} ++ ) ++endif() ++ + set(MODULES_SRCS + ${local_modules_srcs} + PARENT_SCOPE +diff --git a/src/daemon/modules/api/CMakeLists.txt b/src/daemon/modules/api/CMakeLists.txt +index f577c45f..0735b25a 100644 +--- a/src/daemon/modules/api/CMakeLists.txt ++++ b/src/daemon/modules/api/CMakeLists.txt +@@ -9,3 +9,6 @@ set(MODULES_API_INCS + PARENT_SCOPE + ) + ++if (NOT ENABLE_PLUGIN) ++ list(REMOVE_ITEM MODULES_API_INCS "${CMAKE_CURRENT_SOURCE_DIR}/plugin_api.h") ++endif() +diff --git a/src/daemon/modules/container/container_events_handler.c b/src/daemon/modules/container/container_events_handler.c +index d78e6fc1..d56c2ee0 100644 +--- a/src/daemon/modules/container/container_events_handler.c ++++ b/src/daemon/modules/container/container_events_handler.c +@@ -155,7 +155,9 @@ static int container_state_changed(container_t *cont, const struct isulad_events + } else { + container_state_set_stopped(cont->state, (int)events->exit_status); + container_wait_stop_cond_broadcast(cont); ++#ifdef ENABLE_PLUGIN + plugin_event_container_post_stop(cont); ++#endif + } + + auto_remove = !should_restart && cont->hostconfig != NULL && cont->hostconfig->auto_remove; +diff --git a/src/daemon/modules/service/service_container.c b/src/daemon/modules/service/service_container.c +index 1fa2559d..2d393f62 100644 +--- a/src/daemon/modules/service/service_container.c ++++ b/src/daemon/modules/service/service_container.c +@@ -807,12 +807,14 @@ static int do_start_container(container_t *cont, const char *console_fifos[], bo + open_stdin = cont->common_config->config->open_stdin; + } + ++#ifdef ENABLE_PLUGIN + if (plugin_event_container_pre_start(cont)) { + ERROR("Plugin event pre start failed "); + plugin_event_container_post_stop(cont); /* ignore error */ + ret = -1; + goto close_exit_fd; + } ++#endif + + #ifdef ENABLE_CRI_API_V1 + if (cont->common_config->sandbox_info != NULL && +@@ -1370,7 +1372,9 @@ int delete_container(container_t *cont, bool force) + } + } + ++#ifdef ENABLE_PLUGIN + plugin_event_container_post_remove(cont); ++#endif + + ret = do_delete_container(cont); + if (ret != 0) { +-- +2.40.1 + |