2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-10-15 14:08:26 +00:00

3541. [bug] The parts if libdns was not being properly initialized

in when built in libexport mode. [RT #33028]
This commit is contained in:
Mark Andrews
2013-04-03 17:27:40 +11:00
parent 8c460e0159
commit 8013077aa7
14 changed files with 396 additions and 21 deletions

View File

@@ -172,7 +172,9 @@ set_key(dns_client_t *client, char *keynamestr, char *keystr,
}
static void
addserver(dns_client_t *client, const char *addrstr, const char *namespace) {
addserver(dns_client_t *client, const char *addrstr, const char *port,
const char *namespace)
{
struct addrinfo hints, *res;
int gai_error;
isc_sockaddr_t sa;
@@ -188,7 +190,7 @@ addserver(dns_client_t *client, const char *addrstr, const char *namespace) {
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP;
hints.ai_flags = AI_NUMERICHOST;
gai_error = getaddrinfo(addrstr, "53", &hints, &res);
gai_error = getaddrinfo(addrstr, port, &hints, &res);
if (gai_error != 0) {
fprintf(stderr, "getaddrinfo failed: %s\n",
gai_strerror(gai_error));
@@ -245,8 +247,9 @@ main(int argc, char *argv[]) {
isc_mem_t *keymctx = NULL;
unsigned int clientopt, resopt;
isc_boolean_t is_sep = ISC_FALSE;
const char *port = "53";
while ((ch = getopt(argc, argv, "a:es:t:k:K:")) != -1) {
while ((ch = getopt(argc, argv, "a:es:t:k:K:p:")) != -1) {
switch (ch) {
case 't':
tr.base = optarg;
@@ -279,6 +282,9 @@ main(int argc, char *argv[]) {
case 'K':
keystr = optarg;
break;
case 'p':
port = optarg;
break;
default:
usage();
}
@@ -318,11 +324,11 @@ main(int argc, char *argv[]) {
}
/* Set the nameserver */
addserver(client, argv[0], NULL);
addserver(client, argv[0], port, NULL);
/* Set the alternate nameserver (when specified) */
if (altserver != NULL)
addserver(client, altserveraddr, altservername);
addserver(client, altserveraddr, port, altservername);
/* Install DNSSEC key (if given) */
if (keynamestr != NULL) {