Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-4664

Modify command-line processing of PasswordTool.java to allow automated testing

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • EAP_EWP 5.1.0_CR2
    • EAP_EWP 5.1.0_CR1
    • Security
    • None

      The class org.jboss.security.integration.password.PasswordTool is called from the command-line script $JBOSS_DIST/bin/password_tool.sh to perform command-line processing of user options when creating a security domain password file to be using in password masking (i.e. the @Password annotation included in bean deployment descriptors).

      QA wants to automate the testing of the password_tool.sh script, but the current implementation of PasswordTool.java prevents this.
      We want to be able to execute password_tool.sh, for example, as follows:

      > cd $DIST_JBOSS/bin
      > echo "0 password alongsaltstring 4 1 password/server.keystore jboss 5" | ./password_tool.sh

      This command string would perform option 0, followed by option 1, followed by option 5. By capturing and parsing the output, we can check if the shell script is performing correctly.

      The problem is that the line

      Scanner in = new Scanner(System.in) ;

      is placed within the command processing loop, and after the processing of the first command and its arguments, it re-initialises the input stream and loses the subsequent commands and their arguments. This prevents us from easily automating the testing of this shell script.

      Moving the command just outside the while loop fixes the problem.

      I'd like to ask that this line be moved so that we can automate the testing of this script.

        1. PasswordTool.patch
          0.1 kB
          Richard Achmatowicz

              mmoyses Marcus Moyses (Inactive)
              rachmato@redhat.com Richard Achmatowicz
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: