Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #23772 The create-file-user subcommand with passwordfile option isn't usable in embedded glassfish. #23773

Merged
merged 1 commit into from
Feb 2, 2022

Conversation

kosakak
Copy link
Contributor

@kosakak kosakak commented Jan 31, 2022

There is a bug in the process of getting the password value from the loaded password file.

In the process of create-file-user subcommand, CLIUtil.readPasswordFileOptions() is called in CommandExecutorImple.getParameters(). Since the second argument of this method is always true, keys of the map passwords have the prefix "AS_ADMIN_".

Map<String, String> passwords = CLIUtil.readPasswordFileOptions(pwfile, true);

For example, if the contents of the passward file is as follows, the key of the user password in the map passwords is "AS_ADMIN_USERPASSWORD".

AS_ADMIN_USERPASSWORD=mypassword

On the other hand, the variable pwdname, which is the key to get the user password from the map passwords, is "userpassword".
Therefore, passwords.get(pwdname) always returns null.

String pwdname = opt.getName();
String pwd = passwords.get(pwdname);
if (pwd != null) {
options.set(pwdname, pwd);
}

I think the second argument of CLIUtil.readPasswordFileOptions() should be false here. With this fix, keys of the map passwords are no longer prefixed with "AS_ADMIN_", and converted to lowercase. (If the password file is the above example, the key of the map passwords is "userpassword")

final String optionName = withPrefix ? entry
: entry.substring(Environment.getPrefix().length()).toLowerCase(Locale.ENGLISH);

Signed-off-by: kosakak kosaka.koki@fujitsu.com

…ile option isn't usable in embedded glassfish.

Signed-off-by: kosakak <kosaka.koki@fujitsu.com>
@glassfish-bot
Copy link
Contributor

Can one of the admins verify this patch?

@arjantijms arjantijms merged commit 3463ea0 into eclipse-ee4j:master Feb 2, 2022
@arjantijms arjantijms added this to the 6.2.5 milestone Feb 2, 2022
@arjantijms arjantijms added the bug Something isn't working label Feb 2, 2022
@kosakak kosakak deleted the issue_23772 branch February 5, 2022 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The create-file-user subcommand with passwordfile option isn't usable in embedded glassfish.
3 participants