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

pull/3/head
Igor Belitskiy 3 years ago
parent 94ebe29dc6
commit 5c82addd9e

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

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

@ -4,7 +4,6 @@
#include <memory>
#include <gtkmm.h>
#include <ostream>
#include <string>
#include <ctime>
#include <vector>
#include <map>
@ -15,20 +14,12 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <gtkmm/plug.h>
#include <gtkmm/stock.h>
#include <gtkmm/window.h>
#include <string>
#include <gtkmm.h>
#include <gtkmm/plug.h>
#include <string>
#include <iostream>
#include <iostream>
#include <sys/types.h>
#include <pwd.h>
#include <set>
#include <regex>
#include <thread>
#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);

@ -1,41 +1,23 @@
#include <cstddef>
#include <cstdlib>
#include <iostream>
#include <memory>
#include <gtkmm.h>
#include <ostream>
#include <string>
#include <ctime>
#include <vector>
#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 <gtkmm/plug.h>
#include <gtkmm/stock.h>
#include <gtkmm/window.h>
#include <string>
#include <gtkmm.h>
#include <gtkmm/plug.h>
#include <string>
#include <iostream>
#include <filesystem>
#include <iostream>
#include <sys/types.h>
#include <pwd.h>
#include <set>
#include <locale.h>
#include <libintl.h>
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<std::string> split(const std::string &s, char delim);

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

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

Loading…
Cancel
Save