summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2014-07-07 15:12:44 +0200
committerSimon Rettberg2014-07-07 15:12:44 +0200
commitdaa49262e30bfa3e10f411c18a2034ca48dcb3c2 (patch)
tree3108962e085b10e053d6a3c9e96692c683f75653 /src
parentAdd port to up- and download thingis (diff)
downloadmasterserver-daa49262e30bfa3e10f411c18a2034ca48dcb3c2.tar.gz
masterserver-daa49262e30bfa3e10f411c18a2034ca48dcb3c2.tar.xz
masterserver-daa49262e30bfa3e10f411c18a2034ca48dcb3c2.zip
more TODOs
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/openslx/imagemaster/server/ApiServer.java6
-rw-r--r--src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java3
-rw-r--r--src/main/java/org/openslx/imagemaster/serverconnection/UploadingImageInfos.java6
-rw-r--r--src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java6
-rw-r--r--src/main/java/org/openslx/imagemaster/util/AsymMessageVerifier.java15
5 files changed, 19 insertions, 17 deletions
diff --git a/src/main/java/org/openslx/imagemaster/server/ApiServer.java b/src/main/java/org/openslx/imagemaster/server/ApiServer.java
index 2d50160..ac1ab85 100644
--- a/src/main/java/org/openslx/imagemaster/server/ApiServer.java
+++ b/src/main/java/org/openslx/imagemaster/server/ApiServer.java
@@ -83,7 +83,7 @@ public class ApiServer
return new UserInfo( session.getUserId(), session.getFirstName(),
session.getLastName(), session.getEMail() );
}
-
+// TODO: Remove old code that's not needed anymore - that's what a vcs is for...
// /**
// * Request ftp credentials to upload a new image to the masterserver.
// *
@@ -154,7 +154,7 @@ public class ApiServer
public static String startServerAuthentication( String organization )
throws ServerAuthenticationException
{
- if ( organization == null || organization == "" ) {
+ if ( organization == null || organization.isEmpty() ) {
throw new ServerAuthenticationException( ServerAuthenticationError.INVALID_ORGANIZATION, "Empty organization" );
}
if ( DbSatellite.fromOrganization( organization ) == null ) {
@@ -173,7 +173,7 @@ public class ApiServer
* @throws TException
*/
public static ServerSessionData serverAuthenticate( String organization,
- ByteBuffer challengeResponse ) throws AuthenticationException,
+ ByteBuffer challengeResponse ) throws ServerAuthenticationException,
TException
{
if ( organization == null || challengeResponse == null ) {
diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java b/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java
index 1c12e70..61edf86 100644
--- a/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java
+++ b/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java
@@ -40,6 +40,7 @@ public class ConnectionHandler implements IncomingEvent
private static Map<String, ConnectionData> activeListeners = new HashMap<>();
private static List<Integer> possiblePorts = new LinkedList<>();
private static IncomingEvent eventHandler = new ConnectionHandler();
+ // TODO: There should only ever be one Listener instance in the whole application, running on a fixed port
static {
possiblePorts.add( 1234 );
@@ -138,7 +139,7 @@ public class ConnectionHandler implements IncomingEvent
// check if he was a downloading client
if ( activeListeners.get( token ).type == ConnectionData.UPLOADING ) {
- uploader.sendErrorCode( "You can not download, if you are uploading." );
+ uploader.sendErrorCode( "You can not download, if you are uploading." ); // TODO: Why not?
uploader.close();
return;
}
diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/UploadingImageInfos.java b/src/main/java/org/openslx/imagemaster/serverconnection/UploadingImageInfos.java
index bf851bc..71e0b46 100644
--- a/src/main/java/org/openslx/imagemaster/serverconnection/UploadingImageInfos.java
+++ b/src/main/java/org/openslx/imagemaster/serverconnection/UploadingImageInfos.java
@@ -24,6 +24,9 @@ public class UploadingImageInfos
* The missing blocks that need to be uploaded by the satellite.
*/
private List<Integer> missingBlocks;
+ // TODO: Do we have synchronization with the db yet? The list of missing blocks should
+ // be written to the DB periodically so when the server restarts we know which blocks are already
+ // complete...
/**
* The list of blocks that the satellite received last.
* (This could be used to tell the CRCChecker to check these blocks.
@@ -46,7 +49,8 @@ public class UploadingImageInfos
this.crcFilename = crcFilename;
}
- protected void removeBlock( int number )
+ protected void removeBlock!result ) {
+ /*( int number )
{
this.missingBlocks.remove( number );
}
diff --git a/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java b/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
index f82f77c..15bcd27 100644
--- a/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
+++ b/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
@@ -63,16 +63,14 @@ public class ServerAuthenticator
}
try {
- result = verifier.verifyMessage( bytes, authenticatingServers.get( organization ).getBytes() , "uni-freiburg.de" );
+ result = verifier.verifyMessage( bytes, authenticatingServers.get( organization ).getBytes() );
} catch ( Exception e ) {
log.error( "Error while verifying message", e );
throw new ServerAuthenticationException(ServerAuthenticationError.GENERIC_ERROR, "Could not verfiy key.");
}
if ( !result ) {
- /*
- * TODO: new error for invalid key
- */
+ // TODO: new error for invalid key
throw new ServerAuthenticationException(ServerAuthenticationError.GENERIC_ERROR, "Could not verfiy key.");
}
diff --git a/src/main/java/org/openslx/imagemaster/util/AsymMessageVerifier.java b/src/main/java/org/openslx/imagemaster/util/AsymMessageVerifier.java
index d1629b9..e7e6be4 100644
--- a/src/main/java/org/openslx/imagemaster/util/AsymMessageVerifier.java
+++ b/src/main/java/org/openslx/imagemaster/util/AsymMessageVerifier.java
@@ -43,11 +43,10 @@ public class AsymMessageVerifier
}
/**
- * Verify an encrypted message
- * @param signedMessage The signed message from hs/uni server
- * @param realMessage The message that was sent before
- * @param alias the alias of the certificate
- * @param password the password of the certificate
+ * Verify an encrypted message.
+ *
+ * @param messageDigest The signed message from hs/uni server
+ * @param expectedCleartext The message that was sent before
* @return Whether the message could be verfied or not
* @throws NoSuchAlgorithmException
* @throws InvalidKeyException
@@ -55,13 +54,13 @@ public class AsymMessageVerifier
* @throws UnrecoverableKeyException
* @throws KeyStoreException
*/
- public boolean verifyMessage( byte[] signedMessage, byte[] realMessage, String alias ) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, UnrecoverableKeyException, KeyStoreException
+ public boolean verifyMessage( byte[] messageDigest, byte[] expectedCleartext ) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, UnrecoverableKeyException, KeyStoreException
{
// verify message
Signature signature = Signature.getInstance( "SHA256WITHRSA" );
signature.initVerify( key );
- signature.update( realMessage );
- return signature.verify( signedMessage );
+ signature.update( expectedCleartext );
+ return signature.verify( messageDigest );
}
}