You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/04/08 07:42:10 UTC

[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #4023: FIX: prevent empty sshkey name.

DaanHoogland commented on a change in pull request #4023: FIX: prevent empty sshkey name.
URL: https://github.com/apache/cloudstack/pull/4023#discussion_r405319313
 
 

 ##########
 File path: server/src/main/java/com/cloud/server/ManagementServerImpl.java
 ##########
 @@ -3711,6 +3711,11 @@ public SSHKeyPair createSSHKeyPair(final CreateSSHKeyPairCmd cmd) {
         final SSHKeysHelper keys = new SSHKeysHelper(sshKeyLength.value());
 
         final String name = cmd.getName();
+        
+        if (StringUtils.isBlank(name)) {
+            throw new InvalidParameterValueException("Please specify a valid name for the key pair. The key name can't be empty");
+        }
+        
 
 Review comment:
   can you move this validation above the validation that queries the DB above?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services