[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r4083: Add status event items for the DANGEROUS_SOCKS, SOCKS_UNKNOW (vidalia/trunk/src/vidalia/log)



Author: edmanm
Date: 2009-08-28 22:05:22 -0400 (Fri, 28 Aug 2009)
New Revision: 4083

Modified:
   vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp
   vidalia/trunk/src/vidalia/log/StatusEventWidget.h
Log:

Add status event items for the DANGEROUS_SOCKS, SOCKS_UNKNOWN_PROTOCOL,
and SOCKS_BAD_HOSTNAME events.


Modified: vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp
===================================================================
--- vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp	2009-08-29 00:46:31 UTC (rev 4082)
+++ vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp	2009-08-29 02:05:22 UTC (rev 4083)
@@ -48,6 +48,8 @@
           this, SLOT(clockSkewed(int, QString)));
   connect(tc, SIGNAL(dangerousPort(quint16, bool)),
           this, SLOT(dangerousPort(quint16, bool)));
+  connect(tc, SIGNAL(socksError(tc::SocksError, QString)),
+          this, SLOT(socksError(tc::SocksError, QString)));
 
   setItemDelegate(new StatusEventItemDelegate(this));
 }
@@ -276,3 +278,46 @@
   addNotification(icon, tr("Potentially Dangerous Connection!"), description);
 }
 
+void
+StatusEventWidget::socksError(tc::SocksError type, const QString &destination)
+{
+  QString title, description;
+  QPixmap icon = QPixmap(":/images/48x48/applications-internet.png");
+
+  if (type == tc::DangerousSocksTypeError) {
+    icon  = addBadgeToPixmap(icon,
+                             QPixmap(":/images/32x32/security-medium.png"));
+    title = tr("Potentially Dangerous Connection!");
+
+    description =
+      tr("One of your applications established a connection through Tor "
+         "to \"%1\" using a protocol that may leak information about your "
+         "destination. Please ensure you configure your applications to use "
+         "only SOCKS4a or SOCKS5 with remote hostname resolution.")
+                                                            .arg(destination);
+  } else if (type == tc::UnknownSocksProtocolError) {
+    icon = addBadgeToPixmap(icon,
+                            QPixmap(":/images/32x32/dialog-warning.png"));
+    title = tr("Unknown SOCKS Protocol");
+
+    description =
+      tr("One of your applications tried to establish a connection through "
+         "Tor using a protocol that Tor does not understand. Please ensure "
+         "you configure your applications to use only SOCKS4a or SOCKS5 with "
+         "remote hostname resolution.");
+  } else if (type == tc::BadSocksHostnameError) {
+    icon = addBadgeToPixmap(icon,
+                            QPixmap(":/images/32x32/dialog-warning.png"));
+
+    title = tr("Invalid Destination Hostname");
+    description =
+      tr("One of your applications tried to establish a connection through "
+         "Tor to \"%1\", which Tor does not recognize as a valid hostname. "
+         "Please check your application's configuration.").arg(destination);
+  } else {
+    return;
+  }
+
+  addNotification(icon, title, description);
+}
+

Modified: vidalia/trunk/src/vidalia/log/StatusEventWidget.h
===================================================================
--- vidalia/trunk/src/vidalia/log/StatusEventWidget.h	2009-08-29 00:46:31 UTC (rev 4082)
+++ vidalia/trunk/src/vidalia/log/StatusEventWidget.h	2009-08-29 02:05:22 UTC (rev 4083)
@@ -91,6 +91,14 @@
    */
   void dangerousPort(quint16 port, bool rejected);
 
+  /** Called when Tor detects a problem with a SOCKS connection from the
+   * user, such as a bad hostname, dangerous SOCKS protocol type, or a bad
+   * hostname. <b>type</b> indicates the type of error encountered and
+   * <b>destination</b> (if non-empty) specifies the attempted connection
+   * destination address or hostname.
+   */
+  void socksError(tc::SocksError type, const QString &destination);
+
 private:
   /** Adds a new status event notification item to the widget. The item will
    * be drawn using the specified <b>icon</b>, short event <b>title</b>,