Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-2329

Incorrect handling of commandline options in ssl.cpp example

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • proton-c-0.34.0
    • examples
    • None

    Description

      I've prepared the following PR for this: https://github.com/apache/qpid-proton/pull/291

      This Jira Ticket shall provide background infos, concerning this.

       

      The ssl.cpp example handles command line arguments in an incorrect way.

      The argument passed to '-c' options must not end with '/' (as some shells automatically append when pressing <tab> to expand the directory name), else it will fall back to 'ssl-certs/'

       

      Below I'm assuming build artefacts in 'build/' subdirectory, eg.

          mkdir build && cd build && cmake .. && make && cd ../cpp/examples

      Examples of the wrong behariour

          $ ../../build/cpp/examples/ssl -c newdir/
          Inbound server connection connected via SSL. Protocol: TLSv1/SSLv3
          Outgoing client connection connected via SSL. Server certificate identity CN=test_server
          Hello World!

      Expected behaviour would be to pick 'tserver','tclient' certificate files from directory 'newdir'

       

      I don't provide correct files in the 'newdir', just to demonstrate, that the certificate files would be looked up in the 'newdir', so when omitting '/', the correct directory is picked:

          $ ../../build/cpp/examples/ssl -c newdir
          SSL certificate initialization failure for newdir/tserver-certificate.pem:newdir/tserver-private-key.pem:tserverpw

       

      Also, when passing an unknown command line option, the usage should be printed.

          ../../build/cpp/examples/ssl -j
          unknown option -j

           ../../build/cpp/examples/ssl -h

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            tkettenb Thomas Kettenbach
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: