systemctl: systemctl show --property' needs verification of property (#3364)
authorSusant Sahani <ssahani@users.noreply.github.com>
Tue, 31 May 2016 16:20:25 +0000 (21:50 +0530)
committerLennart Poettering <lennart@poettering.net>
Tue, 31 May 2016 16:20:25 +0000 (18:20 +0200)
commite33a06a1eb7406ece8e35f6346ba0ea208c11cf1
treeba55af268b280d172802471bc8b323c62013ceba
parentb613907ea988e2994c68be686b5e92cdc7d3fb68
systemctl: systemctl show --property' needs verification of property (#3364)

systemctl --property doesn't validate if a requested property is valid or not,
and always returns with an exit code of 0, regardless of whether the requested
property exists or not.

How reproducible:

This works fine:

Id=multi-user.target
But put in a non-existing property:

Id=default.targets.service
Id=default.targets.service
0
[root@shou18lkvm8 ~]# systemctl show --property Id this.is.rubbish; echo $?
Id=this.is.rubbish.service
0

After:

sus@maximus bz-95593]$ ./systemctl show --property Id this.is.rubbish; echo $?
Can't display property this.is.rubbish. Unit this.is.rubbish.service does not
exist.
4

fixes #2295
src/systemctl/systemctl.c