cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject [34/50] [abbrv] git commit: updated refs/heads/master to b61733d
Date Mon, 08 Dec 2014 10:09:22 GMT
CLOUDSTACK-5241: Remove Rot13 cipher


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/feeafa76
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/feeafa76
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/feeafa76

Branch: refs/heads/master
Commit: feeafa76a406280c08d2ae5e59919d02a2e8f135
Parents: ab16011
Author: Sheng Yang <sheng.yang@citrix.com>
Authored: Wed Dec 3 19:30:31 2014 -0800
Committer: Sheng Yang <sheng.yang@citrix.com>
Committed: Wed Dec 3 19:30:31 2014 -0800

----------------------------------------------------------------------
 .../network/element/CloudZonesNetworkElement.java |  4 +---
 .../VirtualNetworkApplianceManagerImpl.java       |  4 +---
 .../debian/config/opt/cloud/bin/savepassword.sh   |  4 +---
 utils/src/com/cloud/utils/PasswordGenerator.java  | 18 ------------------
 .../com/cloud/utils/PasswordGeneratorTest.java    | 15 ---------------
 5 files changed, 3 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/feeafa76/server/src/com/cloud/network/element/CloudZonesNetworkElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/CloudZonesNetworkElement.java b/server/src/com/cloud/network/element/CloudZonesNetworkElement.java
index 64a8cec..c748991 100644
--- a/server/src/com/cloud/network/element/CloudZonesNetworkElement.java
+++ b/server/src/com/cloud/network/element/CloudZonesNetworkElement.java
@@ -50,7 +50,6 @@ import com.cloud.network.PhysicalNetworkServiceProvider;
 import com.cloud.network.dao.NetworkDao;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.service.dao.ServiceOfferingDao;
-import com.cloud.utils.PasswordGenerator;
 import com.cloud.utils.component.AdapterBase;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
@@ -215,8 +214,7 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
 
             Commands cmds = new Commands(Command.OnError.Continue);
             if (password != null && nic.isDefaultNic()) {
-                final String encodedPassword = PasswordGenerator.rot13(password);
-                SavePasswordCommand cmd = new SavePasswordCommand(encodedPassword, nic.getIp4Address(),
uservm.getHostName(), _networkMgr.getExecuteInSeqNtwkElmtCmd());
+                SavePasswordCommand cmd = new SavePasswordCommand(password, nic.getIp4Address(),
uservm.getHostName(), _networkMgr.getExecuteInSeqNtwkElmtCmd());
                 cmds.addCommand("password", cmd);
             }
             String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(uservm.getServiceOfferingId()).getDisplayText();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/feeafa76/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index df8d179..f4e83ac 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -200,7 +200,6 @@ import com.cloud.user.dao.UserStatsLogDao;
 import com.cloud.uservm.UserVm;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
-import com.cloud.utils.PasswordGenerator;
 import com.cloud.utils.StringUtils;
 import com.cloud.utils.component.ComponentContext;
 import com.cloud.utils.component.ManagerBase;
@@ -3642,9 +3641,8 @@ VirtualMachineGuru, Listener, Configurable, StateListener<State,
VirtualMachine.
 
         // password should be set only on default network element
         if (password != null && nic.isDefaultNic()) {
-            final String encodedPassword = PasswordGenerator.rot13(password);
             final SavePasswordCommand cmd =
-                    new SavePasswordCommand(encodedPassword, nic.getIp4Address(), profile.getVirtualMachine().getHostName(),
_networkModel.getExecuteInSeqNtwkElmtCmd());
+                    new SavePasswordCommand(password, nic.getIp4Address(), profile.getVirtualMachine().getHostName(),
_networkModel.getExecuteInSeqNtwkElmtCmd());
             cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId()));
             cmd.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(nic.getNetworkId(),
router.getId()));
             cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/feeafa76/systemvm/patches/debian/config/opt/cloud/bin/savepassword.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/savepassword.sh b/systemvm/patches/debian/config/opt/cloud/bin/savepassword.sh
index 21fa09d..ab027b6 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/savepassword.sh
+++ b/systemvm/patches/debian/config/opt/cloud/bin/savepassword.sh
@@ -40,9 +40,7 @@ do
   case $OPTION in
   v)	VM_IP="$OPTARG"
 		;;
-  p)	
-		ENCODEDPASSWORD="$OPTARG"
-		PASSWORD=$(echo $ENCODEDPASSWORD | tr '[a-m][n-z][A-M][N-Z]' '[n-z][a-m][N-Z][A-M]')
+  p)    PASSWORD="$OPTARG"
 		;;
   ?)	echo "Incorrect usage"
                 unlock_exit 1 $lock $locked

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/feeafa76/utils/src/com/cloud/utils/PasswordGenerator.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/PasswordGenerator.java b/utils/src/com/cloud/utils/PasswordGenerator.java
index b6e4bed..2abf071 100644
--- a/utils/src/com/cloud/utils/PasswordGenerator.java
+++ b/utils/src/com/cloud/utils/PasswordGenerator.java
@@ -77,22 +77,4 @@ public class PasswordGenerator {
         return psk.toString();
 
     }
-
-    public static String rot13(final String password) {
-        final StringBuilder newPassword = new StringBuilder(password.length());
-
-        for (int i = 0; i < password.length(); i++) {
-            char c = password.charAt(i);
-
-            if ((c >= 'a' && c <= 'm') || ((c >= 'A' && c <=
'M'))) {
-                c += 13;
-            } else if ((c >= 'n' && c <= 'z') || (c >= 'N' && c
<= 'Z')) {
-                c -= 13;
-            }
-
-            newPassword.append(c);
-        }
-
-        return newPassword.toString();
-    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/feeafa76/utils/test/com/cloud/utils/PasswordGeneratorTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/PasswordGeneratorTest.java b/utils/test/com/cloud/utils/PasswordGeneratorTest.java
index 3e82d98..a4e2496 100644
--- a/utils/test/com/cloud/utils/PasswordGeneratorTest.java
+++ b/utils/test/com/cloud/utils/PasswordGeneratorTest.java
@@ -38,19 +38,4 @@ public class PasswordGeneratorTest {
         // and the third is a digit
         Assert.assertTrue(Character.isDigit(password.charAt(2)));
     }
-
-    @Test
-    public void rot13() {
-        // only letters are handled, numbers are unchanged
-        Assert.assertEquals("1234", PasswordGenerator.rot13("1234"));
-        // letters are moved by +-13 characters
-        Assert.assertEquals("nop", PasswordGenerator.rot13("abc"));
-        // the transformation it is reversable
-        Assert.assertEquals("abc", PasswordGenerator.rot13("nop"));
-        // which means for any string
-        Assert.assertEquals("abcdefghijklmnooprstuvxyzuv1234?", PasswordGenerator.rot13(PasswordGenerator.rot13("abcdefghijklmnooprstuvxyzuv1234?")));
-        // same for capital letters
-        Assert.assertEquals("ABC", PasswordGenerator.rot13("NOP"));
-        Assert.assertEquals("NOP", PasswordGenerator.rot13("ABC"));
-    }
 }


Mime
View raw message