Permalink
Browse files

Add ability to qsudo to show privileged command. Privileged actions w…

…ithout description may cause high security risc (user don't know what action will be executed
  • Loading branch information...
1 parent 256b802 commit 49e862764a7c81266ca5c5d23d72088be78ce369 @yurkis yurkis committed Aug 16, 2013
View
BIN src-qt4/qsudo/icons/arrow-down.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN src-qt4/qsudo/icons/arrow-up.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
15 src-qt4/qsudo/mainwindow.cpp
@@ -35,10 +35,20 @@ void MainWindow::ProgramInit()
connect(buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(slotButtonClicked(QAbstractButton *)));
connect(passwordLineEdit, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));
connect(passwordLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotPwdTextChanged(QString)));
+ connect(commandGroupBox, SIGNAL(clicked(bool)), this, SLOT(slotExpandCommandClicked(bool)));
QPushButton* btn= buttonBox->button(QDialogButtonBox::Ok);
if (btn)
btn->setEnabled(false);
+
+ // Set command text
+ commandLabel->setVisible(false);
+ QString commText;
+ for ( int i = 1; i< qApp->argc() ; i++)
+ {
+ commText+=qApp->argv()[i];
+ }
+ commandLabel->setText(commText);
}
void MainWindow::slotReturnPressed()
@@ -120,6 +130,11 @@ void MainWindow::slotPwdTextChanged(const QString &text)
btn->setEnabled(text.length()?true:false);
}
+void MainWindow::slotExpandCommandClicked(bool isChecked)
+{
+ commandLabel->setVisible(isChecked);
+}
+
void MainWindow::slotProcDone()
{
exit(sudoProc->exitCode());
View
1 src-qt4/qsudo/mainwindow.h
@@ -25,6 +25,7 @@ private slots:
void slotPrintStdErr();
void slotPrintStdOut();
void slotPwdTextChanged ( const QString & text );
+ void slotExpandCommandClicked(bool isChecked);
private:
View
82 src-qt4/qsudo/mainwindow.ui
@@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
- <width>305</width>
- <height>145</height>
+ <width>303</width>
+ <height>183</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="windowTitle">
<string>Requesting System Permissions</string>
</property>
@@ -108,6 +114,78 @@
</property>
</widget>
</item>
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="commandGroupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QGroupBox::indicator:unchecked{
+image: url(:icons/arrow-down.png);
+}
+QGroupBox::indicator:checked{
+image: url(:icons/arrow-up.png);
+}
+QGroupBox::title{
+spacing: 1px;
+}</string>
+ </property>
+ <property name="title">
+ <string>Toggle command details</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetMinimumSize</enum>
+ </property>
+ <property name="leftMargin">
+ <number>6</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="commandLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
</layout>
</widget>
</widget>
View
2 src-qt4/qsudo/qsudo.qrc
@@ -1,5 +1,7 @@
<RCC>
<qresource prefix="/">
<file>lock.png</file>
+ <file>icons/arrow-down.png</file>
+ <file>icons/arrow-up.png</file>
</qresource>
</RCC>

0 comments on commit 49e8627

Please sign in to comment.