[PC-BSD Commits] r7338 - pcbsd/current/src-qt4/pc-pbigui

svn at pcbsd.org svn at pcbsd.org
Tue Aug 3 12:06:16 PDT 2010


Author: kris
Date: 2010-08-03 12:06:15 -0700 (Tue, 03 Aug 2010)
New Revision: 7338

Added:
   pcbsd/current/src-qt4/pc-pbigui/invalid-sign.png
   pcbsd/current/src-qt4/pc-pbigui/no-sign.png
   pcbsd/current/src-qt4/pc-pbigui/valid-sign.png
Modified:
   pcbsd/current/src-qt4/pc-pbigui/pbi.cpp
   pcbsd/current/src-qt4/pc-pbigui/pbi.h
   pcbsd/current/src-qt4/pc-pbigui/pbi.ui
   pcbsd/current/src-qt4/pc-pbigui/pc-pbigui.qrc
Log:

Added signature verification to pc-pbigui, will check a PBIs digital signature, report it to end user via icon / text, and warning dialog when necessary




Property changes on: pcbsd/current/src-qt4/pc-pbigui/invalid-sign.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream


Property changes on: pcbsd/current/src-qt4/pc-pbigui/no-sign.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: pcbsd/current/src-qt4/pc-pbigui/pbi.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-pbigui/pbi.cpp	2010-08-03 16:12:11 UTC (rev 7337)
+++ pcbsd/current/src-qt4/pc-pbigui/pbi.cpp	2010-08-03 19:06:15 UTC (rev 7338)
@@ -74,6 +74,9 @@
 
      // Check if we have any custom graphics for this PBI 
      checkCustomGraphics();
+  
+     // Check the digital signature on this file
+     checkSignature();
      
 }
 
@@ -251,7 +254,6 @@
       removePage(1); 
     else 
       LicenseTextEdit->moveCursor(QTextCursor::Start);
-
 }
 
 
@@ -422,3 +424,45 @@
         return line;
     
 }
+
+void PBI::checkSignature()
+{
+	// If sig is good, no changes needed
+	if ( ProgramSig == "Verified" )
+		return;
+
+	if ( ProgramSig == "Not Signed" ) {
+		labelSig->setText(tr("No digital signature"));
+		labelSig->setStyleSheet("color: rgb(255, 255, 255);");
+        	QPixmap pixmap;
+		pixmap.load(":/no-sign.png");
+        	labelSigPic->setPixmap(pixmap);
+		switch( QMessageBox::warning( this, tr("Warning!"), tr("This application has no digital signature. Installing applications from unknown sources can be dangerous. Continue with the install? "), tr("OK"), tr("Cancel"), 0, 0, 1 ) ) 
+    		{
+      			case 0: // The user clicked the OK button
+			break;
+
+			case 1: // The user clicked the cancel button
+         		exit(1);
+      			break;
+    		}
+		return;
+	}
+	if ( ProgramSig == "Bad" ) {
+		labelSig->setText(tr("Invalid digital signature"));
+		labelSig->setStyleSheet("color: rgb(255, 255, 255);");
+        	QPixmap pixmap;
+		pixmap.load(":/invalid-sign.png");
+        	labelSigPic->setPixmap(pixmap);
+		switch( QMessageBox::warning( this, tr("Warning!"), tr("This application has a bad or unknown digital signature. Installing applications from unknown sources can be dangerous. Continue with the install? "), tr("OK"), tr("Cancel"), 0, 0, 1 ) ) 
+    		{
+      			case 0: // The user clicked the OK button
+			break;
+
+			case 1: // The user clicked the cancel button
+         		exit(1);
+      			break;
+    		}
+		return;
+	}
+}

Modified: pcbsd/current/src-qt4/pc-pbigui/pbi.h
===================================================================
--- pcbsd/current/src-qt4/pc-pbigui/pbi.h	2010-08-03 16:12:11 UTC (rev 7337)
+++ pcbsd/current/src-qt4/pc-pbigui/pbi.h	2010-08-03 19:06:15 UTC (rev 7338)
@@ -26,15 +26,6 @@
 public slots:
     void ProgramInit( QString pbiFile );
     void PageChanged( int pageId );
-    void readSettingsSlot();
-    void AgreeButtonSlot();
-    void FinishedInstallSlot();
-    void setProgressSlot();
-    void runCommand( QString Command );
-    void startInstallSlot();
-    void reject();
-    void accept();
-
 private slots:
     void slotCheckExistingProgram();
 
@@ -63,7 +54,17 @@
 
     QPixmap topbanner;
     void uninstall();
+    void readSettingsSlot();
+    void AgreeButtonSlot();
+    void FinishedInstallSlot();
+    void setProgressSlot();
+    void runCommand( QString Command );
+    void startInstallSlot();
+    void reject();
+    void accept();
+    void checkSignature();
 
+
 signals:
 
 } ;

Modified: pcbsd/current/src-qt4/pc-pbigui/pbi.ui
===================================================================
--- pcbsd/current/src-qt4/pc-pbigui/pbi.ui	2010-08-03 16:12:11 UTC (rev 7337)
+++ pcbsd/current/src-qt4/pc-pbigui/pbi.ui	2010-08-03 19:06:15 UTC (rev 7338)
@@ -37,7 +37,7 @@
     <string notr="true">0</string>
    </attribute>
    <layout class="QGridLayout" name="gridLayout">
-    <item row="0" column="0" rowspan="3">
+    <item row="0" column="0" rowspan="4">
      <spacer name="spacer26">
       <property name="orientation">
        <enum>Qt::Horizontal</enum>
@@ -310,11 +310,60 @@
       <property name="sizeHint" stdset="0">
        <size>
         <width>308</width>
-        <height>38</height>
+        <height>10</height>
        </size>
       </property>
      </spacer>
     </item>
+    <item row="4" column="1">
+     <layout class="QHBoxLayout" name="horizontalLayout_2">
+      <item>
+       <widget class="QLabel" name="labelSigPic">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+        <property name="pixmap">
+         <pixmap resource="pc-pbigui.qrc">:/valid-sign.png</pixmap>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="labelSig">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">color: rgb(0, 85, 0);</string>
+        </property>
+        <property name="text">
+         <string>Valid Digital Signature</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+    <item row="5" column="1">
+     <spacer name="verticalSpacer_3">
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>448</width>
+        <height>5</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
    </layout>
   </widget>
   <widget class="QWizardPage" name="wizardPage">

Modified: pcbsd/current/src-qt4/pc-pbigui/pc-pbigui.qrc
===================================================================
--- pcbsd/current/src-qt4/pc-pbigui/pc-pbigui.qrc	2010-08-03 16:12:11 UTC (rev 7337)
+++ pcbsd/current/src-qt4/pc-pbigui/pc-pbigui.qrc	2010-08-03 19:06:15 UTC (rev 7338)
@@ -1,5 +1,8 @@
 <RCC>
   <qresource>
+    <file>invalid-sign.png</file>
+    <file>no-sign.png</file>
+    <file>valid-sign.png</file>
     <file>leftside.png</file>
     <file>header.png</file>
     <file>folder-blue.png</file>


Property changes on: pcbsd/current/src-qt4/pc-pbigui/valid-sign.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream



More information about the Commits mailing list