mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
resolved: include Varlink error on inconsistent DNS-SD services in introspection data
Let's also rename the error slightly, since what happens here is that a
a valid service RR name is CNAME'd onto an invalid one. That's an
inconsistency on the server side, which we really should report as such.
Follow-up for: b48ab08732
This commit is contained in:
parent
a833dc9b35
commit
7fd18c93d8
@ -74,6 +74,7 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_common_errors[] = {
|
||||
SD_BUS_ERROR_MAP(BUS_ERROR_CNAME_LOOP, EDEADLK),
|
||||
SD_BUS_ERROR_MAP(BUS_ERROR_ABORTED, ECANCELED),
|
||||
SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_SERVICE, EUNATCH),
|
||||
SD_BUS_ERROR_MAP(BUS_ERROR_INCONSISTENT_SERVICE_RECORDS, EUNATCH),
|
||||
SD_BUS_ERROR_MAP(BUS_ERROR_DNSSEC_FAILED, EHOSTUNREACH),
|
||||
SD_BUS_ERROR_MAP(BUS_ERROR_NO_TRUST_ANCHOR, EHOSTUNREACH),
|
||||
SD_BUS_ERROR_MAP(BUS_ERROR_RR_TYPE_UNSUPPORTED, EOPNOTSUPP),
|
||||
|
@ -74,6 +74,7 @@
|
||||
#define BUS_ERROR_CNAME_LOOP "org.freedesktop.resolve1.CNameLoop"
|
||||
#define BUS_ERROR_ABORTED "org.freedesktop.resolve1.Aborted"
|
||||
#define BUS_ERROR_NO_SUCH_SERVICE "org.freedesktop.resolve1.NoSuchService"
|
||||
#define BUS_ERROR_INCONSISTENT_SERVICE_RECORDS "org.freedesktop.resolve1.InconsistentServiceRecords"
|
||||
#define BUS_ERROR_DNSSEC_FAILED "org.freedesktop.resolve1.DnssecFailed"
|
||||
#define BUS_ERROR_NO_TRUST_ANCHOR "org.freedesktop.resolve1.NoTrustAnchor"
|
||||
#define BUS_ERROR_RR_TYPE_UNSUPPORTED "org.freedesktop.resolve1.ResourceRecordTypeUnsupported"
|
||||
|
@ -1149,7 +1149,7 @@ static void resolve_service_all_complete(DnsQuery *query) {
|
||||
goto finish;
|
||||
|
||||
if (isempty(type)) {
|
||||
r = reply_method_errorf(q, BUS_ERROR_NO_SUCH_SERVICE, "'%s' does not provide valid service", dns_query_string(q));
|
||||
r = reply_method_errorf(q, BUS_ERROR_INCONSISTENT_SERVICE_RECORDS, "'%s' does not provide a consistent set of service resource records", dns_query_string(q));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
@ -830,7 +830,7 @@ static void resolve_service_all_complete(DnsQuery *query) {
|
||||
goto finish;
|
||||
|
||||
if (isempty(type)) {
|
||||
r = sd_varlink_error(q->varlink_request, "io.systemd.Resolve.ServiceNotProvided", NULL);
|
||||
r = sd_varlink_error(q->varlink_request, "io.systemd.Resolve.InconsistentServiceRecords", NULL);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
@ -112,6 +112,7 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE(
|
||||
|
||||
static SD_VARLINK_DEFINE_STRUCT_TYPE(
|
||||
ResolvedCanonical,
|
||||
SD_VARLINK_FIELD_COMMENT("The DNS-SD name of the service. For simple SRV services this field is absent or null."),
|
||||
SD_VARLINK_DEFINE_FIELD(name, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_DEFINE_FIELD(type, SD_VARLINK_STRING, 0),
|
||||
SD_VARLINK_DEFINE_FIELD(domain, SD_VARLINK_STRING, 0));
|
||||
@ -171,17 +172,20 @@ static SD_VARLINK_DEFINE_ERROR(BadAddressSize);
|
||||
static SD_VARLINK_DEFINE_ERROR(ResourceRecordTypeInvalidForQuery);
|
||||
static SD_VARLINK_DEFINE_ERROR(ZoneTransfersNotPermitted);
|
||||
static SD_VARLINK_DEFINE_ERROR(ResourceRecordTypeObsolete);
|
||||
static SD_VARLINK_DEFINE_ERROR(InconsistentServiceRecords);
|
||||
|
||||
SD_VARLINK_DEFINE_INTERFACE(
|
||||
io_systemd_Resolve,
|
||||
"io.systemd.Resolve",
|
||||
&vl_method_ResolveHostname,
|
||||
&vl_method_ResolveAddress,
|
||||
SD_VARLINK_SYMBOL_COMMENT("Resolves a named DNS-SD or unnamed simple SRV service."),
|
||||
&vl_method_ResolveService,
|
||||
&vl_method_ResolveRecord,
|
||||
&vl_type_ResolvedAddress,
|
||||
&vl_type_ResolvedName,
|
||||
&vl_type_ResolvedService,
|
||||
SD_VARLINK_SYMBOL_COMMENT("Encodes the canonical name, type and domain of a DNS-SD or simple SRV service. Note that due to CNAME redirections and similar, a named DNS-SD service might resolve to a canonical service that is an unnamed simple SRV service. Or in other words: resolving a named service might return an unnamed canonical service."),
|
||||
&vl_type_ResolvedCanonical,
|
||||
&vl_type_ResourceKey,
|
||||
&vl_type_ResourceRecord,
|
||||
@ -203,4 +207,6 @@ SD_VARLINK_DEFINE_INTERFACE(
|
||||
&vl_error_BadAddressSize,
|
||||
&vl_error_ResourceRecordTypeInvalidForQuery,
|
||||
&vl_error_ZoneTransfersNotPermitted,
|
||||
&vl_error_ResourceRecordTypeObsolete);
|
||||
&vl_error_ResourceRecordTypeObsolete,
|
||||
SD_VARLINK_SYMBOL_COMMENT("The DNS resource records of the specified service are not consistent (e.g. lacks a DNS-SD service type when resolved)."),
|
||||
&vl_error_InconsistentServiceRecords);
|
||||
|
Loading…
Reference in New Issue
Block a user