[email protected] wrote:
> >Synopsis: dig -p prints a warning and ignores the argument
> >Category: user
> >Environment:
> System : OpenBSD 5.9
> Details : OpenBSD 5.9 (GENERIC.MP) #4: Thu May 19 08:22:39 CEST 2016
>
> [email protected]:/binpatchng/work-binpatch59-amd64/src/sys/arch/amd64/compile/GENERIC.MP
>
> Architecture: OpenBSD.amd64
> Machine : amd64
> >Description:
> Since revision 1.15 at
> http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/bind/bin/dig/dig.c, dig
> ignores the -p option and instead sends to 53. I understand how support for
> pledge() makes it impossible to support -p, however, just ignoring the
> argument leads to several painful potential failure modes.
>
> >How-To-Repeat:
> $ dig -p 5300 www.example.com @localhost
> ;; Warning, -p option ignored
This should work a little better.
Index: dig.c
===================================================================
RCS file: /cvs/src/usr.sbin/bind/bin/dig/dig.c,v
retrieving revision 1.16
diff -u -p -r1.16 dig.c
--- dig.c 11 Nov 2015 02:52:46 -0000 1.16
+++ dig.c 4 Jun 2016 18:28:08 -0000
@@ -1192,8 +1192,10 @@ dash_option(char *option, char *next, di
strlcpy(keyfile, value, sizeof(keyfile));
return (value_from_next);
case 'p':
- fprintf(stderr, ";; Warning, -p option ignored\n");
- /* port = (in_port_t) parse_uint(value, "port number",
MAXPORT); */
+ if (parse_uint(value, "port number", MAXPORT) != 53) {
+ fprintf(stderr, ";; Error, only port 53 supported\n");
+ exit(1);
+ }
return (value_from_next);
case 'q':
if (!config_only) {