[RFC][Icedtea-web]: Make log files restricted to owner only.
Dr Andrew John Hughes
ahughes at redhat.com
Fri Jan 21 13:32:27 PST 2011
On 16:28 Fri 21 Jan , Andrew Su wrote:
> Hello,
>
> This ensures that the logs created are only accessible by the owner.
>
> Cheers,
> Andrew
Looks good.
> diff -r c5b209388b54 netx/net/sourceforge/jnlp/AppletLog.java
> --- a/netx/net/sourceforge/jnlp/AppletLog.java Thu Jan 20 14:54:27 2011 -0500
> +++ b/netx/net/sourceforge/jnlp/AppletLog.java Fri Jan 21 16:24:21 2011 -0500
> @@ -1,12 +1,15 @@
> package net.sourceforge.jnlp;
>
> import java.io.ByteArrayOutputStream;
> +import java.io.File;
> import java.io.PrintStream;
> import java.util.logging.FileHandler;
> import java.util.logging.Level;
> import java.util.logging.Logger;
> import java.util.logging.XMLFormatter;
>
> +import net.sourceforge.jnlp.util.FileUtils;
> +
> /**
> * This class writes log information to file.
> *
> @@ -20,8 +23,8 @@
> // If logging is enabled, we create logger.
> if (enableLogging) {
> String fn = icedteaLogDir + "plugin" + java.lang.System.currentTimeMillis() + ".log";
> - boolean append = false;
> - FileHandler fh = new FileHandler(fn, append);
> + FileUtils.createRestrictedFile(new File(fn), true);
> + FileHandler fh = new FileHandler(fn, false);
> fh.setFormatter(new XMLFormatter());
> String logClassName = AppletLog.class.getName();
> logger = Logger.getLogger(logClassName);
--
Andrew :)
Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)
Support Free Java!
Contribute to GNU Classpath and IcedTea
http://www.gnu.org/software/classpath
http://icedtea.classpath.org
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8
More information about the distro-pkg-dev
mailing list