Bug 1412490 - virt-who can't handle special character like "&*$" when run it in CLI
Summary: virt-who can't handle special character like "&*$" when run it in CLI
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: virt-who
Version: 7.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: pre-dev-freeze
: ---
Assignee: Chris Snyder
QA Contact: Eko
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-12 07:22 UTC by Liushihui
Modified: 2019-10-28 07:20 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-11 20:31:13 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Liushihui 2017-01-12 07:22:11 UTC
Description of problem:
When run virt-who in CLI mode, it can't work when the options's value with "&*$"

Version-Release number of selected component (if applicable):
Satellite6.2.7
katello-3.0.0-15.el6sat.noarch
candlepin-0.9.54.15-1.el6.noarch
foreman-1.11.0.64-4.el6sat.noarch
virt-who-0.17-10.el6sat.noarch

How reproducible:
Always

Steps to Reproduce:
1. When run virt-who in CLI mode with --hyperv-password=Welcome&*$001, it will show error info as the following:
[root@hp-z220-05 virt-who.d]# virt-who --hyperv --hyperv-owner=Default_Organization --hyperv-env=Library --hyperv-server=10.73.5.227 --hyperv-username=administrator --hyperv-password=Welcome&*$001 -o -d
[1] 7443
-bash: *-bash01: command not found
[root@hp-z220-05 virt-who.d]# 2017-01-11 22:41:15,185 INFO: Using configuration "env/cmdline" ("hyperv" mode)
2017-01-11 22:41:15,186 INFO: Using reporter_id='hp-z220-05.qe.lab.eng.nay.redhat.com'
2017-01-11 22:41:15,248 ERROR: Virt backend 'env/cmdline' fails with error: Incorrect domain/username/password
2017-01-11 22:41:15,249 INFO: Waiting 60 seconds before retrying backend 'env/cmdline'

2. Click on "Ctrl + c" to end the session

3. Check virt-who's processes
[root@hp-z220-05 virt-who.d]# ps -ef|grep virt-who
root      7274  4751  1 22:37 pts/1    00:00:00 /usr/bin/python /usr/bin/virt-who --hyperv --hyperv-owner=Default_Organization --hyperv-env=Library --hyperv-server=10.73.5.227 --hyperv-username=administrator --hyperv-password=Welcome
root      7281  7274  0 22:37 pts/1    00:00:00 /usr/bin/python /usr/bin/virt-who --hyperv --hyperv-owner=Default_Organization --hyperv-env=Library --hyperv-server=10.73.5.227 --hyperv-username=administrator --hyperv-password=Welcome
root      7287  4751  0 22:38 pts/1    00:00:00 grep virt-who

4. If add quotes to --hyperv-password, it also failed to enter hyperv as "Incorrect domain/username/password"
[root@hp-z220-05 virt-who.d]# virt-who --hyperv --hyperv-owner=Default_Organization --hyperv-env=Library --hyperv-server=10.73.5.227 --hyperv-username=administrator --hyperv-password="Welcome&*$001" -o -d

Actual results:
1. As --hyperv-password with special characters as "&*$", it will failed to enter hyperv. Meanwhile, "ctrl+c" can't end debug mode.
2. Virt-who handle quotes to normal character

Expected results:
1. Although --hyperv-password with special characters as "&*$", it should enter hyperv successfully. Meanwhile, "ctrl+c" should end debug mode.
2. Virt-who should escape all characters in quotes:
for example: "Welcome&*$001" should escape to Welcome&*$001.

Additional info:
If configure password to non quotes (password=Welcome*&$001)or with quotes(password="Welcome*&$001"), virt-who can handle in to Welcome*&$001, virt-who can connect hyperv successfully.

Comment 4 Chris Snyder 2017-05-11 20:31:13 UTC
In current virt-who it appears that the password (given by running the command in the first comment) is read in as (less the quotes) "Welcome&*". This appears to be a result of bash attempting to replace $001 with the value of 001 from the environment (which is nothing).

If I run the command above with single quotes instead of double quotes, the password is read in to virt-who correctly.

Closing as not a bug (as there is nothing virt-who is doing wrong here)


Note You need to log in before you can comment on or make changes to this bug.