mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
bug 6367: registerISO, registerTemplate and createTemplate - can create non-ascii character names.
status 6367: resolved fixed
This commit is contained in:
parent
af502b1c4c
commit
70358ac153
@ -317,10 +317,6 @@ public class TemplateManagerImpl implements TemplateManager {
|
||||
{
|
||||
throw new InvalidParameterValueException("Template name should be less than 32 characters");
|
||||
}
|
||||
|
||||
if (!name.matches("^[\\p{Alnum} ._-]+")) {
|
||||
throw new InvalidParameterValueException("Only alphanumeric, dot, dashes and underscore characters allowed for the parameter 'name'");
|
||||
}
|
||||
|
||||
ImageFormat imgfmt = ImageFormat.valueOf(format.toUpperCase());
|
||||
if (imgfmt == null) {
|
||||
@ -1241,7 +1237,7 @@ public class TemplateManagerImpl implements TemplateManager {
|
||||
// FIXME: if template/ISO owner is null we probably need to throw some kind of exception
|
||||
|
||||
if (template != null) {
|
||||
Account templateOwner = _accountDao.findById(template.getId());
|
||||
Account templateOwner = _accountDao.findById(template.getAccountId());
|
||||
if ((templateOwner != null) && !_domainDao.isChildDomain(account.getDomainId(), templateOwner.getDomainId())) {
|
||||
throw new PermissionDeniedException(msg + ". Permission denied.");
|
||||
}
|
||||
|
||||
@ -2532,10 +2532,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, VirtualM
|
||||
if ((name == null) || (name.length() > 32)) {
|
||||
throw new InvalidParameterValueException("Template name cannot be null and should be less than 32 characters");
|
||||
}
|
||||
|
||||
if (!name.matches("^[\\p{Alnum} ._-]+")) {
|
||||
throw new InvalidParameterValueException("Only alphanumeric, space, dot, dashes and underscore characters allowed");
|
||||
}
|
||||
|
||||
String uniqueName = Long.valueOf((userId == null)?1:userId).toString() + Long.valueOf(volumeId).toString() + UUID.nameUUIDFromBytes(name.getBytes()).toString();
|
||||
|
||||
VMTemplateVO existingTemplate = _templateDao.findByTemplateNameAccountId(name, volume.getAccountId());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user