From 6e3d21e81d42f1e702713008161fda8fd0f98e8d Mon Sep 17 00:00:00 2001
From: adrien <adrien.waksberg@believedigital.com>
Date: Fri, 20 Sep 2013 12:27:08 +0200
Subject: [PATCH] fix bug with special char in password, and if the port is nil

---
 lib/CliSSH.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/CliSSH.rb b/lib/CliSSH.rb
index 4f6cd14..41a83aa 100644
--- a/lib/CliSSH.rb
+++ b/lib/CliSSH.rb
@@ -22,7 +22,7 @@ class CliSSH < Cli
 
 				passwd = r[MPW::PASSWORD]
 
-				if port.empty?
+				if port.nil? || port.empty?
 					port = 22
 				end
 
@@ -30,7 +30,7 @@ class CliSSH < Cli
 				if passwd.empty?
 					system("ssh #{login}@#{server} -p #{port}")
 				else
-					system("sshpass -p #{passwd} ssh #{login}@#{server} -p #{port}")
+					system("sshpass -p '#{passwd}' ssh #{login}@#{server} -p #{port}")
 				end
 			end