Skip to content

Commit 0ecc9f7

Browse files
anshulgangwardevdeep
authored andcommitted
CLOUDSTACK-7234: stop sending smb credentials to Hyper-v agent
1 parent 97f5281 commit 0ecc9f7

4 files changed

Lines changed: 88 additions & 261 deletions

File tree

engine/schema/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -129,36 +129,36 @@ public StoragePoolStatus getStatus() {
129129
}
130130

131131
public StoragePoolVO() {
132-
this.status = StoragePoolStatus.Initial;
132+
status = StoragePoolStatus.Initial;
133133
}
134134

135135
public StoragePoolVO(long poolId, String name, String uuid, StoragePoolType type, long dataCenterId, Long podId, long availableBytes, long capacityBytes,
136136
String hostAddress, int port, String hostPath) {
137137
this.name = name;
138-
this.id = poolId;
138+
id = poolId;
139139
this.uuid = uuid;
140-
this.poolType = type;
140+
poolType = type;
141141
this.dataCenterId = dataCenterId;
142-
this.usedBytes = availableBytes;
142+
usedBytes = availableBytes;
143143
this.capacityBytes = capacityBytes;
144144
this.hostAddress = hostAddress;
145145
this.port = port;
146146
this.podId = podId;
147-
this.setStatus(StoragePoolStatus.Initial);
148-
this.setPath(hostPath);
147+
setStatus(StoragePoolStatus.Initial);
148+
setPath(hostPath);
149149
}
150150

151151
public StoragePoolVO(StoragePoolVO that) {
152152
this(that.id, that.name, that.uuid, that.poolType, that.dataCenterId, that.podId, that.usedBytes, that.capacityBytes, that.hostAddress, that.port, that.path);
153153
}
154154

155155
public StoragePoolVO(StoragePoolType type, String hostAddress, int port, String path) {
156-
this.poolType = type;
156+
poolType = type;
157157
this.hostAddress = hostAddress;
158158
this.port = port;
159-
this.setStatus(StoragePoolStatus.Initial);
160-
this.uuid = UUID.randomUUID().toString();
161-
this.setPath(path);
159+
setStatus(StoragePoolStatus.Initial);
160+
uuid = UUID.randomUUID().toString();
161+
setPath(path);
162162
}
163163

164164
@Override
@@ -177,7 +177,7 @@ public StoragePoolType getPoolType() {
177177
}
178178

179179
public void setPoolType(StoragePoolType protocol) {
180-
this.poolType = protocol;
180+
poolType = protocol;
181181
}
182182

183183
@Override
@@ -258,14 +258,17 @@ public String getHostAddress() {
258258
}
259259

260260
public void setHostAddress(String host) {
261-
this.hostAddress = host;
261+
hostAddress = host;
262262
}
263263

264264
@Override
265265
public String getPath() {
266266
String updatedPath = path;
267-
if (this.poolType == StoragePoolType.SMB) {
267+
if (poolType == StoragePoolType.SMB) {
268268
updatedPath = UriUtils.getUpdateUri(updatedPath, false);
269+
if (updatedPath.contains("password") && updatedPath.contains("?")) {
270+
updatedPath = updatedPath.substring(0, updatedPath.indexOf('?'));
271+
}
269272
}
270273

271274
return updatedPath;
@@ -285,7 +288,7 @@ public void setId(long id) {
285288
}
286289

287290
public void setDataCenterId(long dcId) {
288-
this.dataCenterId = dcId;
291+
dataCenterId = dcId;
289292
}
290293

291294
public void setPodId(Long podId) {
@@ -327,9 +330,10 @@ public void setScope(ScopeType scope) {
327330
}
328331

329332
public ScopeType getScope() {
330-
return this.scope;
333+
return scope;
331334
}
332335

336+
@Override
333337
public HypervisorType getHypervisor() {
334338
return hypervisor;
335339
}
@@ -344,7 +348,7 @@ public boolean equals(Object obj) {
344348
return false;
345349
}
346350
StoragePoolVO that = (StoragePoolVO)obj;
347-
return this.id == that.id;
351+
return id == that.id;
348352
}
349353

350354
@Override
@@ -359,7 +363,7 @@ public String toString() {
359363

360364
@Override
361365
public boolean isShared() {
362-
return this.scope == ScopeType.HOST ? false : true;
366+
return scope == ScopeType.HOST ? false : true;
363367
}
364368

365369
@Override

plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the Apache Software Foundation (ASF) under one
1+
// Licensed to the Apache Software Foundation (ASF) under one
22
// or more contributor license agreements. See the NOTICE file
33
// distributed with this work for additional information
44
// regarding copyright ownership. The ASF licenses this file
@@ -69,52 +69,6 @@ public string UncPath
6969
}
7070
}
7171

72-
public string User
73-
{
74-
get
75-
{
76-
string user = null;
77-
if (uri != null)
78-
{
79-
var queryDictionary = System.Web.HttpUtility.ParseQueryString(uri.Query);
80-
user = System.Web.HttpUtility.UrlDecode(queryDictionary["user"]);
81-
}
82-
return user;
83-
}
84-
}
85-
86-
public string Password
87-
{
88-
get
89-
{
90-
string password = null;
91-
if (uri != null)
92-
{
93-
var queryDictionary = System.Web.HttpUtility.ParseQueryString(uri.Query);
94-
password = System.Web.HttpUtility.UrlDecode(queryDictionary["password"]);
95-
}
96-
return password;
97-
}
98-
}
99-
100-
public string Domain
101-
{
102-
get
103-
{
104-
string domain = null;
105-
if (uri != null)
106-
{
107-
var queryDictionary = System.Web.HttpUtility.ParseQueryString(uri.Query);
108-
if (queryDictionary["domain"] != null)
109-
{
110-
domain = System.Web.HttpUtility.UrlDecode(queryDictionary["domain"]);
111-
}
112-
else domain = uri.Host;
113-
}
114-
return domain;
115-
}
116-
}
117-
11872
public Boolean isLocal
11973
{
12074
get
@@ -457,36 +411,7 @@ public string UncPath
457411
return uncPath;
458412
}
459413
}
460-
public string User
461-
{
462-
get
463-
{
464-
var queryDictionary = System.Web.HttpUtility.ParseQueryString(uri.Query);
465-
return System.Web.HttpUtility.UrlDecode(queryDictionary["user"]);
466-
}
467-
}
468-
469-
public string Password
470-
{
471-
get
472-
{
473-
var queryDictionary = System.Web.HttpUtility.ParseQueryString(uri.Query);
474-
return System.Web.HttpUtility.UrlDecode(queryDictionary["password"]);
475-
}
476-
}
477414

478-
public string Domain
479-
{
480-
get
481-
{
482-
var queryDictionary = System.Web.HttpUtility.ParseQueryString(uri.Query);
483-
if (queryDictionary["domain"] != null)
484-
{
485-
return System.Web.HttpUtility.UrlDecode(queryDictionary["domain"]);
486-
}
487-
else return uri.Host;
488-
}
489-
}
490415
public static NFSTO ParseJson(dynamic json)
491416
{
492417
NFSTO result = null;

0 commit comments

Comments
 (0)