From 5c82addd9e25237ee20d39ea414bdffffec2455b Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Tue, 14 Feb 2023 10:11:58 +0600 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=20=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B0=D0=BC=D0=BC?= =?UTF-8?q?=D1=8B=20=D1=81=20pkexec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nohup.out | 80 +++++++++++++++++++++++++++++++++++++++++++ source/CMakeLists.txt | 7 ++-- source/main.cc | 21 ++---------- source/ublexec.cc | 40 ++++++++++------------ source/ublexec.h | 29 ++++------------ ublexec.glade | 2 +- ublexec_ru.po | 2 +- 7 files changed, 114 insertions(+), 67 deletions(-) create mode 100644 nohup.out diff --git a/nohup.out b/nohup.out new file mode 100644 index 0000000..cf235df --- /dev/null +++ b/nohup.out @@ -0,0 +1,80 @@ +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Refusing to render service to dead parents. +Gtk-Message: 14:21:06.968: Failed to load module "colorreload-gtk-module" +Gtk-Message: 14:21:06.968: Failed to load module "window-decorations-gtk-module" +Gtk-Message: 14:21:14.239: Failed to load module "colorreload-gtk-module" +Gtk-Message: 14:21:14.240: Failed to load module "window-decorations-gtk-module" +Gtk-Message: 14:21:14.318: Failed to load module "colorreload-gtk-module" +Gtk-Message: 14:21:14.318: Failed to load module "window-decorations-gtk-module" +Gtk-Message: 14:21:49.400: Failed to load module "colorreload-gtk-module" +Gtk-Message: 14:21:49.401: Failed to load module "window-decorations-gtk-module" +Gtk-Message: 14:21:49.463: Failed to load module "colorreload-gtk-module" +Gtk-Message: 14:21:49.463: Failed to load module "window-decorations-gtk-module" +javaldx: Could not find a Java Runtime Environment! +Warning: failed to read path from javaldx +Gtk-Message: 14:22:25.948: Failed to load module "colorreload-gtk-module" +Gtk-Message: 14:22:25.949: Failed to load module "window-decorations-gtk-module" +Gtk-Message: 14:22:41.171: Failed to load module "colorreload-gtk-module" +Gtk-Message: 14:22:41.171: Failed to load module "window-decorations-gtk-module" +Gtk-Message: 14:22:41.236: Failed to load module "colorreload-gtk-module" +Gtk-Message: 14:22:41.237: Failed to load module "window-decorations-gtk-module" +Gtk-Message: 14:22:50.959: Failed to load module "colorreload-gtk-module" +Gtk-Message: 14:22:50.959: Failed to load module "window-decorations-gtk-module" +Gtk-Message: 14:22:51.022: Failed to load module "colorreload-gtk-module" +Gtk-Message: 14:22:51.023: Failed to load module "window-decorations-gtk-module" +xhost: bad hostname "superadmin" +X Error of failed request: BadValue (integer parameter out of range for operation) + Major opcode of failed request: 109 (X_ChangeHosts) + Value in failed request: 0xa + Serial number of failed request: 7 + Current serial number in output stream: 9 +localuser: being added to access control list +xhost: bad hostname "superadmin" +X Error of failed request: BadValue (integer parameter out of range for operation) + Major opcode of failed request: 109 (X_ChangeHosts) + Value in failed request: 0xa + Serial number of failed request: 7 + Current serial number in output stream: 9 +localuser: being added to access control list +xhost: bad hostname "superadmin" +X Error of failed request: BadValue (integer parameter out of range for operation) + Major opcode of failed request: 109 (X_ChangeHosts) + Value in failed request: 0xa + Serial number of failed request: 7 + Current serial number in output stream: 9 +localuser: being added to access control list +xhost: bad hostname "superadmin" +X Error of failed request: BadValue (integer parameter out of range for operation) + Major opcode of failed request: 109 (X_ChangeHosts) + Value in failed request: 0xa + Serial number of failed request: 7 + Current serial number in output stream: 9 +localuser: being added to access control list +xhost: bad hostname "superadmin" +X Error of failed request: BadValue (integer parameter out of range for operation) + Major opcode of failed request: 109 (X_ChangeHosts) + Value in failed request: 0xa + Serial number of failed request: 7 + Current serial number in output stream: 9 +localuser: being added to access control list diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index d7bb690..82357c3 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -7,9 +7,12 @@ pkg_check_modules(GTK REQUIRED gtkmm-3.0) include_directories(${GTK_INCLUDE_DIRS}) link_directories(${GTK_LIBRARY_DIRS}) add_definitions(${GTK_CFLAGS_OTHER}) +find_package(Threads REQUIRED) #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -std=c++2a -g") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wmissing-declarations -fdiagnostics-color=always -g") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wmissing-declarations -fdiagnostics-color=always") +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) set(SOURCE_FILES main.cc @@ -21,5 +24,5 @@ set(LIBRARIES pthread) add_executable(ublexec ${SOURCE_FILES}) -target_link_libraries(ublexec ${LIBRARIES}) +target_link_libraries(ublexec ${LIBRARIES} Threads::Threads) install(TARGETS ublexec DESTINATION bin) diff --git a/source/main.cc b/source/main.cc index 9c08001..7a27f08 100644 --- a/source/main.cc +++ b/source/main.cc @@ -1,32 +1,15 @@ +#include #include #include -#include -#include #include -#include #include -#include #include #include -#include -#include -#include #include -#include -#include -#include -#include #include #include -#include -#include #include -#include -#include -#include -#include -#include -#include +#include #include "ublexec.h" diff --git a/source/ublexec.cc b/source/ublexec.cc index bbd3f3f..c0ffc58 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include @@ -15,20 +14,12 @@ #include #include #include -#include #include #include #include #include -#include -#include -#include -#include -#include -#include #include -#include -#include +#include #include "ublexec.h" using namespace std; @@ -433,21 +424,22 @@ void MainWindow::start_cmd(){ //========================================= if (chbAnotherUser->get_active()){ if (geteuid()!=0){ - chbTerminal->set_active(true); + //chbTerminal->set_active(true); } if (rbPkexec->get_active()){ - + //string user_execute = cmbUser->get_active_text(); if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) { - str_variants_root = "pkexec env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; + + str_variants_root = "xhost SI:localuser:${USER}; pkexec --user ${USER} env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; //this->tmp_desktop(user_cmd); } else if (chbAnotherUser->get_active()){ - str_variants_root = "pkexec --user " + cmbUser->get_active_text() + " env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; + str_variants_root = "xhost SI:localuser: "+ cmbUser->get_active_text() +"; pkexec --user " + cmbUser->get_active_text() + " env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; } else{ - str_variants_root = "pkexec env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; + str_variants_root = "xhost SI:localuser:${USER}; pkexec --user ${USER} env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; //this->tmp_desktop(user_cmd); //user_cmd = "/tmp/" + user_cmd + ".desktop"; } @@ -506,18 +498,28 @@ void MainWindow::start_cmd(){ user_cmd = this->str_remove(user_cmd, str_cmd_terminal); user_cmd = this->str_remove(user_cmd, str_variants_root); user_cmd = this->str_remove(user_cmd, str_nice_cmd); + string str_del = "xterm -e"; + user_cmd = this->str_remove(user_cmd, str_del); + str_del = "pkexec --user superadmin env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY"; + user_cmd = this->str_remove(user_cmd, str_del); string amp = " &"; user_cmd = this->str_remove(user_cmd, amp); cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + user_cmd; } txtCmd->set_text(cmd); - cmd = cmd + " &"; - system(cmd.c_str()); + cmd = "nohup " + cmd + " > /dev/null 2>&1"; + //cmd = "bash -c \" " + cmd + " \" &"; + //system(cmd.c_str()); + std::thread t(&me_thread, cmd); + t.detach(); path_file_name = ""; path_file = ""; name_app = ""; } +void me_thread(string cmd){ + system(cmd.c_str()); +} void MainWindow::changed_user(){ Glib::ustring entry_user = cmbUser->get_active_text(); @@ -659,10 +661,6 @@ void MainWindow::pars_apps(){ } App.Name_desktop = file_name; App.Categories = split(str_Categories, ';'); - for ( const auto &text : App.Categories){ - set_categories.insert(text); - - } } list_app.push_back(App); diff --git a/source/ublexec.h b/source/ublexec.h index 7e79849..a06c417 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -1,41 +1,23 @@ -#include -#include + #include -#include #include -#include #include -#include #include #include -#include -#include -#include -#include -#include -#include -#include #include -#include #include #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include + using namespace std; extern string path_app; extern string app_name; extern string path_glade; extern string path_css; - +void me_thread(string cmd); class CmdArgParser : public Glib::OptionGroup { public: @@ -92,6 +74,7 @@ public: void select_System(); void icon_clear(); void set_icon_array(); + //static void me_thread(string cmd); void unselect_icon(Gtk::IconView *icon_entry); string str_remove(std::string& source, const std::string& to_remove); vector split(const std::string &s, char delim); diff --git a/ublexec.glade b/ublexec.glade index 05c68d8..f2edcde 100644 --- a/ublexec.glade +++ b/ublexec.glade @@ -527,7 +527,7 @@ specified priority - + diff --git a/ublexec_ru.po b/ublexec_ru.po index 9259859..926e51a 100644 --- a/ublexec_ru.po +++ b/ublexec_ru.po @@ -52,7 +52,7 @@ msgid "Team" msgstr "Команда" msgid "Run in the terminal emulator" -msgstr "Выполнить в эмуляторе терминале" +msgstr "Выполнить в эмуляторе терминала" msgid "Command Line" msgstr "Командная строка"