Добавлена возможность запускать программы с pkexec

pull/1/head
Igor Belitskiy 3 years ago
parent 951a120f3f
commit 924b5adbd7

@ -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

@ -7,9 +7,12 @@ pkg_check_modules(GTK REQUIRED gtkmm-3.0)
include_directories(${GTK_INCLUDE_DIRS}) include_directories(${GTK_INCLUDE_DIRS})
link_directories(${GTK_LIBRARY_DIRS}) link_directories(${GTK_LIBRARY_DIRS})
add_definitions(${GTK_CFLAGS_OTHER}) 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 -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 set(SOURCE_FILES
main.cc main.cc
@ -21,5 +24,5 @@ set(LIBRARIES
pthread) pthread)
add_executable(ublexec ${SOURCE_FILES}) add_executable(ublexec ${SOURCE_FILES})
target_link_libraries(ublexec ${LIBRARIES}) target_link_libraries(ublexec ${LIBRARIES} Threads::Threads)
install(TARGETS ublexec DESTINATION bin) install(TARGETS ublexec DESTINATION bin)

@ -1,32 +1,15 @@
#include <iostream>
#include <cstddef> #include <cstddef>
#include <cstdlib> #include <cstdlib>
#include <iostream>
#include <memory>
#include <gtkmm.h> #include <gtkmm.h>
#include <ostream>
#include <string> #include <string>
#include <ctime>
#include <vector> #include <vector>
#include <map> #include <map>
#include <fstream>
#include <libintl.h>
#include <locale.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <gtkmm/plug.h>
#include <gtkmm/stock.h> #include <gtkmm/stock.h>
#include <gtkmm/window.h> #include <gtkmm/window.h>
#include <string>
#include <gtkmm.h>
#include <gtkmm/plug.h> #include <gtkmm/plug.h>
#include <string> #include <locale.h>
#include <iostream>
#include <iostream>
#include <sys/types.h>
#include <pwd.h>
#include <set>
#include "ublexec.h" #include "ublexec.h"

@ -4,7 +4,6 @@
#include <memory> #include <memory>
#include <gtkmm.h> #include <gtkmm.h>
#include <ostream> #include <ostream>
#include <string>
#include <ctime> #include <ctime>
#include <vector> #include <vector>
#include <map> #include <map>
@ -15,20 +14,12 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <stdio.h>
#include <gtkmm/plug.h> #include <gtkmm/plug.h>
#include <gtkmm/stock.h> #include <gtkmm/stock.h>
#include <gtkmm/window.h> #include <gtkmm/window.h>
#include <string> #include <string>
#include <gtkmm.h>
#include <gtkmm/plug.h>
#include <string>
#include <iostream>
#include <iostream>
#include <sys/types.h>
#include <pwd.h> #include <pwd.h>
#include <set> #include <thread>
#include <regex>
#include "ublexec.h" #include "ublexec.h"
using namespace std; using namespace std;
@ -433,21 +424,22 @@ void MainWindow::start_cmd(){
//========================================= //=========================================
if (chbAnotherUser->get_active()){ if (chbAnotherUser->get_active()){
if (geteuid()!=0){ if (geteuid()!=0){
chbTerminal->set_active(true); //chbTerminal->set_active(true);
} }
if (rbPkexec->get_active()){ if (rbPkexec->get_active()){
//string user_execute = cmbUser->get_active_text();
if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) { 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); //this->tmp_desktop(user_cmd);
} }
else if (chbAnotherUser->get_active()){ 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{ 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); //this->tmp_desktop(user_cmd);
//user_cmd = "/tmp/" + user_cmd + ".desktop"; //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_cmd_terminal);
user_cmd = this->str_remove(user_cmd, str_variants_root); user_cmd = this->str_remove(user_cmd, str_variants_root);
user_cmd = this->str_remove(user_cmd, str_nice_cmd); 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 = " &"; string amp = " &";
user_cmd = this->str_remove(user_cmd, amp); user_cmd = this->str_remove(user_cmd, amp);
cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + user_cmd; cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + user_cmd;
} }
txtCmd->set_text(cmd); txtCmd->set_text(cmd);
cmd = cmd + " &"; cmd = "nohup " + cmd + " > /dev/null 2>&1";
system(cmd.c_str()); //cmd = "bash -c \" " + cmd + " \" &";
//system(cmd.c_str());
std::thread t(&me_thread, cmd);
t.detach();
path_file_name = ""; path_file_name = "";
path_file = ""; path_file = "";
name_app = ""; name_app = "";
} }
void me_thread(string cmd){
system(cmd.c_str());
}
void MainWindow::changed_user(){ void MainWindow::changed_user(){
Glib::ustring entry_user = cmbUser->get_active_text(); Glib::ustring entry_user = cmbUser->get_active_text();
@ -659,10 +661,6 @@ void MainWindow::pars_apps(){
} }
App.Name_desktop = file_name; App.Name_desktop = file_name;
App.Categories = split(str_Categories, ';'); App.Categories = split(str_Categories, ';');
for ( const auto &text : App.Categories){
set_categories.insert(text);
}
} }
list_app.push_back(App); list_app.push_back(App);

@ -1,41 +1,23 @@
#include <cstddef>
#include <cstdlib>
#include <iostream> #include <iostream>
#include <memory>
#include <gtkmm.h> #include <gtkmm.h>
#include <ostream>
#include <string> #include <string>
#include <ctime>
#include <vector> #include <vector>
#include <map> #include <map>
#include <fstream>
#include <filesystem>
#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h> #include <stdio.h>
#include <gtkmm/plug.h>
#include <gtkmm/stock.h> #include <gtkmm/stock.h>
#include <gtkmm/window.h> #include <gtkmm/window.h>
#include <string>
#include <gtkmm.h>
#include <gtkmm/plug.h> #include <gtkmm/plug.h>
#include <string> #include <locale.h>
#include <iostream> #include <libintl.h>
#include <filesystem>
#include <iostream>
#include <sys/types.h>
#include <pwd.h>
#include <set>
using namespace std; using namespace std;
extern string path_app; extern string path_app;
extern string app_name; extern string app_name;
extern string path_glade; extern string path_glade;
extern string path_css; extern string path_css;
void me_thread(string cmd);
class CmdArgParser : public Glib::OptionGroup class CmdArgParser : public Glib::OptionGroup
{ {
public: public:
@ -92,6 +74,7 @@ public:
void select_System(); void select_System();
void icon_clear(); void icon_clear();
void set_icon_array(); void set_icon_array();
//static void me_thread(string cmd);
void unselect_icon(Gtk::IconView *icon_entry); void unselect_icon(Gtk::IconView *icon_entry);
string str_remove(std::string& source, const std::string& to_remove); string str_remove(std::string& source, const std::string& to_remove);
vector<std::string> split(const std::string &s, char delim); vector<std::string> split(const std::string &s, char delim);

@ -527,7 +527,7 @@ specified priority</property>
<attributes> <attributes>
<attribute name="font-desc" value="URW Gothic Semi-Bold 10"/> <attribute name="font-desc" value="URW Gothic Semi-Bold 10"/>
<attribute name="foreground" value="#000023233232"/> <attribute name="foreground" value="#000023233232"/>
<attribute name="size" value="14336"/> <attribute name="size" value="15360"/>
</attributes> </attributes>
</object> </object>
<packing> <packing>

@ -52,7 +52,7 @@ msgid "Team"
msgstr "Команда" msgstr "Команда"
msgid "Run in the terminal emulator" msgid "Run in the terminal emulator"
msgstr "Выполнить в эмуляторе терминале" msgstr "Выполнить в эмуляторе терминала"
msgid "Command Line" msgid "Command Line"
msgstr "Командная строка" msgstr "Командная строка"

Loading…
Cancel
Save