Skip to content

Commit

Permalink
#652 Handle @user.home in -eclipse.password file retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
mPorhel committed Jul 2, 2024
1 parent 61f32bd commit b3ea2d2
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2018 IBM Corporation and others.
* Copyright (c) 2008, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -11,6 +11,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Christian Georgi (SAP SE) - Bug 460430: environment variable for secure store
* Maxime Porhel (Obeo) - #652: handle @user.home in -eclipse.password file retrieval
*******************************************************************************/
package org.eclipse.equinox.internal.security.storage;

Expand Down Expand Up @@ -170,7 +171,13 @@ private static Map<Object, Object> processPassword(Map<Object, Object> options,
if (arg == null || arg.isEmpty()) {
return options;
}
Path file = Path.of(arg);

String path = arg;
if (path.startsWith('@' + USER_HOME)) {
path = System.getProperty(USER_HOME, "") + path.substring(USER_HOME.length() + 1);
}

Path file = Path.of(path);
if (!Files.isReadable(file)) {
String msg = NLS.bind(SecAuthMessages.unableToReadPswdFile, arg);
AuthPlugin.getDefault().logError(msg, null);
Expand Down

0 comments on commit b3ea2d2

Please sign in to comment.