#include <config.h>
#include <ctype.h>
#include <isc/buffer.h>
#include <isc/parseint.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/stdio.h>
#include <isc/stdlib.h>
#include <isc/string.h>
#include <isc/types.h>
#include <isc/util.h>
#include <dns/cert.h>
#include <dns/ds.h>
#include <dns/dsdigest.h>
#include <dns/keyflags.h>
#include <dns/keyvalues.h>
#include <dns/rcode.h>
#include <dns/rdataclass.h>
#include <dns/result.h>
#include <dns/secalg.h>
#include <dns/secproto.h>
Go to the source code of this file.
Data Structures | |
struct | tbl |
struct | keyflag |
Defines | |
#define | RETERR(x) |
#define | NUMBERSIZE sizeof("037777777777") |
#define | RCODENAMES |
#define | ERCODENAMES |
#define | TSIGRCODENAMES |
#define | CERTNAMES |
#define | SECALGNAMES |
#define | SECPROTONAMES |
#define | HASHALGNAMES |
#define | DSDIGESTNAMES |
#define | COMPARE(string, rdclass) |
Functions | |
static isc_result_t | str_totext (const char *source, isc_buffer_t *target) |
static isc_result_t | maybe_numeric (unsigned int *valuep, isc_textregion_t *source, unsigned int max, isc_boolean_t hex_allowed) |
static isc_result_t | dns_mnemonic_fromtext (unsigned int *valuep, isc_textregion_t *source, struct tbl *table, unsigned int max) |
static isc_result_t | dns_mnemonic_totext (unsigned int value, isc_buffer_t *target, struct tbl *table) |
isc_result_t | dns_rcode_fromtext (dns_rcode_t *rcodep, isc_textregion_t *source) |
Convert the text 'source' refers to into a DNS error value. | |
isc_result_t | dns_rcode_totext (dns_rcode_t rcode, isc_buffer_t *target) |
Put a textual representation of error 'rcode' into 'target'. | |
isc_result_t | dns_tsigrcode_fromtext (dns_rcode_t *rcodep, isc_textregion_t *source) |
Convert the text 'source' refers to into a TSIG/TKEY error value. | |
isc_result_t | dns_tsigrcode_totext (dns_rcode_t rcode, isc_buffer_t *target) |
Put a textual representation of TSIG/TKEY error 'rcode' into 'target'. | |
isc_result_t | dns_cert_fromtext (dns_cert_t *certp, isc_textregion_t *source) |
Convert the text 'source' refers to into a certificate type. The text may contain either a mnemonic type name or a decimal type number. | |
isc_result_t | dns_cert_totext (dns_cert_t cert, isc_buffer_t *target) |
Put a textual representation of certificate type 'cert' into 'target'. | |
isc_result_t | dns_secalg_fromtext (dns_secalg_t *secalgp, isc_textregion_t *source) |
Convert the text 'source' refers to into a DNSSEC security algorithm value. The text may contain either a mnemonic algorithm name or a decimal algorithm number. | |
isc_result_t | dns_secalg_totext (dns_secalg_t secalg, isc_buffer_t *target) |
Put a textual representation of the DNSSEC security algorithm 'secalg' into 'target'. | |
void | dns_secalg_format (dns_secalg_t alg, char *cp, unsigned int size) |
Wrapper for dns_secalg_totext(), writing text into 'cp'. | |
isc_result_t | dns_secproto_fromtext (dns_secproto_t *secprotop, isc_textregion_t *source) |
Convert the text 'source' refers to into a DNSSEC security protocol value. The text may contain either a mnemonic protocol name or a decimal protocol number. | |
isc_result_t | dns_secproto_totext (dns_secproto_t secproto, isc_buffer_t *target) |
Put a textual representation of the DNSSEC security protocol 'secproto' into 'target'. | |
isc_result_t | dns_hashalg_fromtext (unsigned char *hashalg, isc_textregion_t *source) |
Convert the text 'source' refers to into a has algorithm value. | |
isc_result_t | dns_keyflags_fromtext (dns_keyflags_t *flagsp, isc_textregion_t *source) |
Convert the text 'source' refers to into a DNSSEC KEY flags value. The text may contain either a set of flag mnemonics separated by vertical bars or a decimal flags value. For compatibility with older versions of BIND and the DNSSEC signer, octal values prefixed with a zero and hexadecimal values prefixed with "0x" are also accepted. | |
isc_result_t | dns_dsdigest_fromtext (dns_dsdigest_t *dsdigestp, isc_textregion_t *source) |
Convert the text 'source' refers to into a DS/DLV digest type value. The text may contain either a mnemonic digest name or a decimal digest number. | |
isc_result_t | dns_dsdigest_totext (dns_dsdigest_t dsdigest, isc_buffer_t *target) |
Put a textual representation of the DS/DLV digest type 'dsdigest' into 'target'. | |
void | dns_dsdigest_format (dns_dsdigest_t typ, char *cp, unsigned int size) |
Wrapper for dns_dsdigest_totext(), writing text into 'cp'. | |
isc_result_t | dns_rdataclass_fromtext (dns_rdataclass_t *classp, isc_textregion_t *source) |
Convert the text 'source' refers to into a DNS class. | |
isc_result_t | dns_rdataclass_totext (dns_rdataclass_t rdclass, isc_buffer_t *target) |
Put a textual representation of class 'rdclass' into 'target'. | |
void | dns_rdataclass_format (dns_rdataclass_t rdclass, char *array, unsigned int size) |
Format a human-readable representation of the class 'rdclass' into the character array 'array', which is of size 'size'. The resulting string is guaranteed to be null-terminated. | |
Variables | |
static struct tbl | rcodes [] = { RCODENAMES ERCODENAMES } |
static struct tbl | tsigrcodes [] = { RCODENAMES TSIGRCODENAMES } |
static struct tbl | certs [] = { CERTNAMES } |
static struct tbl | secalgs [] = { SECALGNAMES } |
static struct tbl | secprotos [] = { SECPROTONAMES } |
static struct tbl | hashalgs [] = { HASHALGNAMES } |
static struct tbl | dsdigests [] = { DSDIGESTNAMES } |
static struct keyflag | keyflags [] |
#define RETERR | ( | x | ) |
Value:
do { \ isc_result_t _r = (x); \ if (_r != ISC_R_SUCCESS) \ return (_r); \ } while (0)
#define NUMBERSIZE sizeof("037777777777") |
#define RCODENAMES |
Value:
/* standard rcodes */ \ { dns_rcode_noerror, "NOERROR", 0}, \ { dns_rcode_formerr, "FORMERR", 0}, \ { dns_rcode_servfail, "SERVFAIL", 0}, \ { dns_rcode_nxdomain, "NXDOMAIN", 0}, \ { dns_rcode_notimp, "NOTIMP", 0}, \ { dns_rcode_refused, "REFUSED", 0}, \ { dns_rcode_yxdomain, "YXDOMAIN", 0}, \ { dns_rcode_yxrrset, "YXRRSET", 0}, \ { dns_rcode_nxrrset, "NXRRSET", 0}, \ { dns_rcode_notauth, "NOTAUTH", 0}, \ { dns_rcode_notzone, "NOTZONE", 0},
#define ERCODENAMES |
Value:
/* extended rcodes */ \ { dns_rcode_badvers, "BADVERS", 0}, \ { 0, NULL, 0 }
#define TSIGRCODENAMES |
Value:
/* extended rcodes */ \ { dns_tsigerror_badsig, "BADSIG", 0}, \ { dns_tsigerror_badkey, "BADKEY", 0}, \ { dns_tsigerror_badtime, "BADTIME", 0}, \ { dns_tsigerror_badmode, "BADMODE", 0}, \ { dns_tsigerror_badname, "BADNAME", 0}, \ { dns_tsigerror_badalg, "BADALG", 0}, \ { dns_tsigerror_badtrunc, "BADTRUNC", 0}, \ { 0, NULL, 0 }
#define CERTNAMES |
#define SECALGNAMES |
Value:
{ DNS_KEYALG_RSAMD5, "RSAMD5", 0 }, \ { DNS_KEYALG_RSAMD5, "RSA", 0 }, \ { DNS_KEYALG_DH, "DH", 0 }, \ { DNS_KEYALG_DSA, "DSA", 0 }, \ { DNS_KEYALG_NSEC3DSA, "NSEC3DSA", 0 }, \ { DNS_KEYALG_ECC, "ECC", 0 }, \ { DNS_KEYALG_RSASHA1, "RSASHA1", 0 }, \ { DNS_KEYALG_NSEC3RSASHA1, "NSEC3RSASHA1", 0 }, \ { DNS_KEYALG_RSASHA256, "RSASHA256", 0 }, \ { DNS_KEYALG_RSASHA512, "RSASHA512", 0 }, \ { DNS_KEYALG_ECCGOST, "ECCGOST", 0 }, \ { DNS_KEYALG_ECDSA256, "ECDSAP256SHA256", 0 }, \ { DNS_KEYALG_ECDSA384, "ECDSAP384SHA384", 0 }, \ { DNS_KEYALG_INDIRECT, "INDIRECT", 0 }, \ { DNS_KEYALG_PRIVATEDNS, "PRIVATEDNS", 0 }, \ { DNS_KEYALG_PRIVATEOID, "PRIVATEOID", 0 }, \ { 0, NULL, 0}
#define SECPROTONAMES |
#define HASHALGNAMES |
#define DSDIGESTNAMES |
Value:
{ DNS_DSDIGEST_SHA1, "SHA-1", 0 }, \ { DNS_DSDIGEST_SHA256, "SHA-256", 0 }, \ { DNS_DSDIGEST_GOST, "GOST", 0 }, \ { DNS_DSDIGEST_SHA384, "SHA-384", 0 }, \ { 0, NULL, 0}
#define COMPARE | ( | string, | |||
rdclass | ) |
Value:
if (((sizeof(string) - 1) == source->length) \ && (strncasecmp(source->base, string, source->length) == 0)) { \ *classp = rdclass; \ return (ISC_R_SUCCESS); \ }
Referenced by dns_rdataclass_fromtext().
static isc_result_t str_totext | ( | const char * | source, | |
isc_buffer_t * | target | |||
) | [static] |
Definition at line 199 of file rcode.c.
References isc_region::base, isc_buffer_add, isc_buffer_availableregion, ISC_R_NOSPACE, ISC_R_SUCCESS, and isc_region::length.
static isc_result_t maybe_numeric | ( | unsigned int * | valuep, | |
isc_textregion_t * | source, | |||
unsigned int | max, | |||
isc_boolean_t | hex_allowed | |||
) | [static] |
Definition at line 215 of file rcode.c.
References isc_textregion::base, buffer, INSIST, isc_parse_uint32(), ISC_R_BADNUMBER, ISC_R_RANGE, ISC_R_SUCCESS, isc_textregion::length, and NUMBERSIZE.
Referenced by dns_keyflags_fromtext(), and dns_mnemonic_fromtext().
static isc_result_t dns_mnemonic_fromtext | ( | unsigned int * | valuep, | |
isc_textregion_t * | source, | |||
struct tbl * | table, | |||
unsigned int | max | |||
) | [static] |
Definition at line 248 of file rcode.c.
References isc_textregion::base, DNS_R_UNKNOWN, ISC_FALSE, ISC_R_BADNUMBER, ISC_R_SUCCESS, isc_textregion::length, maybe_numeric(), name, tbl::name, and tbl::value.
Referenced by dns_cert_fromtext(), dns_dsdigest_fromtext(), dns_hashalg_fromtext(), dns_rcode_fromtext(), dns_secalg_fromtext(), dns_secproto_fromtext(), and dns_tsigrcode_fromtext().
static isc_result_t dns_mnemonic_totext | ( | unsigned int | value, | |
isc_buffer_t * | target, | |||
struct tbl * | table | |||
) | [static] |
Definition at line 271 of file rcode.c.
References name, and str_totext().
Referenced by dns_cert_totext(), dns_dsdigest_totext(), dns_rcode_totext(), dns_secalg_totext(), dns_secproto_totext(), and dns_tsigrcode_totext().
isc_result_t dns_rcode_fromtext | ( | dns_rcode_t * | rcodep, | |
isc_textregion_t * | source | |||
) |
Convert the text 'source' refers to into a DNS error value.
Requires:
Definition at line 287 of file rcode.c.
References dns_mnemonic_fromtext(), ISC_R_SUCCESS, and RETERR.
isc_result_t dns_rcode_totext | ( | dns_rcode_t | rcode, | |
isc_buffer_t * | target | |||
) |
Put a textual representation of error 'rcode' into 'target'.
Requires:
Definition at line 295 of file rcode.c.
References dns_mnemonic_totext().
Referenced by add_bad(), forward_callback(), notify_done(), ns_client_error(), refresh_callback(), resquery_response(), stub_callback(), and update_completed().
isc_result_t dns_tsigrcode_fromtext | ( | dns_rcode_t * | rcodep, | |
isc_textregion_t * | source | |||
) |
Convert the text 'source' refers to into a TSIG/TKEY error value.
Requires:
Definition at line 300 of file rcode.c.
References dns_mnemonic_fromtext(), ISC_R_SUCCESS, and RETERR.
Referenced by fromtext_any_tsig(), and fromtext_tkey().
isc_result_t dns_tsigrcode_totext | ( | dns_rcode_t | rcode, | |
isc_buffer_t * | target | |||
) |
Put a textual representation of TSIG/TKEY error 'rcode' into 'target'.
Requires:
Definition at line 308 of file rcode.c.
References dns_mnemonic_totext().
Referenced by check_tsig_error(), client_request(), totext_any_tsig(), and totext_tkey().
isc_result_t dns_cert_fromtext | ( | dns_cert_t * | certp, | |
isc_textregion_t * | source | |||
) |
Convert the text 'source' refers to into a certificate type. The text may contain either a mnemonic type name or a decimal type number.
Requires:
Definition at line 313 of file rcode.c.
References dns_mnemonic_fromtext(), ISC_R_SUCCESS, and RETERR.
Referenced by fromtext_cert().
isc_result_t dns_cert_totext | ( | dns_cert_t | cert, | |
isc_buffer_t * | target | |||
) |
Put a textual representation of certificate type 'cert' into 'target'.
Requires:
Definition at line 321 of file rcode.c.
References dns_mnemonic_totext().
Referenced by totext_cert().
isc_result_t dns_secalg_fromtext | ( | dns_secalg_t * | secalgp, | |
isc_textregion_t * | source | |||
) |
Convert the text 'source' refers to into a DNSSEC security algorithm value. The text may contain either a mnemonic algorithm name or a decimal algorithm number.
Requires:
Definition at line 326 of file rcode.c.
References dns_mnemonic_fromtext(), ISC_R_SUCCESS, and RETERR.
Referenced by disable_algorithms(), disabled_algorithms(), fromtext_cdnskey(), fromtext_cds(), fromtext_cert(), fromtext_dnskey(), fromtext_ds(), fromtext_key(), fromtext_keydata(), fromtext_rrsig(), fromtext_sig(), and main().
isc_result_t dns_secalg_totext | ( | dns_secalg_t | secalg, | |
isc_buffer_t * | target | |||
) |
Put a textual representation of the DNSSEC security algorithm 'secalg' into 'target'.
Requires:
Definition at line 334 of file rcode.c.
References dns_mnemonic_totext().
Referenced by dns_secalg_format(), and totext_cert().
void dns_secalg_format | ( | dns_secalg_t | alg, | |
char * | cp, | |||
unsigned int | size | |||
) |
Wrapper for dns_secalg_totext(), writing text into 'cp'.
Definition at line 339 of file rcode.c.
References isc_region::base, dns_secalg_totext(), isc_buffer_init, isc_buffer_usedregion, ISC_R_SUCCESS, isc_region::length, r, and REQUIRE.
Referenced by del_sigs(), dns_dnssec_findzonekeys2(), dns_dnssec_keylistfromrdataset(), dns_private_totext(), dst_key_format(), main(), mkey_dumpzone(), publish_key(), remove_key(), sig_format(), totext_cdnskey(), totext_dnskey(), totext_keydata(), verifyset(), and verifyzone().
isc_result_t dns_secproto_fromtext | ( | dns_secproto_t * | secprotop, | |
isc_textregion_t * | source | |||
) |
Convert the text 'source' refers to into a DNSSEC security protocol value. The text may contain either a mnemonic protocol name or a decimal protocol number.
Requires:
Definition at line 354 of file rcode.c.
References dns_mnemonic_fromtext(), ISC_R_SUCCESS, and RETERR.
Referenced by fromtext_cdnskey(), fromtext_dnskey(), fromtext_key(), and fromtext_keydata().
isc_result_t dns_secproto_totext | ( | dns_secproto_t | secproto, | |
isc_buffer_t * | target | |||
) |
Put a textual representation of the DNSSEC security protocol 'secproto' into 'target'.
Requires:
Definition at line 362 of file rcode.c.
References dns_mnemonic_totext().
isc_result_t dns_hashalg_fromtext | ( | unsigned char * | hashalg, | |
isc_textregion_t * | source | |||
) |
Convert the text 'source' refers to into a has algorithm value.
Requires:
Definition at line 367 of file rcode.c.
References dns_mnemonic_fromtext(), ISC_R_SUCCESS, and RETERR.
Referenced by fromtext_nsec3(), and fromtext_nsec3param().
isc_result_t dns_keyflags_fromtext | ( | dns_keyflags_t * | flagsp, | |
isc_textregion_t * | source | |||
) |
Convert the text 'source' refers to into a DNSSEC KEY flags value. The text may contain either a set of flag mnemonics separated by vertical bars or a decimal flags value. For compatibility with older versions of BIND and the DNSSEC signer, octal values prefixed with a zero and hexadecimal values prefixed with "0x" are also accepted.
Requires:
Definition at line 375 of file rcode.c.
References isc_textregion::base, DNS_R_UNKNOWNFLAG, ISC_R_BADNUMBER, ISC_R_SUCCESS, ISC_TRUE, keyflags, isc_textregion::length, keyflag::mask, maybe_numeric(), keyflag::name, text, and keyflag::value.
Referenced by fromtext_cdnskey(), fromtext_dnskey(), fromtext_key(), and fromtext_keydata().
isc_result_t dns_dsdigest_fromtext | ( | dns_dsdigest_t * | dsdigestp, | |
isc_textregion_t * | source | |||
) |
Convert the text 'source' refers to into a DS/DLV digest type value. The text may contain either a mnemonic digest name or a decimal digest number.
Requires:
Definition at line 422 of file rcode.c.
References dns_mnemonic_fromtext(), ISC_R_SUCCESS, RETERR, and keyflag::value.
Referenced by disable_ds_digests(), disabled_ds_digests(), fromtext_cds(), and fromtext_ds().
isc_result_t dns_dsdigest_totext | ( | dns_dsdigest_t | dsdigest, | |
isc_buffer_t * | target | |||
) |
Put a textual representation of the DS/DLV digest type 'dsdigest' into 'target'.
Requires:
Definition at line 430 of file rcode.c.
References dns_mnemonic_totext().
Referenced by dns_dsdigest_format().
void dns_dsdigest_format | ( | dns_dsdigest_t | typ, | |
char * | cp, | |||
unsigned int | size | |||
) |
Wrapper for dns_dsdigest_totext(), writing text into 'cp'.
Definition at line 435 of file rcode.c.
References isc_region::base, dns_dsdigest_totext(), isc_buffer_init, isc_buffer_usedregion, ISC_R_SUCCESS, isc_region::length, r, and REQUIRE.
isc_result_t dns_rdataclass_fromtext | ( | dns_rdataclass_t * | classp, | |
isc_textregion_t * | source | |||
) |
Convert the text 'source' refers to into a DNS class.
Requires:
Definition at line 454 of file rcode.c.
References isc_textregion::base, COMPARE, DNS_R_UNKNOWN, ISC_R_SUCCESS, and isc_textregion::length.
Referenced by addlookup(), bind9_check_namedconf(), check_orderent(), check_zoneconf(), configure_hint(), dash_option(), dst_key_read_public(), evaluate_class(), load_text(), load_zone(), make_prereq(), ns_config_getclass(), ns_server_mkeys(), parse_args(), strtoclass(), testclass(), update_addordelete(), and zone_from_args().
isc_result_t dns_rdataclass_totext | ( | dns_rdataclass_t | rdclass, | |
isc_buffer_t * | target | |||
) |
Put a textual representation of class 'rdclass' into 'target'.
Requires:
Definition at line 512 of file rcode.c.
References str_totext().
Referenced by dns_rdataclass_format(), emit(), make_log_buf(), question_totext(), rdataset_totext(), write_public_key(), zone_namerd_tostr(), and zone_rdclass_tostr().
void dns_rdataclass_format | ( | dns_rdataclass_t | rdclass, | |
char * | array, | |||
unsigned int | size | |||
) |
Format a human-readable representation of the class 'rdclass' into the character array 'array', which is of size 'size'. The resulting string is guaranteed to be null-terminated.
Definition at line 535 of file rcode.c.
References dns_rdataclass_totext(), isc_buffer_availablelength, isc_buffer_init, isc_buffer_putuint8, ISC_R_NOSPACE, and ISC_R_SUCCESS.
Referenced by add_bad(), cache_name(), checkqueryacl(), checkupdateacl(), client_request(), detailsection(), diff_apply(), freezezones(), is_answeraddress_allowed(), is_answertarget_allowed(), load_text(), log_query(), log_queryerror(), ns_client_aclmsg(), ns_client_dumprecursing(), ns_server_freeze(), ns_server_sync(), ns_xfr_start(), query_find(), recv_done(), resquery_response(), same_question(), send_forward_event(), update_log(), and xfrout_logv().
struct tbl tsigrcodes[] = { RCODENAMES TSIGRCODENAMES } [static] |
Referenced by dns_keyflags_fromtext().