From b0254b5903aae25708c349860bc56ee6026a8218 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 26 Nov 2008 12:06:20 +0000
Subject: [PATCH] Fix for issue 3481 (password file generated by setup/quicksetup for LDAPS can have read access for everybody)
---
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index dfea9b8..0d47414 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -634,12 +634,15 @@
/**
* Creates a file on the specified path with the contents of the provided
- * String.
+ * String. The file is protected, so that 'others' have no access to it.
* @param path the path where the file will be created.
* @param content the String with the contents of the file.
* @throws IOException if something goes wrong.
+ * @throws InterruptedException if there is a problem changing the permissions
+ * of the file.
*/
- public static void createFile(String path, String content) throws IOException
+ public static void createProtectedFile(String path, String content)
+ throws IOException, InterruptedException
{
FileWriter file = new FileWriter(path);
PrintWriter out = new PrintWriter(file);
@@ -648,6 +651,11 @@
out.flush();
out.close();
+
+ if (!isWindows())
+ {
+ setPermissionsUnix(path, "640");
+ }
}
/**
--
Gitblit v1.10.0