mirror of https://github.com/apache/cloudstack.git
Fix to cloudAction with pem cert
This commit is contained in:
parent
b5d43dcbf9
commit
c8cc286658
|
|
@ -0,0 +1,13 @@
|
|||
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI';
|
||||
|
||||
DROP DATABASE IF EXISTS cloudbridge;
|
||||
CREATE DATABASE cloudbridge;
|
||||
|
||||
GRANT ALL ON cloudbridge.* to `cloud`@`localhost` identified by 'cloud';
|
||||
GRANT ALL ON cloudbridge.* to `cloud`@`%` identified by 'cloud';
|
||||
|
||||
GRANT process ON *.* TO `cloud`@`localhost`;
|
||||
GRANT process ON *.* TO `cloud`@`%`;
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
|
@ -104,8 +104,10 @@ public class S3FileSystemBucketAdapter implements S3BucketAdapter {
|
|||
while( (len = is.read(buffer)) > 0) {
|
||||
fos.write(buffer, 0, len);
|
||||
md5.update(buffer, 0, len);
|
||||
}
|
||||
return StringHelper.toHexStringLowerCase(md5.digest());
|
||||
|
||||
}
|
||||
//Convert MD4 digest to (lowercase) hex String
|
||||
return StringHelper.toHexString(md5.digest());
|
||||
|
||||
}
|
||||
catch(IOException e) {
|
||||
|
|
@ -180,6 +182,7 @@ public class S3FileSystemBucketAdapter implements S3BucketAdapter {
|
|||
}
|
||||
fos.close();
|
||||
return new Tuple<String, Long>(StringHelper.toHexString(md5.digest()), new Long(totalLength));
|
||||
//Create a tuple whose first element is the MD4 digest as a (lowercase) hex String
|
||||
}
|
||||
catch(IOException e) {
|
||||
logger.error("concatentateObjects unexpected exception " + e.getMessage(), e);
|
||||
|
|
|
|||
|
|
@ -119,6 +119,10 @@ public class S3RestServlet extends HttpServlet {
|
|||
setUserKeys(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cloudAction.equalsIgnoreCase( "SetCertificate" ))
|
||||
// At present a noop
|
||||
return;
|
||||
|
||||
if (cloudAction.equalsIgnoreCase( "CloudS3Version" )) {
|
||||
cloudS3Version(request, response);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package com.cloud.bridge.service.core.s3;
|
|||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* @author Kelven Yang
|
||||
* @author Kelven Yang, John Zucker
|
||||
*/
|
||||
public class S3PutObjectInlineResponse extends S3Response {
|
||||
protected String ETag;
|
||||
|
|
@ -31,11 +31,10 @@ public class S3PutObjectInlineResponse extends S3Response {
|
|||
uploadId = -1;
|
||||
}
|
||||
|
||||
|
||||
// add ETag header computed as Base64 MD5 whenever object is uploaded or updated
|
||||
// the Base64 is represented in lowercase
|
||||
public String getETag() {
|
||||
return ETag.toLowerCase();
|
||||
return ETag;
|
||||
}
|
||||
|
||||
public void setETag(String eTag) {
|
||||
|
|
|
|||
|
|
@ -21,25 +21,29 @@ import java.io.InputStream;
|
|||
/**
|
||||
* @author Kelven, John Zucker
|
||||
* Provide converters for regexp (case independent tokens)
|
||||
* Also provide upper case (default) or lower case converters for hex
|
||||
* Also provide upper case or lower case (default) converters for byte array b[] to hex String
|
||||
*/
|
||||
public class StringHelper {
|
||||
public static final String EMPTY_STRING = "";
|
||||
|
||||
private static final char[] hexChars = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
|
||||
private static final char[] hexCharsUpperCase = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
|
||||
|
||||
private static final char[] hexCharsLowerCase = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
|
||||
|
||||
public static String toHexString(byte[] b) {
|
||||
private static final char[] hexCharsLowerCase = { '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f' };
|
||||
|
||||
/* Convert byte array b[] into an uppercase hex string
|
||||
*/
|
||||
public static String toHexStringUpperCase(byte[] b) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < b.length; i++) {
|
||||
sb.append(hexChars[ (int)(((int)b[i] >> 4) & 0x0f)]);
|
||||
sb.append(hexChars[ (int)(((int)b[i]) & 0x0f)]);
|
||||
sb.append(hexCharsUpperCase[ (int)(((int)b[i] >> 4) & 0x0f)]);
|
||||
sb.append(hexCharsUpperCase[ (int)(((int)b[i]) & 0x0f)]);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String toHexStringLowerCase(byte[] b) {
|
||||
/* Convert byte array b[] into a lowercase (default) hex string
|
||||
*/
|
||||
public static String toHexString(byte[] b) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < b.length; i++) {
|
||||
sb.append(hexCharsLowerCase[ (int)(((int)b[i] >> 4) & 0x0f)]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue