Deleted Added
full compact
unbound-control.c (266114) unbound-control.c (276605)
1/*
2 * checkconf/unbound-control.c - remote control utility for unbound.
3 *
4 * Copyright (c) 2008, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 81 unchanged lines hidden (view full) ---

90 printf(" lookup <name> print nameservers for name\n");
91 printf(" flush <name> flushes common types for name from cache\n");
92 printf(" types: A, AAAA, MX, PTR, NS,\n");
93 printf(" SOA, CNAME, DNAME, SRV, NAPTR\n");
94 printf(" flush_type <name> <type> flush name, type from cache\n");
95 printf(" flush_zone <name> flush everything at or under name\n");
96 printf(" from rr and dnssec caches\n");
97 printf(" flush_bogus flush all bogus data\n");
1/*
2 * checkconf/unbound-control.c - remote control utility for unbound.
3 *
4 * Copyright (c) 2008, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 81 unchanged lines hidden (view full) ---

90 printf(" lookup <name> print nameservers for name\n");
91 printf(" flush <name> flushes common types for name from cache\n");
92 printf(" types: A, AAAA, MX, PTR, NS,\n");
93 printf(" SOA, CNAME, DNAME, SRV, NAPTR\n");
94 printf(" flush_type <name> <type> flush name, type from cache\n");
95 printf(" flush_zone <name> flush everything at or under name\n");
96 printf(" from rr and dnssec caches\n");
97 printf(" flush_bogus flush all bogus data\n");
98 printf(" flush_negative flush all negative data\n");
98 printf(" flush_stats flush statistics, make zero\n");
99 printf(" flush_requestlist drop queries that are worked on\n");
100 printf(" dump_requestlist show what is worked on\n");
101 printf(" flush_infra [all | ip] remove ping, edns for one IP or all\n");
102 printf(" dump_infra show ping and edns entries\n");
103 printf(" set_option opt: val set option to value, no reload\n");
104 printf(" get_option opt get option value\n");
105 printf(" list_stubs list stub-zones and root hints in use\n");

--- 37 unchanged lines hidden (view full) ---

143 c_cert = fname_after_chroot(cfg->control_cert_file, cfg, 1);
144 if(!s_cert || !c_key || !c_cert)
145 fatal_exit("out of memory");
146 ctx = SSL_CTX_new(SSLv23_client_method());
147 if(!ctx)
148 ssl_err("could not allocate SSL_CTX pointer");
149 if(!(SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2) & SSL_OP_NO_SSLv2))
150 ssl_err("could not set SSL_OP_NO_SSLv2");
99 printf(" flush_stats flush statistics, make zero\n");
100 printf(" flush_requestlist drop queries that are worked on\n");
101 printf(" dump_requestlist show what is worked on\n");
102 printf(" flush_infra [all | ip] remove ping, edns for one IP or all\n");
103 printf(" dump_infra show ping and edns entries\n");
104 printf(" set_option opt: val set option to value, no reload\n");
105 printf(" get_option opt get option value\n");
106 printf(" list_stubs list stub-zones and root hints in use\n");

--- 37 unchanged lines hidden (view full) ---

144 c_cert = fname_after_chroot(cfg->control_cert_file, cfg, 1);
145 if(!s_cert || !c_key || !c_cert)
146 fatal_exit("out of memory");
147 ctx = SSL_CTX_new(SSLv23_client_method());
148 if(!ctx)
149 ssl_err("could not allocate SSL_CTX pointer");
150 if(!(SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2) & SSL_OP_NO_SSLv2))
151 ssl_err("could not set SSL_OP_NO_SSLv2");
152 if(!(SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv3) & SSL_OP_NO_SSLv3))
153 ssl_err("could not set SSL_OP_NO_SSLv3");
151 if(!SSL_CTX_use_certificate_file(ctx,c_cert,SSL_FILETYPE_PEM) ||
152 !SSL_CTX_use_PrivateKey_file(ctx,c_key,SSL_FILETYPE_PEM)
153 || !SSL_CTX_check_private_key(ctx))
154 ssl_err("Error setting up SSL_CTX client key and cert");
155 if (SSL_CTX_load_verify_locations(ctx, s_cert, NULL) != 1)
156 ssl_err("Error setting up SSL_CTX verify, server cert");
157 SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, NULL);
158

--- 36 unchanged lines hidden (view full) ---

195 if(fd == -1) {
196#ifndef USE_WINSOCK
197 fatal_exit("socket: %s", strerror(errno));
198#else
199 fatal_exit("socket: %s", wsa_strerror(WSAGetLastError()));
200#endif
201 }
202 if(connect(fd, (struct sockaddr*)&addr, addrlen) < 0) {
154 if(!SSL_CTX_use_certificate_file(ctx,c_cert,SSL_FILETYPE_PEM) ||
155 !SSL_CTX_use_PrivateKey_file(ctx,c_key,SSL_FILETYPE_PEM)
156 || !SSL_CTX_check_private_key(ctx))
157 ssl_err("Error setting up SSL_CTX client key and cert");
158 if (SSL_CTX_load_verify_locations(ctx, s_cert, NULL) != 1)
159 ssl_err("Error setting up SSL_CTX verify, server cert");
160 SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, NULL);
161

--- 36 unchanged lines hidden (view full) ---

198 if(fd == -1) {
199#ifndef USE_WINSOCK
200 fatal_exit("socket: %s", strerror(errno));
201#else
202 fatal_exit("socket: %s", wsa_strerror(WSAGetLastError()));
203#endif
204 }
205 if(connect(fd, (struct sockaddr*)&addr, addrlen) < 0) {
203 log_addr(0, "address", &addr, addrlen);
204#ifndef USE_WINSOCK
206#ifndef USE_WINSOCK
205 log_err("connect: %s", strerror(errno));
207 log_err_addr("connect", strerror(errno), &addr, addrlen);
206 if(errno == ECONNREFUSED && statuscmd) {
207 printf("unbound is stopped\n");
208 exit(3);
209 }
210#else
208 if(errno == ECONNREFUSED && statuscmd) {
209 printf("unbound is stopped\n");
210 exit(3);
211 }
212#else
211 log_err("connect: %s", wsa_strerror(WSAGetLastError()));
213 log_err_addr("connect", wsa_strerror(WSAGetLastError()), &addr, addrlen);
212 if(WSAGetLastError() == WSAECONNREFUSED && statuscmd) {
213 printf("unbound is stopped\n");
214 exit(3);
215 }
216#endif
217 exit(1);
218 }
219 return fd;

--- 219 unchanged lines hidden ---
214 if(WSAGetLastError() == WSAECONNREFUSED && statuscmd) {
215 printf("unbound is stopped\n");
216 exit(3);
217 }
218#endif
219 exit(1);
220 }
221 return fd;

--- 219 unchanged lines hidden ---