Merge branch 'u/fanf2/optionally-disable-digrc' into 'master'
dig: a -r option to disable .digrc See merge request isc-projects/bind9!970
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -1,3 +1,5 @@
|
|||||||
|
5094. [func] Add 'dig -r' to disable reading of .digrc. [GL !970]
|
||||||
|
|
||||||
5093. [bug] Log lame qname-minimization servers only if they're
|
5093. [bug] Log lame qname-minimization servers only if they're
|
||||||
really lame. [GL #671]
|
really lame. [GL #671]
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ static char hexcookie[81];
|
|||||||
|
|
||||||
static bool short_form = false, printcmd = true,
|
static bool short_form = false, printcmd = true,
|
||||||
plusquest = false, pluscomm = false,
|
plusquest = false, pluscomm = false,
|
||||||
ipv4only = false, ipv6only = false;
|
ipv4only = false, ipv6only = false, digrc = true;
|
||||||
static uint32_t splitwidth = 0xffffffff;
|
static uint32_t splitwidth = 0xffffffff;
|
||||||
|
|
||||||
/*% opcode text */
|
/*% opcode text */
|
||||||
@@ -157,6 +157,7 @@ help(void) {
|
|||||||
" -m (enable memory usage debugging)\n"
|
" -m (enable memory usage debugging)\n"
|
||||||
" -p port (specify port number)\n"
|
" -p port (specify port number)\n"
|
||||||
" -q name (specify query name)\n"
|
" -q name (specify query name)\n"
|
||||||
|
" -r (do not read ~/.digrc)\n"
|
||||||
" -t type (specify query type)\n"
|
" -t type (specify query type)\n"
|
||||||
" -u (display times in usec instead of msec)\n"
|
" -u (display times in usec instead of msec)\n"
|
||||||
" -x dot-notation (shortcut for reverse lookups)\n"
|
" -x dot-notation (shortcut for reverse lookups)\n"
|
||||||
@@ -1543,8 +1544,8 @@ plus_option(char *option, bool is_batchfile,
|
|||||||
/*%
|
/*%
|
||||||
* #true returned if value was used
|
* #true returned if value was used
|
||||||
*/
|
*/
|
||||||
static const char *single_dash_opts = "46dhimnuv";
|
static const char *single_dash_opts = "46dhimnruv";
|
||||||
static const char *dash_opts = "46bcdfhikmnpqtvyx";
|
static const char *dash_opts = "46bcdfhikmnpqrtvyx";
|
||||||
static bool
|
static bool
|
||||||
dash_option(char *option, char *next, dig_lookup_t **lookup,
|
dash_option(char *option, char *next, dig_lookup_t **lookup,
|
||||||
bool *open_type_class, bool *need_clone,
|
bool *open_type_class, bool *need_clone,
|
||||||
@@ -1615,6 +1616,10 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
|||||||
case 'n':
|
case 'n':
|
||||||
/* deprecated */
|
/* deprecated */
|
||||||
break;
|
break;
|
||||||
|
case 'r':
|
||||||
|
debug("digrc (late)");
|
||||||
|
digrc = false;
|
||||||
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
(*lookup)->use_usec = true;
|
(*lookup)->use_usec = true;
|
||||||
break;
|
break;
|
||||||
@@ -1841,11 +1846,23 @@ preparse_args(int argc, char **argv) {
|
|||||||
option = &rv[0][1];
|
option = &rv[0][1];
|
||||||
while (strpbrk(option, single_dash_opts) == &option[0]) {
|
while (strpbrk(option, single_dash_opts) == &option[0]) {
|
||||||
switch (option[0]) {
|
switch (option[0]) {
|
||||||
|
case 'd':
|
||||||
|
/* For debugging early startup */
|
||||||
|
debugging = true;
|
||||||
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
memdebugging = true;
|
memdebugging = true;
|
||||||
isc_mem_debugging = ISC_MEM_DEBUGTRACE |
|
isc_mem_debugging = ISC_MEM_DEBUGTRACE |
|
||||||
ISC_MEM_DEBUGRECORD;
|
ISC_MEM_DEBUGRECORD;
|
||||||
break;
|
break;
|
||||||
|
case 'r':
|
||||||
|
/*
|
||||||
|
* Must be done early, because ~/.digrc
|
||||||
|
* is read before command line parsing
|
||||||
|
*/
|
||||||
|
debug("digrc (early)");
|
||||||
|
digrc = false;
|
||||||
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
if (ipv6only)
|
if (ipv6only)
|
||||||
fatal("only one of -4 and -6 allowed");
|
fatal("only one of -4 and -6 allowed");
|
||||||
@@ -1939,8 +1956,9 @@ parse_args(bool is_batchfile, bool config_only,
|
|||||||
*/
|
*/
|
||||||
INSIST(batchfp == NULL);
|
INSIST(batchfp == NULL);
|
||||||
homedir = getenv("HOME");
|
homedir = getenv("HOME");
|
||||||
if (homedir != NULL) {
|
if (homedir != NULL && digrc) {
|
||||||
unsigned int n;
|
unsigned int n;
|
||||||
|
debug("digrc (open)");
|
||||||
n = snprintf(rcfile, sizeof(rcfile), "%s/.digrc",
|
n = snprintf(rcfile, sizeof(rcfile), "%s/.digrc",
|
||||||
homedir);
|
homedir);
|
||||||
if (n < sizeof(rcfile)) {
|
if (n < sizeof(rcfile)) {
|
||||||
|
|||||||
@@ -131,9 +131,10 @@
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
It is possible to set per-user defaults for <command>dig</command> via
|
It is possible to set per-user defaults for <command>dig</command> via
|
||||||
<filename>${HOME}/.digrc</filename>. This file is read and
|
<filename>${HOME}/.digrc</filename>. This file is read and any
|
||||||
any options in it
|
options in it are applied before the command line arguments.
|
||||||
are applied before the command line arguments.
|
The <option>-r</option> option disables this feature, for
|
||||||
|
scripts that need predictable behaviour.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@@ -323,6 +324,16 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>-r</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Do not read options from <filename>${HOME}/.digrc</filename>.
|
||||||
|
This is useful for scripts that need predictable behaviour.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>-t <replaceable class="parameter">type</replaceable></term>
|
<term>-t <replaceable class="parameter">type</replaceable></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
|||||||
Reference in New Issue
Block a user