Skip to content

Commit b2d5e37

Browse files
committed
CLOUDSTACK-5734: Fix the regression caused by adding hyper-V support
1 parent 343b6ac commit b2d5e37

2 files changed

Lines changed: 30 additions & 7 deletions

File tree

‎server/src/com/cloud/servlet/ConsoleProxyServlet.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,8 @@ static public Ternary<String, String, String> parseHostInfo(String hostInfo) {
334334
}
335335
} else if (hostInfo.startsWith("instanceId")) {
336336
host = hostInfo.substring(hostInfo.indexOf('=') + 1);
337+
} else {
338+
host = hostInfo;
337339
}
338340
} else {
339341
host = hostInfo;

‎services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyHttpHandlerHelper.java‎

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
public class ConsoleProxyHttpHandlerHelper {
2525
private static final Logger s_logger = Logger.getLogger(ConsoleProxyHttpHandlerHelper.class);
26-
26+
2727
public static Map<String, String> getQueryMap(String query) {
2828
String[] params = query.split("&");
2929
Map<String, String> map = new HashMap<String, String>();
@@ -43,26 +43,45 @@ public static Map<String, String> getQueryMap(String query) {
4343
s_logger.debug("Invalid paramemter in URL found. param: " + param);
4444
}
4545
}
46-
46+
4747
// This is a ugly solution for now. We will do encryption/decryption translation
4848
// here to make it transparent to rest of the code.
4949
if(map.get("token") != null) {
5050
ConsoleProxyPasswordBasedEncryptor encryptor = new ConsoleProxyPasswordBasedEncryptor(
5151
ConsoleProxy.getEncryptorPassword());
52-
52+
5353
ConsoleProxyClientParam param = encryptor.decryptObject(ConsoleProxyClientParam.class, map.get("token"));
5454

5555
// make sure we get information from token only
5656
guardUserInput(map);
5757
if(param != null) {
58-
if(param.getClientHostAddress() != null)
58+
if (param.getClientHostAddress() != null) {
59+
s_logger.debug("decode token. host: " + param.getClientHostAddress());
5960
map.put("host", param.getClientHostAddress());
60-
if(param.getClientHostPort() != 0)
61+
} else {
62+
s_logger.error("decode token. host info is not found!");
63+
}
64+
65+
if (param.getClientHostPort() != 0) {
66+
s_logger.debug("decode token. port: " + param.getClientHostPort());
6167
map.put("port", String.valueOf(param.getClientHostPort()));
62-
if(param.getClientTag() != null)
68+
} else {
69+
s_logger.error("decode token. port info is not found!");
70+
}
71+
72+
if (param.getClientTag() != null) {
73+
s_logger.debug("decode token. tag: " + param.getClientTag());
6374
map.put("tag", param.getClientTag());
64-
if(param.getClientHostPassword() != null)
75+
} else {
76+
s_logger.error("decode token. tag info is not found!");
77+
}
78+
79+
if (param.getClientHostPassword() != null) {
6580
map.put("sid", param.getClientHostPassword());
81+
} else {
82+
s_logger.error("decode token. sid info is not found!");
83+
}
84+
6685
if(param.getClientTunnelUrl() != null)
6786
map.put("consoleurl", param.getClientTunnelUrl());
6887
if(param.getClientTunnelSession() != null)
@@ -77,6 +96,8 @@ public static Map<String, String> getQueryMap(String query) {
7796
map.put("username", param.getUsername());
7897
if (param.getPassword() != null)
7998
map.put("password", param.getPassword());
99+
} else {
100+
s_logger.error("Unable to decode token");
80101
}
81102
} else {
82103
// we no longer accept information from parameter other than token

0 commit comments

Comments
 (0)