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 authored and merks committed Jul 2, 2024
1 parent 61f32bd commit f582f10
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bundles/org.eclipse.equinox.security/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.security;singleton:=true
Bundle-Version: 1.4.300.qualifier
Bundle-Version: 1.4.400.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.equinox.internal.security.auth.AuthPlugin
Expand Down
2 changes: 1 addition & 1 deletion bundles/org.eclipse.equinox.security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.security</artifactId>
<version>1.4.300-SNAPSHOT</version>
<version>1.4.400-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
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); //$NON-NLS-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 f582f10

Please sign in to comment.