Commit graph

5 commits

Author SHA1 Message Date
Lennart Poettering 7410616cd9 core: rework unit name validation and manipulation logic
A variety of changes:

- Make sure all our calls distuingish OOM from other errors if OOM is
  not the only error possible.

- Be much stricter when parsing escaped paths, do not accept trailing or
  leading escaped slashes.

- Change unit validation to take a bit mask for allowing plain names,
  instance names or template names or an combination thereof.

- Refuse manipulating invalid unit name
2015-05-05 15:06:42 -07:00
Zbigniew Jędrzejewski-Szmek 601185b43d Unify parse_argv style
getopt is usually good at printing out a nice error message when
commandline options are invalid. It distinguishes between an unknown
option and a known option with a missing arg. It is better to let it
do its job and not use opterr=0 unless we actually want to suppress
messages. So remove opterr=0 in the few places where it wasn't really
useful.

When an error in options is encountered, we should not print a lengthy
help() and overwhelm the user, when we know precisely what is wrong
with the commandline. In addition, since help() prints to stdout, it
should not be used except when requested with -h or --help.

Also, simplify things here and there.
2014-08-03 21:46:07 -04:00
Zbigniew Jędrzejewski-Szmek 91a81d93b5 escape: fix return code 2014-07-19 15:44:50 -04:00
Lennart Poettering a1948c7bfe escape: beef up new systemd-escape tool
Add various options for making it easy unescape, or mangle, or format as
template instance or append a suffix.
2014-07-07 22:23:42 +02:00
Michael Biebl b1a5a9989a add new systemd-escape tool 2014-07-07 22:23:42 +02:00