Skip to content

Commit dfabe23

Browse files
karuturiAbhinandan Prateek
authored andcommitted
Revert "CLOUDSTACK-5435 enabled encryption for ldap params"
This reverts commit 24392c1. Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
1 parent 7584cf9 commit dfabe23

5 files changed

Lines changed: 15 additions & 19 deletions

File tree

‎plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPConfigCmd.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,18 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE
188188
} else {
189189
boolean result = this.updateLDAP();
190190
if (result) {
191-
LDAPConfigResponse lr = this.createLDAPConfigResponse(getHostname(), getPort().toString(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN());
191+
LDAPConfigResponse lr = this.createLDAPConfigResponse(getHostname(), getPort(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN());
192192
lr.setResponseName(getCommandName());
193193
this.setResponseObject(lr);
194194
}
195195
}
196196

197197
}
198198

199-
private LDAPConfigResponse createLDAPConfigResponse(String hostname, String port, Boolean useSSL, String queryFilter, String searchBase, String bindDN) {
199+
private LDAPConfigResponse createLDAPConfigResponse(String hostname, Integer port, Boolean useSSL, String queryFilter, String searchBase, String bindDN) {
200200
LDAPConfigResponse lr = new LDAPConfigResponse();
201201
lr.setHostname(hostname);
202-
lr.setPort(port);
202+
lr.setPort(port.toString());
203203
lr.setUseSSL(useSSL.toString());
204204
lr.setQueryFilter(queryFilter);
205205
lr.setBindDN(bindDN);

‎plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/response/LdapConfigurationResponse.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class LdapConfigurationResponse extends BaseResponse {
2828

2929
@SerializedName("port")
3030
@Param(description = "port")
31-
private String port;
31+
private int port;
3232

3333
public LdapConfigurationResponse() {
3434
super();
@@ -39,7 +39,7 @@ public LdapConfigurationResponse(final String hostname) {
3939
this.hostname = hostname;
4040
}
4141

42-
public LdapConfigurationResponse(final String hostname, final String port) {
42+
public LdapConfigurationResponse(final String hostname, final int port) {
4343
this.hostname = hostname;
4444
this.port = port;
4545
}
@@ -48,15 +48,15 @@ public String getHostname() {
4848
return hostname;
4949
}
5050

51-
public String getPort() {
51+
public int getPort() {
5252
return port;
5353
}
5454

5555
public void setHostname(final String hostname) {
5656
this.hostname = hostname;
5757
}
5858

59-
public void setPort(final String port) {
59+
public void setPort(final int port) {
6060
this.port = port;
6161
}
6262
}

‎plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapConfigurationVO.java‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,26 @@
2323
import javax.persistence.Id;
2424
import javax.persistence.Table;
2525

26-
import com.cloud.utils.db.Encrypt;
2726
import org.apache.cloudstack.api.InternalIdentity;
2827

2928
@Entity
3029
@Table(name = "ldap_configuration")
3130
public class LdapConfigurationVO implements InternalIdentity {
31+
@Column(name = "hostname")
32+
private String hostname;
3233

3334
@Id
3435
@GeneratedValue(strategy = GenerationType.IDENTITY)
3536
@Column(name = "id")
3637
private Long id;
3738

38-
@Encrypt
39-
@Column(name = "hostname")
40-
private String hostname;
41-
42-
@Encrypt
4339
@Column(name = "port")
44-
private String port;
40+
private int port;
4541

4642
public LdapConfigurationVO() {
4743
}
4844

49-
public LdapConfigurationVO(final String hostname, final String port) {
45+
public LdapConfigurationVO(final String hostname, final int port) {
5046
this.hostname = hostname;
5147
this.port = port;
5248
}
@@ -60,7 +56,7 @@ public long getId() {
6056
return id;
6157
}
6258

63-
public String getPort() {
59+
public int getPort() {
6460
return port;
6561
}
6662

‎plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapManagerImpl.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ public LdapConfigurationResponse addConfiguration(final String hostname, final i
6767
try {
6868
final String providerUrl = "ldap://" + hostname + ":" + port;
6969
_ldapContextFactory.createBindContext(providerUrl);
70-
configuration = new LdapConfigurationVO(hostname, Integer.toString(port));
70+
configuration = new LdapConfigurationVO(hostname, port);
7171
_ldapConfigurationDao.persist(configuration);
7272
s_logger.info("Added new ldap server with hostname: " + hostname);
73-
return new LdapConfigurationResponse(hostname, Integer.toString(port));
73+
return new LdapConfigurationResponse(hostname, port);
7474
} catch (final NamingException e) {
7575
throw new InvalidParameterValueException("Unable to bind to the given LDAP server");
7676
}

‎setup/db/db/schema-421to430.sql‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ INSERT INTO `cloud`.`configuration`(category, instance, component, name, value,
612612
CREATE TABLE `cloud`.`ldap_configuration` (
613613
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
614614
`hostname` varchar(255) NOT NULL COMMENT 'the hostname of the ldap server',
615-
`port` varchar(255) COMMENT 'port that the ldap server is listening on',
615+
`port` int(10) COMMENT 'port that the ldap server is listening on',
616616
PRIMARY KEY (`id`)
617617
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
618618

0 commit comments

Comments
 (0)