resolvectl: reject --raw for regular lookups
--raw only affects ResolveRecord output. Without --type= or an
RFC4501 dns: URI, query takes the ResolveHostname/ResolveAddress
paths, where --raw was silently ignored.
Reproducer:
build/resolvectl --raw query localhost
Before:
The command exited successfully and printed regular text output,
such as:
localhost: 127.0.0.1
After:
The command fails before issuing a lookup:
--raw may only be combined with --type= or dns: URIs.
Follow-up for: 05ea7e87b6
This commit is contained in:
@@ -894,6 +894,10 @@ static int verb_query(int argc, char *argv[], uintptr_t _data, void *userdata) {
|
||||
int family, ifindex;
|
||||
union in_addr_union a;
|
||||
|
||||
if (arg_raw != RAW_NONE)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"--raw may only be combined with --type= or dns: URIs.");
|
||||
|
||||
r = in_addr_ifindex_from_string_auto(*p, &family, &a, &ifindex);
|
||||
if (r >= 0)
|
||||
RET_GATHER(ret, resolve_address(family, &a, ifindex));
|
||||
|
||||
Reference in New Issue
Block a user