Browse Source

Merge branch 'master' of https://git.tk.informatik.tu-darmstadt.de/scm-ssi-hostage-v3

Alexander Brakowski 9 years ago
parent
commit
38fee7e3e4
1 changed files with 16 additions and 0 deletions
  1. 16 0
      src/de/tudarmstadt/informatik/hostage/Listener.java

+ 16 - 0
src/de/tudarmstadt/informatik/hostage/Listener.java

@@ -24,6 +24,7 @@ import de.tudarmstadt.informatik.hostage.net.MyServerSocketFactory;
 import de.tudarmstadt.informatik.hostage.protocol.SMB;
 import de.tudarmstadt.informatik.hostage.protocol.Protocol;
 import de.tudarmstadt.informatik.hostage.protocol.SSLProtocol;
+import de.tudarmstadt.informatik.hostage.system.Device;
 
 /**
  * Protocol listener class:<br>
@@ -147,6 +148,21 @@ public class Listener implements Runnable {
 	 */
 	public boolean start() {
         if(protocol.toString().equals("SMB")){
+			if (!Device.isPortRedirectionAvailable()) {
+				/*
+				We can only use SMB with iptables since we can't transfer UDP sockets using domain sockets (port binder).
+				TODO: somehow communicate this limitation to the user. Right now SMB will simply just fail.
+				 */
+				return false;
+			}
+			if (Device.isPorthackInstalled()) {
+				/*
+				Currently the port binder is the preferred method for creating sockets.
+				If it installed, we can't use iptables to create UDP sockets.
+				@see MyServerSocketFactory
+				 */
+				return false;
+			}
             ((SMB) protocol).initialize(this);
         }