Fix #23772 The create-file-user subcommand with passwordfile option isn't usable in embedded glassfish. #23773
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 inCommandExecutorImple.getParameters()
. Since the second argument of this method is always true, keys of the mappasswords
have the prefix "AS_ADMIN_".glassfish/nucleus/admin/cli/src/main/java/com/sun/enterprise/admin/cli/embeddable/CommandExecutorImpl.java
Line 101 in 4d6a8b5
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".On the other hand, the variable
pwdname
, which is the key to get the user password from the mappasswords
, is "userpassword".Therefore,
passwords.get(pwdname)
always returns null.glassfish/nucleus/admin/cli/src/main/java/com/sun/enterprise/admin/cli/embeddable/CommandExecutorImpl.java
Lines 104 to 108 in 4d6a8b5
I think the second argument of
CLIUtil.readPasswordFileOptions()
should be false here. With this fix, keys of the mappasswords
are no longer prefixed with "AS_ADMIN_", and converted to lowercase. (If the password file is the above example, the key of the mappasswords
is "userpassword")glassfish/nucleus/admin/cli/src/main/java/com/sun/enterprise/admin/cli/CLIUtil.java
Lines 57 to 58 in 4d6a8b5
Signed-off-by: kosakak kosaka.koki@fujitsu.com