Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions java/sage/EncodingServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,24 @@ public void run()
//mySock.setTcpNoDelay(true);
outStream = new java.io.DataOutputStream(new java.io.BufferedOutputStream(mySock.getOutputStream()));
inStream = new java.io.DataInputStream(new java.io.BufferedInputStream(mySock.getInputStream()));
/* String pass = Sage.readLineBytes(inStream);
if (!pass.equalsIgnoreCase(Sage.get(ENCODING_SERVER_PASSWORD_MD5, "")))
{
outStream.write("INVALID_PASSWORD\r\n".getBytes(Sage.CHARSET));
outStream.flush();
}
else // valid password, accept the encoding command
*/
// outStream.write("OK\r\n".getBytes(Sage.CHARSET));
// outStream.flush();
String configuredPass = Sage.get(ENCODING_SERVER_PASSWORD_MD5, "");
if (configuredPass.length() > 0)
{
String pass = Sage.readLineBytes(inStream);
if (!pass.equalsIgnoreCase(configuredPass))
{
outStream.write("INVALID_PASSWORD\r\n".getBytes(Sage.BYTE_CHARSET));
outStream.flush();
if (Sage.DBG) System.out.println("EncodingServer auth failed, closing connection from " + mySock);
return;
}
else
{
outStream.write("OK\r\n".getBytes(Sage.BYTE_CHARSET));
outStream.flush();
if (Sage.DBG) System.out.println("EncodingServer auth succeeded from " + mySock);
}
}
while (true)
{
String str = Sage.readLineBytes(inStream);
Expand Down