Skip to content
Browse files

merge conflict

  • Loading branch information...
1 parent 7c71961 commit 9a9b6abbe5b6655d7da3454838fb5a14ebf9afbf BuzzTroll committed Oct 19, 2010
View
10 authzdb/src/org/nimbus/authz/AuthzDBAdapter.java
@@ -25,7 +25,7 @@
private static final String GET_DATA_KEY = "select data_key from objects where id = ?";
private static final String CREATE_NEW_FILE = "insert into objects (name, owner_id, data_key, object_type, parent_id, creation_time) values(?, ?, ?, ?, ?, datetime('now'))";
private static final String SET_NEW_FILE_PERMS = "insert into object_acl (user_id, object_id, access_type_id) values(?, ?, ?)";
- private static final String UPDATE_FILE_INFO = "update objects set object_size=?, creation_time=datetime('now') where id = ?";
+ private static final String UPDATE_FILE_INFO = "update objects set object_size=?, md5sum=?, creation_time=datetime('now') where id = ?";
private static final String GET_USER_USAGE = "SELECT SUM(object_size) FROM objects where owner_id = ? and object_type = ?";
private static final String GET_USER_QUOTA = "SELECT quota from object_quota where user_id = ? and object_type = ?";
private static final String GET_FILE_SIZE = "SELECT object_size FROM objects WHERE id = ?";
@@ -696,7 +696,8 @@ public String getPermissions(
public void setFileSize(
int objectId,
- long size)
+ long size,
+ String md5string)
throws AuthzDBException
{
Connection c = null;
@@ -707,9 +708,8 @@ public void setFileSize(
c = getConnection();
pstmt = c.prepareStatement(UPDATE_FILE_INFO);
pstmt.setLong(1, size);
- //long ms = new java.util.Date().getTime();
- //pstmt.setDate(2, new Date(ms));
- pstmt.setInt(2, objectId);
+ pstmt.setString(2, md5string);
+ pstmt.setInt(3, objectId);
int rc = pstmt.executeUpdate();
if(rc != 1)
View
8 cumulus/cb/pycb/cbPosixBackend.py
@@ -121,6 +121,7 @@ def __init__(self, data_key, access="r", openIt=True):
self.hashValue = None
self.delete_on_close = False
self.md5er = hashlib.md5()
+ self.access = access
if not openIt:
return
@@ -144,8 +145,11 @@ def get_mod_time(self):
def get_md5(self):
if self.hashValue == None:
- v = str(self.md5er.hexdigest()).strip()
- return v
+ if self.access == 'r':
+ return None
+ else:
+ v = str(self.md5er.hexdigest()).strip()
+ return v
return self.hashValue
def get_data_key(self):
View
35 service/service/java/source/src/org/globus/workspace/sqlauthz/AuthzDecisionLogic.java
@@ -17,8 +17,10 @@
import org.nimbus.authz.AuthzDBException;
import org.springframework.core.io.Resource;
import javax.sql.DataSource;
-import java.io.File;
+import java.io.*;
import java.net.URI;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
/**
* Created by John Bresnahan
@@ -469,8 +471,37 @@ public void unpropagationFinished(
"avoid data loss (user '" + canUser + "').");
}
}
+ String md5string = "";
+ try
+ {
+ InputStream fis = new FileInputStream(f);
+ byte[] md5_buffer = new byte[1024];
+ MessageDigest md5er = MessageDigest.getInstance("MD5");
+
+ int rc = fis.read(md5_buffer);
+ while (rc > 0)
+ {
+ md5er.update(md5_buffer, 0, rc);
+ rc = fis.read(md5_buffer);
+ }
+ fis.close();
+ byte [] md5b = md5er.digest();
+ md5string = new String(md5b);
+ }
+ catch(FileNotFoundException fnf)
+ {
+ throw new WorkspaceException("Unpropagated file not found", fnf);
+ }
+ catch(NoSuchAlgorithmException nsa)
+ {
+ logger.error("There is no md5 digest", nsa);
+ }
+ catch(IOException ioe)
+ {
+ logger.error("Error dealing with the unpropgated file", ioe);
+ }
- authDB.setFileSize(fileIds[1], size);
+ authDB.setFileSize(fileIds[1], size, md5string);
}
else
{

0 comments on commit 9a9b6ab

Please sign in to comment.
Something went wrong with that request. Please try again.