}
/* Check for non-ascii characters */
- while (p != end) {
- if (*p >= 0x80) {
- need_encode = true;
- }
- else if (*p == '.') {
- labels ++;
+ if (!(resolver->flags & RDNS_RESOLVER_NOIDN)) {
+ while (p != end) {
+ if (*p >= 0x80) {
+ need_encode = true;
+ }
+ else if (*p == '.') {
+ labels++;
+ }
+ p++;
}
- p ++;
}
if (!need_encode) {
*out = malloc (inlen + 1);
+
if (*out == NULL) {
return false;
}
+
o = *out;
memcpy (o, in, inlen);
o[inlen] = '\0';
* RDNS API
*/
+enum rdns_resolver_flags {
+ RDNS_RESOLVER_DEFAULT,
+ RDNS_RESOLVER_NOIDN = (1u << 0u),
+};
+
/**
* Create DNS resolver structure
*/
-struct rdns_resolver *rdns_resolver_new (void);
+struct rdns_resolver *rdns_resolver_new (int flags);
/**
* Bind resolver to specified async context
struct rdns_resolver *
-rdns_resolver_new (void)
+rdns_resolver_new (int flags)
{
- struct rdns_resolver *new;
+ struct rdns_resolver *new_resolver;
- new = calloc (1, sizeof (struct rdns_resolver));
+ new_resolver = calloc (1, sizeof (struct rdns_resolver));
- REF_INIT_RETAIN (new, rdns_resolver_free);
+ REF_INIT_RETAIN (new_resolver, rdns_resolver_free);
- new->logger = rdns_logger_internal;
- new->log_data = new;
+ new_resolver->logger = rdns_logger_internal;
+ new_resolver->log_data = new_resolver;
+ new_resolver->flags = flags;
- return new;
+ return new_resolver;
}
void
dns_resolver->max_retransmits = 2;
}
- dns_resolver->r = rdns_resolver_new ();
+ /* IDN translation is performed in Rspamd now */
+ dns_resolver->r = rdns_resolver_new (RDNS_RESOLVER_NOIDN);
UErrorCode uc_err = U_ZERO_ERROR;