Bug 1465078 - commandline options handling flaws
commandline options handling flaws
Status: NEW
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: iptables (Show other bugs)
7.4
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Rashid Khan
qe-baseos-daemons
:
Depends On:
Blocks: 1472751
  Show dependency treegraph
 
Reported: 2017-06-26 11:33 EDT by Karel Volný
Modified: 2017-08-14 11:05 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Karel Volný 2017-06-26 11:33:13 EDT
Description of problem:
When trying the new -W option, I have found some flaws handling the commandline.

Version-Release number of selected component (if applicable):
iptables-1.4.21-18.el7

How reproducible:
always

Steps to Reproduce:
1. iptables-restore -W
2. iptables-restore -W 0
3. iptables-restore --nonsense

Actual results:
1. # iptables-restore -W
dsfds
iptables-restore: line 1 failed

2. # iptables-restore -W 0
dssf
iptables-restore: line 1 failed

3. # iptables-restore --nonsense
iptables-restore: unrecognized option '--nonsense'
dsdsf
iptables-restore: line 1 failed

Expected results:
1. an error about missing value should be reported, program should exit without processing input

2. from man - "This option only works with -w." - so an error about missing "-w" should be reported and the program should exit without processing input

Plus I am not sure what sense makes setting this to 0, probably it should be rejected?

3. similar as above, the program should exit without processing input

While such behaviour isn't explicitly defined in manpage, it is a good practice not to continue processing when the options are wrong. Imagine e.g. if someone would like to use '--test' but made a typo, so that the option would be unrecognized and the undesired action performed ...

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