Skip to content

Commit

Permalink
Merge 5412705 into ed79643
Browse files Browse the repository at this point in the history
  • Loading branch information
sjamesr committed Jan 3, 2020
2 parents ed79643 + 5412705 commit 54d12d7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/java/au/com/southsky/jfreesane/SaneSession.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package au.com.southsky.jfreesane;

import com.google.common.base.Splitter;
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
import java.io.Closeable;
Expand Down Expand Up @@ -428,6 +427,15 @@ boolean authorize(String resource) throws IOException {
* @throws IOException
*/
private void writePassword(String resource, String password) throws IOException {
outputStream.write(password);

// The code below always prints passwords in the clear, because Splitter.on takes
// a separator string, not a regular expression. We can't fix it now due to a bug
// in old versions of saned, which Linux distributions like Ubuntu still ship.
// TODO(sjamesr): revive this code when Ubuntu gets a new sane-backends release,
// see https://bugs.launchpad.net/ubuntu/+source/sane-backends/+bug/1858051.
// TODO(sjamesr): when reviving, remove Guava dependency.
/*
List<String> resourceParts = Splitter.on("\\$MD5\\$").splitToList(resource);
if (resourceParts.size() == 1) {
// Write in clean
Expand All @@ -436,6 +444,7 @@ private void writePassword(String resource, String password) throws IOException
outputStream.write(
"$MD5$" + SanePasswordEncoder.derivePassword(resourceParts.get(1), password));
}
*/
}

SaneOutputStream getOutputStream() {
Expand Down

0 comments on commit 54d12d7

Please sign in to comment.