TPC-Council / HammerDB

HammerDB Database Load Testing and Benchmarking Tool
http://www.hammerdb.com
GNU General Public License v3.0
542 stars 115 forks source link

Add quotemeta function to escape special characters in passwords #658

Closed sm-shaw closed 5 months ago

sm-shaw commented 5 months ago

Add function based on perl quotemeta https://perldoc.perl.org/functions/quotemeta to escape special characters such as semicolon or brackets in passwords. Behaviour is optional with new generic setting of quote_passwords with default of true but if set to false then behaviour will be as previous.

Depending on the interface some additional manual quoting will be needed as follows:

  1. tcl interactive &GUI - no escaping needed
  2. Tcl script example: diset connection mssqls_pass =U#}r>Y^O~&RcE$:x5:DO[*y5<(a&AH9r2{
  3. Python interactive and scripts need to escape square bracket diset('connection','mssqls_pass','=U#}r>Y^O~&RcE$:x5:DO[*y5<(a&AH9r2{')

At this PR we do not plan to support the change for XML connect pool as this requires further work to escape the characters for the XML parser.

At the present time the change is designed to be as the least intrusive as possible, especially where special characters are not used in passwords and allow for users who to prefer wrapping passwords to still do so, whereas it will pick up obvious uses and prevent the scripts erroring due to special characters.

abondvt89 commented 5 months ago

Merging after reviews and approval of the three members of the code maintenance team.