summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclaiff <claiff@mail.ru>2022-09-16 12:33:07 +0300
committerclaiff <claiff@mail.ru>2022-09-16 12:36:27 +0300
commita83f06b6acaec608fada451ea0a23c290a0845f8 (patch)
treedab6789deba35842cdb735228cbaef4f3db98e11
parentf016086520f156980571e67b37a20282bcb536fd (diff)
downloadopenbmc-a83f06b6acaec608fada451ea0a23c290a0845f8.tar.xz
update smtp
-rw-r--r--meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0017-update-smtp.patch700
-rw-r--r--meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend1
-rw-r--r--meta-ibs/meta-cp2-5422/recipes-support/smtp/smtp.bb13
-rw-r--r--meta-ibs/meta-cp2-5422/recipes-support/smtp/smtp/mails.txt1
-rw-r--r--meta-ibs/meta-cp2-5422/recipes-support/smtp/smtp/settings.txt1
5 files changed, 715 insertions, 1 deletions
diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0017-update-smtp.patch b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0017-update-smtp.patch
new file mode 100644
index 0000000000..33ffdfd7b8
--- /dev/null
+++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0017-update-smtp.patch
@@ -0,0 +1,700 @@
+From 6f909553ae9526dea232731e440b2ae4d844e000 Mon Sep 17 00:00:00 2001
+From: claiff <claiff@mail.ru>
+Date: Fri, 16 Sep 2022 12:15:45 +0300
+Subject: [PATCH] update smtp
+
+---
+ meson.build | 4 +-
+ .../include/utils/smtp/add_mails_parser.hpp | 22 ++
+ .../utils/smtp/delete_mails_parser.hpp | 22 ++
+ ...ers_parser.hpp => set_settings_parser.hpp} | 10 +-
+ redfish-core/lib/smtp.hpp | 226 +++++++++++++++---
+ .../src/utils/smtp/add_mails_parser.cpp | 22 ++
+ .../utils/smtp/change_parameters_parser.cpp | 62 -----
+ .../src/utils/smtp/delete_mails_parser.cpp | 23 ++
+ .../src/utils/smtp/set_settings_parser.cpp | 96 ++++++++
+ redfish-core/ut/smtp_reader_parser_test.cpp | 6 +-
+ 10 files changed, 387 insertions(+), 106 deletions(-)
+ create mode 100644 redfish-core/include/utils/smtp/add_mails_parser.hpp
+ create mode 100644 redfish-core/include/utils/smtp/delete_mails_parser.hpp
+ rename redfish-core/include/utils/smtp/{change_parameters_parser.hpp => set_settings_parser.hpp} (63%)
+ create mode 100644 redfish-core/src/utils/smtp/add_mails_parser.cpp
+ delete mode 100644 redfish-core/src/utils/smtp/change_parameters_parser.cpp
+ create mode 100644 redfish-core/src/utils/smtp/delete_mails_parser.cpp
+ create mode 100644 redfish-core/src/utils/smtp/set_settings_parser.cpp
+
+diff --git a/meson.build b/meson.build
+index c1d253fb..d7ce2c44 100644
+--- a/meson.build
++++ b/meson.build
+@@ -376,7 +376,9 @@ srcfiles_bmcweb = [
+ 'redfish-core/src/error_messages.cpp',
+ 'redfish-core/src/utils/json_utils.cpp',
+ 'redfish-core/src/utils/smtp/send_message_parser.cpp',
+- 'redfish-core/src/utils/smtp/change_parameters_parser.cpp',
++ 'redfish-core/src/utils/smtp/set_settings_parser.cpp',
++ 'redfish-core/src/utils/smtp/add_mails_parser.cpp',
++ 'redfish-core/src/utils/smtp/delete_mails_parser.cpp',
+ 'redfish-core/src/utils/smtp/types/iparser.cpp',
+ 'src/boost_asio_ssl.cpp',
+ 'src/boost_asio.cpp',
+diff --git a/redfish-core/include/utils/smtp/add_mails_parser.hpp b/redfish-core/include/utils/smtp/add_mails_parser.hpp
+new file mode 100644
+index 00000000..cd65c441
+--- /dev/null
++++ b/redfish-core/include/utils/smtp/add_mails_parser.hpp
+@@ -0,0 +1,22 @@
++#pragma once
++
++#include <list>
++#include <string>
++
++#include "types/iparser.hpp"
++
++namespace redfish::smtp::parser
++{
++ class AddMails : public types::IParser
++ {
++ public:
++ explicit AddMails( std::string const& function_with_parameters );
++ ~AddMails() override = default;
++
++ std::list<std::string> GetMails() const;
++
++ std::string GetMethodName() const override;
++ private:
++ std::list<std::string> mMails;
++ };
++}
+diff --git a/redfish-core/include/utils/smtp/delete_mails_parser.hpp b/redfish-core/include/utils/smtp/delete_mails_parser.hpp
+new file mode 100644
+index 00000000..649096ee
+--- /dev/null
++++ b/redfish-core/include/utils/smtp/delete_mails_parser.hpp
+@@ -0,0 +1,22 @@
++#pragma once
++
++#include <list>
++#include <string>
++
++#include "types/iparser.hpp"
++
++namespace redfish::smtp::parser
++{
++ class DeleteMails : public types::IParser
++ {
++ public:
++ explicit DeleteMails( std::string const& function_with_parameters );
++ ~DeleteMails() override = default;
++
++ std::list<std::string> GetDeleteMails() const;
++
++ std::string GetMethodName() const override;
++ private:
++ std::list<std::string> mDeleteMails;
++ };
++}
+diff --git a/redfish-core/include/utils/smtp/change_parameters_parser.hpp b/redfish-core/include/utils/smtp/set_settings_parser.hpp
+similarity index 63%
+rename from redfish-core/include/utils/smtp/change_parameters_parser.hpp
+rename to redfish-core/include/utils/smtp/set_settings_parser.hpp
+index ee18b57b..46db143a 100644
+--- a/redfish-core/include/utils/smtp/change_parameters_parser.hpp
++++ b/redfish-core/include/utils/smtp/set_settings_parser.hpp
+@@ -4,16 +4,18 @@
+
+ namespace redfish::smtp::parser
+ {
+- class ChangeParameters : public types::IParser
++ class SetSettings : public types::IParser
+ {
+ public:
+- explicit ChangeParameters( std::string const& function_with_parameters );
+- ~ChangeParameters() override = default;
++ explicit SetSettings( std::string const& function_with_parameters );
++ ~SetSettings() override = default;
+
+ std::string GetUser() const;
+ std::string GetPassword() const;
+ std::string GetHost() const;
+ std::string GetPort() const;
++ bool GetIsNeedSsl() const;
++ bool GetIsNeedAuth() const;
+
+ std::string GetMethodName() const override;
+ private:
+@@ -23,5 +25,7 @@ namespace redfish::smtp::parser
+ std::string mPassword;
+ std::string mHost;
+ std::string mPort;
++ bool mIsNeedSsl;
++ bool mIsNeedAuth;
+ };
+ }
+diff --git a/redfish-core/lib/smtp.hpp b/redfish-core/lib/smtp.hpp
+index 1bd798f7..dd49f982 100644
+--- a/redfish-core/lib/smtp.hpp
++++ b/redfish-core/lib/smtp.hpp
+@@ -5,17 +5,24 @@
+ #include <iostream>
+
+ #include "utils/smtp/send_message_parser.hpp"
+-#include "utils/smtp/change_parameters_parser.hpp"
++#include "utils/smtp/set_settings_parser.hpp"
++#include "utils/smtp/add_mails_parser.hpp"
++#include "utils/smtp/delete_mails_parser.hpp"
+
+ namespace redfish
+ {
+ constexpr const char* SERVICE_PATH = "xyz.openbmc_project.SMTP";
+- constexpr const char* OBJECT_PATH = "/xyz/openbmc_project/SMTP";
+- constexpr const char* INTERFACE_PATH = "xyz.openbmc_project.SMTP";
++
++ constexpr const char* OBJECT_MESSENGER_PATH = "/xyz/openbmc_project/SMTP/Messenger";
++ constexpr const char* INTERFACE_MESSENGER_PATH = "xyz.openbmc_project.Messenger";
++
++ constexpr const char* OBJECT_MANAGER_PATH = "/xyz/openbmc_project/SMTP/Manager";
++ constexpr const char* INTERFACE_SETTINGS_MANAGER_PATH = "xyz.openbmc_project.SettingsManager";
++ constexpr const char* INTERFACE_MAIL_MANAGER_PATH = "xyz.openbmc_project.MailManager";
+
+ namespace smtp
+ {
+- inline std::optional<std::string> GetFunctionName( std::string const& function_with_parameters )
++ inline std::string GetFunctionName( std::string const& function_with_parameters )
+ {
+ static constexpr char FIRST_DELIMITER = '&';
+ static constexpr int ZERO_POSITION = 0;
+@@ -23,15 +30,19 @@ namespace redfish
+ auto position = function_with_parameters.find(FIRST_DELIMITER);
+ if( position == std::string::npos )
+ {
+- return {};
++ return function_with_parameters;
+ }
+ return function_with_parameters.substr( ZERO_POSITION, position );
+ }
+
+ inline void SendMail( std::string const& function_with_parameters, std::shared_ptr<bmcweb::AsyncResp> const& asyncResp )
+ {
++ std::cout << "SendMail" << std::endl;
+ auto parsing_result = parser::SendMessage{function_with_parameters};
+-
++ std::cout << "GetMethodName" << parsing_result.GetMethodName() << std::endl;
++ std::cout << "GetFrom" << parsing_result.GetFrom() << std::endl;
++ std::cout << "GetSubject" << parsing_result.GetSubject() << std::endl;
++ std::cout << "GetText" << parsing_result.GetText() << std::endl;
+ crow::connections::systemBus->async_method_call([asyncResp](const boost::system::error_code& error_code, bool result){
+ if (error_code.value() == EBADR ||
+ error_code == boost::system::errc::host_unreachable)
+@@ -48,19 +59,24 @@ namespace redfish
+ }
+ asyncResp->res.jsonValue["result"] = result;
+ },
+- SERVICE_PATH, OBJECT_PATH, INTERFACE_PATH,
++ SERVICE_PATH, OBJECT_MESSENGER_PATH, INTERFACE_MESSENGER_PATH,
+ parsing_result.GetMethodName(),
+ parsing_result.GetFrom(),
+- parsing_result.GetTo(),
+- parsing_result.GetCc(),
+ parsing_result.GetSubject(),
+ parsing_result.GetText());
+ }
+
+- inline void ChangeParameters( std::string const& function_with_parameters, std::shared_ptr<bmcweb::AsyncResp> const& asyncResp )
++ inline void SetSettings( std::string const& function_with_parameters, std::shared_ptr<bmcweb::AsyncResp> const& asyncResp )
+ {
+- auto parsing_result = parser::ChangeParameters{function_with_parameters};
+-
++ std::cout << "SetSettings" << std::endl;
++ auto parsing_result = parser::SetSettings{function_with_parameters};
++ std::cout << "GetMethodName" << parsing_result.GetMethodName() << std::endl;
++ std::cout << "GetIsNeedAuth" << parsing_result.GetIsNeedAuth() << std::endl;
++ std::cout << "GetIsNeedSsl" << parsing_result.GetIsNeedSsl() << std::endl;
++ std::cout << "GetUser" << parsing_result.GetUser() << std::endl;
++ std::cout << "GetPassword" << parsing_result.GetPassword() << std::endl;
++ std::cout << "GetHost" << parsing_result.GetHost() << std::endl;
++ std::cout << "GetPort" << parsing_result.GetPort() << std::endl;
+ crow::connections::systemBus->async_method_call([asyncResp](const boost::system::error_code& error_code, bool result){
+ if (error_code.value() == EBADR ||
+ error_code == boost::system::errc::host_unreachable)
+@@ -77,13 +93,129 @@ namespace redfish
+ }
+ asyncResp->res.jsonValue["result"] = result;
+ },
+- SERVICE_PATH, OBJECT_PATH, INTERFACE_PATH,
++ SERVICE_PATH, OBJECT_MANAGER_PATH,INTERFACE_SETTINGS_MANAGER_PATH,
+ parsing_result.GetMethodName(),
++ parsing_result.GetIsNeedAuth(),
++ parsing_result.GetIsNeedSsl(),
+ parsing_result.GetUser(),
+ parsing_result.GetPassword(),
+ parsing_result.GetHost(),
+ parsing_result.GetPort());
+ }
++
++ inline void GetSettings( std::shared_ptr<bmcweb::AsyncResp> const& asyncResp )
++ {
++ std::cout << "GetSettings" << std::endl;
++ crow::connections::systemBus->async_method_call([asyncResp](const boost::system::error_code& error_code, std::string const& result ){
++ if (error_code.value() == EBADR ||
++ error_code == boost::system::errc::host_unreachable)
++ {
++ BMCWEB_LOG_ERROR << "host unreachable " << error_code;
++ std::cout << "host unreachable" << std::endl;
++ return;
++ }
++ if (error_code)
++ {
++ BMCWEB_LOG_ERROR << "respHandler DBus error " << error_code;
++ std::cout << "respHandler DBus error" << std::endl;
++ return;
++ }
++ std::cout << "result" << std::endl;
++ auto parsing_result = parser::SetSettings{result};
++ asyncResp->res.jsonValue["host"] = parsing_result.GetHost();
++ asyncResp->res.jsonValue["is_need_auth"] = parsing_result.GetIsNeedAuth();
++ asyncResp->res.jsonValue["is_need_ssl"] = parsing_result.GetIsNeedSsl();
++ asyncResp->res.jsonValue["password"] = parsing_result.GetPassword();
++ asyncResp->res.jsonValue["port"] = parsing_result.GetPort();
++ asyncResp->res.jsonValue["username"] = parsing_result.GetUser();
++ },
++ SERVICE_PATH, OBJECT_MANAGER_PATH, INTERFACE_SETTINGS_MANAGER_PATH,
++ "GetSettings");
++ }
++
++ inline void GetMails( std::shared_ptr<bmcweb::AsyncResp> const& asyncResp )
++ {
++ std::cout << "GetMails" << std::endl;
++ crow::connections::systemBus->async_method_call([asyncResp](const boost::system::error_code& error_code, std::list<std::string> const& mails){
++ if (error_code.value() == EBADR ||
++ error_code == boost::system::errc::host_unreachable)
++ {
++ BMCWEB_LOG_ERROR << "host unreachable " << error_code;
++ std::cout << "host unreachable" << std::endl;
++ return;
++ }
++ if (error_code)
++ {
++ BMCWEB_LOG_ERROR << "respHandler DBus error " << error_code;
++ std::cout << "respHandler DBus error" << std::endl;
++ return;
++ }
++ asyncResp->res.jsonValue["mails"] = mails;
++ },
++ SERVICE_PATH, OBJECT_MANAGER_PATH, INTERFACE_MAIL_MANAGER_PATH,
++ "GetMailsToSend");
++ }
++
++ inline void AddMails( std::string const& function_with_parameters, std::shared_ptr<bmcweb::AsyncResp> const& asyncResp )
++ {
++ std::cout << "AddMails" << std::endl;
++ auto parsing_result = parser::AddMails{function_with_parameters};
++ std::cout << "parsing_result.GetMethodName() " << parsing_result.GetMethodName() << std::endl;
++ for(const auto& mail : parsing_result.GetMails())
++ {
++ std::cout << "parsing_result.GetMails() " << mail << std::endl;
++ }
++
++ crow::connections::systemBus->async_method_call([asyncResp](const boost::system::error_code& error_code, bool result){
++ if (error_code.value() == EBADR ||
++ error_code == boost::system::errc::host_unreachable)
++ {
++ BMCWEB_LOG_ERROR << "host unreachable " << error_code;
++ std::cout << "host unreachabler" << std::endl;
++ return;
++ }
++ if (error_code)
++ {
++ BMCWEB_LOG_ERROR << "respHandler DBus error " << error_code;
++ std::cout << "respHandler DBus error" << std::endl;
++ return;
++ }
++ asyncResp->res.jsonValue["result"] = result;
++ },
++ SERVICE_PATH, OBJECT_MANAGER_PATH, INTERFACE_MAIL_MANAGER_PATH,
++ parsing_result.GetMethodName(),
++ parsing_result.GetMails());
++ }
++
++ inline void DeleteMails( std::string const& function_with_parameters, std::shared_ptr<bmcweb::AsyncResp> const& asyncResp )
++ {
++ std::cout << "DeleteMails" << std::endl;
++ auto parsing_result = parser::DeleteMails{function_with_parameters};
++ std::cout << "parsing_result.GetMethodName()" << parsing_result.GetMethodName() << std::endl;
++ for(const auto& mail : parsing_result.GetDeleteMails())
++ {
++ std::cout << "parsing_result.GetDeleteMails() " << mail << std::endl;
++ }
++ crow::connections::systemBus->async_method_call([asyncResp](const boost::system::error_code& error_code, bool result){
++ if (error_code.value() == EBADR ||
++ error_code == boost::system::errc::host_unreachable)
++ {
++ BMCWEB_LOG_ERROR << "host unreachable " << error_code;
++ std::cout << "host unreachabler" << std::endl;
++ return;
++ }
++ if (error_code)
++ {
++ BMCWEB_LOG_ERROR << "respHandler DBus error " << error_code;
++ std::cout << "respHandler DBus error" << std::endl;
++ return;
++ }
++ asyncResp->res.jsonValue["result"] = result;
++ },
++ SERVICE_PATH, OBJECT_MANAGER_PATH, INTERFACE_MAIL_MANAGER_PATH,
++ parsing_result.GetMethodName(),
++ parsing_result.GetDeleteMails());
++ }
+ }
+
+ inline void FillResp(crow::Response& resp, const dbus::utility::DBusPropertiesMap& properties)
+@@ -130,23 +262,23 @@ namespace redfish
+ return;
+ }
+
+- crow::connections::systemBus->async_method_call([asyncResp](const boost::system::error_code& error_code,
+- const dbus::utility::DBusPropertiesMap& properties)
+- {
+- if (error_code)
+- {
+- BMCWEB_LOG_DEBUG << "DBUS response error " << error_code;
+- messages::internalError(asyncResp->res);
+- return;
+- }
++// crow::connections::systemBus->async_method_call([asyncResp](const boost::system::error_code& error_code,
++// const dbus::utility::DBusPropertiesMap& properties)
++// {
++// if (error_code)
++// {
++// BMCWEB_LOG_DEBUG << "DBUS response error " << error_code;
++// messages::internalError(asyncResp->res);
++// return;
++// }
+
+- FillResp(asyncResp->res, properties);
+- }, SERVICE_PATH, OBJECT_PATH, "org.freedesktop.DBus.Properties",
+- "GetAll", "xyz.openbmc_project.SMTP");
++// FillResp(asyncResp->res, properties);
++// }, SERVICE_PATH, OBJECT_PATH, "org.freedesktop.DBus.Properties",
++// "GetAll", "xyz.openbmc_project.SMTP");
+
+- asyncResp->res.jsonValue["@odata.type"] ="#SmtpCollection";
+- asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Smtp";
+- asyncResp->res.jsonValue["Name"] = "Smtp Collection";
++// asyncResp->res.jsonValue["@odata.type"] ="#SmtpCollection";
++// asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Smtp";
++// asyncResp->res.jsonValue["Name"] = "Smtp Collection";
+ });
+ }
+
+@@ -162,29 +294,47 @@ namespace redfish
+ const std::string& function_with_parameters)
+ {
+ static constexpr std::string_view SEND_MAIL_METHOD_NAME = "SendMail";
+- static constexpr std::string_view CHANGE_PARAMETERS_METHOD_NAME = "ChangeParameters";
++
++ static constexpr std::string_view GET_SETTINGS_METHOD_NAME = "GetSettings";
++ static constexpr std::string_view SET_SETTINGS_METHOD_NAME = "SetSettings";
++
++ static constexpr std::string_view GET_MAILS_METHOD_NAME = "GetMails";
++ static constexpr std::string_view ADD_MAILS_METHOD_NAME = "AddMails";
++ static constexpr std::string_view DELETE_MAILS_METHOD_NAME = "DeleteMails";
+
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+ auto function_name = smtp::GetFunctionName(function_with_parameters);
+- if(!function_name)
+- {
+- return;
+- }
+
+ asyncResp->res.jsonValue["@odata.type"] ="#SmtpCollection";
+- asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Smtp/" + *function_name;
++ asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Smtp/" + function_name;
+ asyncResp->res.jsonValue["Name"] = "Smtp Collection";
+-
+- if(*function_name == SEND_MAIL_METHOD_NAME)
++ std::cout << "function_name " << function_name << std::endl;
++ if(function_name == SEND_MAIL_METHOD_NAME)
+ {
+ smtp::SendMail(function_with_parameters, asyncResp);
+ }
+- else if(*function_name == CHANGE_PARAMETERS_METHOD_NAME)
++ else if(function_name == SET_SETTINGS_METHOD_NAME)
++ {
++ smtp::SetSettings(function_with_parameters, asyncResp);
++ }
++ else if(function_name == GET_SETTINGS_METHOD_NAME)
++ {
++ smtp::GetSettings(asyncResp);
++ }
++ else if(function_name == GET_MAILS_METHOD_NAME)
++ {
++ smtp::GetMails(asyncResp);
++ }
++ else if(function_name == ADD_MAILS_METHOD_NAME)
++ {
++ smtp::AddMails(function_with_parameters, asyncResp);
++ }
++ else if(function_name == DELETE_MAILS_METHOD_NAME)
+ {
+- smtp::ChangeParameters(function_with_parameters, asyncResp);
++ smtp::DeleteMails(function_with_parameters, asyncResp);
+ }
+ });
+ }
+diff --git a/redfish-core/src/utils/smtp/add_mails_parser.cpp b/redfish-core/src/utils/smtp/add_mails_parser.cpp
+new file mode 100644
+index 00000000..6abe41c9
+--- /dev/null
++++ b/redfish-core/src/utils/smtp/add_mails_parser.cpp
+@@ -0,0 +1,22 @@
++#include "utils/smtp/add_mails_parser.hpp"
++
++namespace redfish::smtp::parser
++{
++ AddMails::AddMails( std::string const& function_with_parameters )
++ {
++ static const std::string DELIMITER_ON_LINE = "&";
++
++ mMails = ParseLine(function_with_parameters, DELIMITER_ON_LINE);
++ mMails.erase(mMails.begin());
++ }
++
++ std::list<std::string> AddMails::GetMails() const
++ {
++ return mMails;
++ }
++
++ std::string AddMails::GetMethodName() const
++ {
++ return "AddMailsToSend";
++ }
++}
+diff --git a/redfish-core/src/utils/smtp/change_parameters_parser.cpp b/redfish-core/src/utils/smtp/change_parameters_parser.cpp
+deleted file mode 100644
+index f78b9482..00000000
+--- a/redfish-core/src/utils/smtp/change_parameters_parser.cpp
++++ /dev/null
+@@ -1,62 +0,0 @@
+-#include "utils/smtp/change_parameters_parser.hpp"
+-
+-namespace redfish::smtp::parser
+-{
+- ChangeParameters::ChangeParameters( std::string const& function_with_parameters )
+- {
+- static const std::string DELIMITER_ON_LINE = "&";
+-
+- auto params = BuildParams(ParseLine(function_with_parameters, DELIMITER_ON_LINE));
+- FillParams( params );
+- }
+-
+- std::string ChangeParameters::GetUser() const
+- {
+- return mUser;
+- }
+- std::string ChangeParameters::GetPassword() const
+- {
+- return mPassword;
+- }
+- std::string ChangeParameters::GetHost() const
+- {
+- return mHost;
+- }
+- std::string ChangeParameters::GetPort() const
+- {
+- return mPort;
+- }
+-
+- std::string ChangeParameters::GetMethodName() const
+- {
+- constexpr const char* CHANGE_METHOD_NAME = "ChangeParameters";
+- return CHANGE_METHOD_NAME;
+- }
+-
+- void ChangeParameters::FillParams( types::ParserResult const& params )
+- {
+- auto user = params.find("user");
+- if(user != params.end())
+- {
+- mUser = (*user).second;
+- }
+-
+- auto password = params.find("password");
+- if(password != params.end())
+- {
+- mPassword = (*password).second;
+- }
+-
+- auto host = params.find("host");
+- if(host != params.end())
+- {
+- mHost = (*host).second;
+- }
+-
+- auto port = params.find("port");
+- if(port != params.end())
+- {
+- mPort = (*port).second;
+- }
+- }
+-}
+diff --git a/redfish-core/src/utils/smtp/delete_mails_parser.cpp b/redfish-core/src/utils/smtp/delete_mails_parser.cpp
+new file mode 100644
+index 00000000..ead3bbfb
+--- /dev/null
++++ b/redfish-core/src/utils/smtp/delete_mails_parser.cpp
+@@ -0,0 +1,23 @@
++#include "utils/smtp/delete_mails_parser.hpp"
++
++namespace redfish::smtp::parser
++{
++ DeleteMails::DeleteMails( std::string const& function_with_parameters )
++ {
++ static const std::string DELIMITER_ON_LINE = "&";
++
++ mDeleteMails = ParseLine(function_with_parameters, DELIMITER_ON_LINE);
++ mDeleteMails.erase(mDeleteMails.begin());
++ }
++
++ std::list<std::string> DeleteMails::GetDeleteMails() const
++ {
++ return mDeleteMails;
++ }
++
++ std::string DeleteMails::GetMethodName() const
++ {
++ return "DeleteMailsToSend";
++ }
++
++}
+diff --git a/redfish-core/src/utils/smtp/set_settings_parser.cpp b/redfish-core/src/utils/smtp/set_settings_parser.cpp
+new file mode 100644
+index 00000000..d5071b05
+--- /dev/null
++++ b/redfish-core/src/utils/smtp/set_settings_parser.cpp
+@@ -0,0 +1,96 @@
++#include "utils/smtp/set_settings_parser.hpp"
++#include <iostream>
++
++namespace redfish::smtp::parser
++{
++ SetSettings::SetSettings( std::string const& function_with_parameters )
++ {
++ static const std::string DELIMITER_ON_LINE = "&";
++ auto parsed_data = ParseLine(function_with_parameters, DELIMITER_ON_LINE);
++ std::cout << "aaaa" <<std::endl;
++ for(auto const& d : parsed_data)
++ {
++ std::cout << d <<std::endl;
++ }
++ auto params = BuildParams( parsed_data );
++ std::cout << "qqqq" <<std::endl;
++ for(const auto& dd: params)
++ {
++ std::cout << dd.first << ":"<< dd.second << std::endl;
++ }
++ FillParams( params );
++ }
++
++ std::string SetSettings::GetUser() const
++ {
++ return mUser;
++ }
++
++ std::string SetSettings::GetPassword() const
++ {
++ return mPassword;
++ }
++
++ std::string SetSettings::GetHost() const
++ {
++ return mHost;
++ }
++
++ std::string SetSettings::GetPort() const
++ {
++ return mPort;
++ }
++
++ bool SetSettings::GetIsNeedSsl() const
++ {
++ return mIsNeedSsl;
++ }
++
++ bool SetSettings::GetIsNeedAuth() const
++ {
++ return mIsNeedAuth;
++ }
++
++ std::string SetSettings::GetMethodName() const
++ {
++ constexpr const char* CHANGE_METHOD_NAME = "SetSettings";
++ return CHANGE_METHOD_NAME;
++ }
++
++ void SetSettings::FillParams( types::ParserResult const& params )
++ {
++ auto user = params.find("username");
++ if(user != params.end())
++ {
++ mUser = (*user).second;
++ }
++
++ auto password = params.find("password");
++ if(password != params.end())
++ {
++ mPassword = (*password).second;
++ }
++
++ auto host = params.find("host");
++ if(host != params.end())
++ {
++ mHost = (*host).second;
++ }
++
++ auto port = params.find("port");
++ if(port != params.end())
++ {
++ mPort = (*port).second;
++ }
++ auto is_need_auth = params.find("is_need_auth");
++ if(is_need_auth != params.end())
++ {
++ mIsNeedAuth = (*is_need_auth).second == "true" ? true : false;
++ }
++ auto is_need_ssl = params.find("is_need_ssl");
++ if(is_need_ssl != params.end())
++ {
++ mIsNeedSsl = (*is_need_ssl).second == "true" ? true : false;
++ }
++ }
++}
+diff --git a/redfish-core/ut/smtp_reader_parser_test.cpp b/redfish-core/ut/smtp_reader_parser_test.cpp
+index 67a6645c..85ca25dc 100644
+--- a/redfish-core/ut/smtp_reader_parser_test.cpp
++++ b/redfish-core/ut/smtp_reader_parser_test.cpp
+@@ -1,5 +1,5 @@
+ #include "utils/smtp/send_message_parser.hpp"
+-#include "utils/smtp/change_parameters_parser.hpp"
++#include "utils/smtp/set_settings_parser.hpp"
+ #include "smtp.hpp"
+
+ #include <string>
+@@ -27,11 +27,13 @@ TEST(SmtpReaderParser, SendMessage)
+
+ TEST(SmtpReaderParser, ChangeParameters)
+ {
+- smtp::parser::ChangeParameters message_parser{"ChangeParameters&user=claiff@mail.ru&password=32311&host=smtp.mail.ru&port=465"};
++ smtp::parser::SetSettings message_parser{"ChangeParameters&user=claiff@mail.ru&password=32311&host=smtp.mail.ru&port=465&is_need_auth=true&is_need_ssl=true"};
+ EXPECT_EQ(message_parser.GetUser(), "claiff@mail.ru");
+ EXPECT_EQ(message_parser.GetPassword(), "32311");
+ EXPECT_EQ(message_parser.GetHost(), "smtp.mail.ru");
+ EXPECT_EQ(message_parser.GetPort(), "465");
++ EXPECT_EQ(message_parser.GetIsNeedAuth(), true);
++ EXPECT_EQ(message_parser.GetIsNeedSsl(), true);
+ }
+
+ TEST(SmtpReaderParser, GetFunctionName)
diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend
index 6a86d4360c..3b579231ec 100644
--- a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend
+++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend
@@ -13,6 +13,7 @@ SRC_URI += "\
file://0014-Additional-details-about-errors-when-change-user-pw.patch \
file://0015-Redfish-Implement-SNMP-Trap.patch \
file://0016-Redfish-implement-Syslog-config.patch \
+ file://0017-update-smtp.patch \
"
EXTRA_OEMESON += "\
diff --git a/meta-ibs/meta-cp2-5422/recipes-support/smtp/smtp.bb b/meta-ibs/meta-cp2-5422/recipes-support/smtp/smtp.bb
index ffa29826bb..da02a97905 100644
--- a/meta-ibs/meta-cp2-5422/recipes-support/smtp/smtp.bb
+++ b/meta-ibs/meta-cp2-5422/recipes-support/smtp/smtp.bb
@@ -1,3 +1,4 @@
+FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
SUMMARY = "Simple SMTP manager"
DESCRIPTION = "Simple SMTP manager"
@@ -7,10 +8,20 @@ LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
SRC_URI = "git://git@git.sila.ru/srv/pub/scm/git/openbmc/obmc-sila-smtp.git;branch=master;protocol=ssh"
-SRCREV = "9fa4addff6f90a8b5697a594e034f5517d64dd25"
+SRCREV = "7e156f58e74baaf4f1d7ccb4df629e6e1a26a32e"
S = "${WORKDIR}/git"
+SRC_URI += "file://settings.txt \
+ file://mails.txt \
+ "
+do_install:append() {
+ install -d ${D}/var/lib/smtp/
+
+ install -m 0744 ${WORKDIR}/settings.txt ${D}/var/lib/smtp/
+ install -m 0744 ${WORKDIR}/mails.txt ${D}/var/lib/smtp/
+}
+
inherit cmake systemd
DEPENDS = "boost systemd sdbusplus curl"
diff --git a/meta-ibs/meta-cp2-5422/recipes-support/smtp/smtp/mails.txt b/meta-ibs/meta-cp2-5422/recipes-support/smtp/smtp/mails.txt
new file mode 100644
index 0000000000..8d1c8b69c3
--- /dev/null
+++ b/meta-ibs/meta-cp2-5422/recipes-support/smtp/smtp/mails.txt
@@ -0,0 +1 @@
+
diff --git a/meta-ibs/meta-cp2-5422/recipes-support/smtp/smtp/settings.txt b/meta-ibs/meta-cp2-5422/recipes-support/smtp/smtp/settings.txt
new file mode 100644
index 0000000000..8d1c8b69c3
--- /dev/null
+++ b/meta-ibs/meta-cp2-5422/recipes-support/smtp/smtp/settings.txt
@@ -0,0 +1 @@
+