2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

794. [func] Implement the "port" and "default-port" statements

in rndc.conf.
This commit is contained in:
Brian Wellington 2001-03-28 00:16:09 +00:00
parent db9c64f8ef
commit d7ba3622ff
4 changed files with 49 additions and 20 deletions

View File

@ -1,3 +1,6 @@
794. [func] Implement the "port" and "default-port" statements
in rndc.conf.
793. [cleanup] The DNSSEC tools could create filenames that were 793. [cleanup] The DNSSEC tools could create filenames that were
illegal or contained shell metacharacters. They illegal or contained shell metacharacters. They
now use a different text encoding of names that now use a different text encoding of names that

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: rndc.c,v 1.45 2001/03/27 02:34:36 bwelling Exp $ */ /* $Id: rndc.c,v 1.46 2001/03/28 00:16:06 bwelling Exp $ */
/* /*
* Principal Author: DCL * Principal Author: DCL
@ -331,12 +331,14 @@ main(int argc, char **argv) {
cfg_obj_t *defkey = NULL; cfg_obj_t *defkey = NULL;
cfg_obj_t *keys = NULL; cfg_obj_t *keys = NULL;
cfg_obj_t *key = NULL; cfg_obj_t *key = NULL;
cfg_obj_t *defport = NULL;
cfg_obj_t *secretobj = NULL; cfg_obj_t *secretobj = NULL;
cfg_obj_t *algorithmobj = NULL; cfg_obj_t *algorithmobj = NULL;
cfg_listelt_t *elt; cfg_listelt_t *elt;
const char *keyname = NULL; const char *keyname = NULL;
const char *secretstr; const char *secretstr;
const char *algorithm; const char *algorithm;
isc_boolean_t portset = ISC_FALSE;
char secretarray[1024]; char secretarray[1024];
char *p; char *p;
size_t argslen; size_t argslen;
@ -373,6 +375,7 @@ main(int argc, char **argv) {
progname); progname);
exit(1); exit(1);
} }
portset = ISC_TRUE;
break; break;
case 's': case 's':
@ -512,6 +515,26 @@ main(int argc, char **argv) {
secret.rend = secret.rstart; secret.rend = secret.rstart;
secret.rstart = secretarray; secret.rstart = secretarray;
/*
* Find the port to connect to.
*/
if (portset)
; /* Was set on command line, do nothing. */
else if (server != NULL) {
DO("get port for server", cfg_map_get(server, "port",
&defport));
} else if (options != NULL) {
DO("get default port", cfg_map_get(options, "default-port",
&defport));
}
if (defport != NULL) {
remoteport = cfg_obj_asuint32(defport);
if (remoteport > 65535) {
fprintf(stderr, "%s: port out of range\n", progname);
exit(1);
}
}
isccc_result_register(); isccc_result_register();
have_ipv4 = (isc_net_probeipv4() == ISC_R_SUCCESS); have_ipv4 = (isc_net_probeipv4() == ISC_R_SUCCESS);

View File

@ -13,7 +13,7 @@
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" $Id: rndc.conf.5,v 1.12 2001/02/07 20:27:40 bwelling Exp $ .\" $Id: rndc.conf.5,v 1.13 2001/03/28 00:16:09 bwelling Exp $
.Dd Jun 30, 2000 .Dd Jun 30, 2000
.Dt RDNC.CONF 5 .Dt RDNC.CONF 5
@ -54,7 +54,7 @@ statement.
.Pp .Pp
The The
.Dv options .Dv options
statement contains two clauses. statement contains three clauses.
The The
.Dv default-server .Dv default-server
clause clause
@ -74,10 +74,21 @@ option is provided on the
.Xr rndc .Xr rndc
command line, and no command line, and no
.Dv key .Dv key
clause is found in a a matching clause is found in a matching
.Dv server .Dv server
statement, this default key will be used to authenticate the server's statement, this default key will be used to authenticate the server's
commands and responses. commands and responses.
The
.Dv default-port clause is followed by the port to connect
to on the remote name server. If no
.Fl p
option is provided on the
.Xr rndc
command line, and no
.Dv port
clause is found in a matching
.Dv server
statement, this default port will be used to connect.
.Pp .Pp
After the keyword After the keyword
.Dv server , .Dv server ,
@ -85,11 +96,13 @@ the
.Dv server .Dv server
statement is followed by a string which is the hostname or address for a statement is followed by a string which is the hostname or address for a
name server. name server.
The statement has a single clause, The statement has two possible clauses:
.Dv key . .Dv key
and
.Dv port .
The key name must match the name of a The key name must match the name of a
.Dv key .Dv key
statement in the file. statement in the file. The port number specifies the port to connect to.
.Pp .Pp
The The
.Dv key .Dv key
@ -197,18 +210,6 @@ See the sections on the
.Dv controls .Dv controls
statement in the BIND 9 Administrator Reference Manual for statement in the BIND 9 Administrator Reference Manual for
details. details.
.Sh LIMITATIONS
There is currently no way to specify the port for
.Xr rndc
to use. This will be remedied in future releases by allowing a
.Dv port
clause to the
.Dv server
statement and a
.Dv default-port
clause to the
.Dv options
statement.
.Sh SEE ALSO .Sh SEE ALSO
.Xr rndc 8 , .Xr rndc 8 ,
.Xr dnssec-keygen 8 , .Xr dnssec-keygen 8 ,

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: parser.c,v 1.50 2001/03/26 21:33:07 bwelling Exp $ */ /* $Id: parser.c,v 1.51 2001/03/28 00:16:05 bwelling Exp $ */
#include <config.h> #include <config.h>
@ -3364,6 +3364,7 @@ static cfg_clausedef_t
rndcconf_options_clauses[] = { rndcconf_options_clauses[] = {
{ "default-server", &cfg_type_astring, 0 }, { "default-server", &cfg_type_astring, 0 },
{ "default-key", &cfg_type_astring, 0 }, { "default-key", &cfg_type_astring, 0 },
{ "default-port", &cfg_type_uint32, 0 },
{ NULL, NULL, 0 } { NULL, NULL, 0 }
}; };
@ -3381,6 +3382,7 @@ static cfg_type_t cfg_type_rndcconf_options = {
static cfg_clausedef_t static cfg_clausedef_t
rndcconf_server_clauses[] = { rndcconf_server_clauses[] = {
{ "key", &cfg_type_astring, 0 }, { "key", &cfg_type_astring, 0 },
{ "port", &cfg_type_uint32, 0 },
{ NULL, NULL, 0 } { NULL, NULL, 0 }
}; };