static inline isc_boolean_t checknames_minfo(ARGS_CHECKNAMES) { isc_region_t region; dns_name_t name; REQUIRE(rdata->type == 14); UNUSED(owner); dns_rdata_toregion(rdata, ®ion); dns_name_init(&name, NULL); dns_name_fromregion(&name, ®ion); if (!dns_name_ismailbox(&name)) { if (bad != NULL) dns_name_clone(&name, bad); return (ISC_FALSE); } isc_region_consume(®ion, name_length(&name)); dns_name_fromregion(&name, ®ion); if (!dns_name_ismailbox(&name)) { if (bad != NULL) dns_name_clone(&name, bad); return (ISC_FALSE); } return (ISC_TRUE); }
static inline isc_result_t fromtext_rp(ARGS_FROMTEXT) { isc_token_t token; dns_name_t name; isc_buffer_t buffer; int i; isc_boolean_t ok; REQUIRE(type == dns_rdatatype_rp); UNUSED(type); UNUSED(rdclass); UNUSED(callbacks); if (origin == NULL) origin = dns_rootname; for (i = 0; i < 2; i++) { RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); ok = ISC_TRUE; if ((options & DNS_RDATA_CHECKNAMES) != 0 && i == 0) ok = dns_name_ismailbox(&name); if (!ok && (options & DNS_RDATA_CHECKNAMESFAIL) != 0) RETTOK(DNS_R_BADNAME); if (!ok && callbacks != NULL) warn_badname(&name, lexer, callbacks); } return (ISC_R_SUCCESS); }
static inline isc_result_t fromtext_soa(ARGS_FROMTEXT) { isc_token_t token; dns_name_t name; isc_buffer_t buffer; int i; isc_uint32_t n; isc_boolean_t ok; REQUIRE(type == 6); UNUSED(type); UNUSED(rdclass); UNUSED(callbacks); origin = (origin != NULL) ? origin : dns_rootname; for (i = 0; i < 2; i++) { RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); ok = ISC_TRUE; if ((options & DNS_RDATA_CHECKNAMES) != 0) switch (i) { case 0: ok = dns_name_ishostname(&name, ISC_FALSE); break; case 1: ok = dns_name_ismailbox(&name); break; } if (!ok && (options & DNS_RDATA_CHECKNAMESFAIL) != 0) RETTOK(DNS_R_BADNAME); if (!ok && callbacks != NULL) warn_badname(&name, lexer, callbacks); } RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, ISC_FALSE)); RETERR(uint32_tobuffer(token.value.as_ulong, target)); for (i = 0; i < 4; i++) { RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); RETTOK(dns_counter_fromtext(&token.value.as_textregion, &n)); RETERR(uint32_tobuffer(n, target)); } return (ISC_R_SUCCESS); }
static inline isc_boolean_t checkowner_mb(ARGS_CHECKOWNER) { REQUIRE(type == 7); UNUSED(type); UNUSED(rdclass); UNUSED(wildcard); return (dns_name_ismailbox(name)); }