summaryrefslogtreecommitdiff
path: root/vtysh/vtysh_main.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2016-11-08 18:22:30 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2016-11-09 13:41:40 +0100
commitcb947ba3aeb154ea2ad7a55ac09ac624d05978ae (patch)
treefad9c6357a8175e85ca058d55493a5c7649615f3 /vtysh/vtysh_main.c
parente227e24231b4a7ef892ccd8ad11c424c6a2d0c43 (diff)
vtysh: detangle configuration writes
vtysh has a very convoluted and confusing setup where it isn't even clear which files are written where (since some filenames come indirectly from loading config). Detangle. This also removes writing vtysh.conf. The file is intended to be manually edited since it has some vague security concerns (if PAM is used). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'vtysh/vtysh_main.c')
-rw-r--r--vtysh/vtysh_main.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c
index 751152e911..a82acda17d 100644
--- a/vtysh/vtysh_main.c
+++ b/vtysh/vtysh_main.c
@@ -67,8 +67,9 @@ struct zebra_privs_t vtysh_privs =
};
/* Configuration file name and directory. */
-char config_default[] = SYSCONFDIR VTYSH_DEFAULT_CONFIG;
-char quagga_config_default[] = SYSCONFDIR QUAGGA_DEFAULT_CONFIG;
+static char vtysh_config_always[] = SYSCONFDIR VTYSH_DEFAULT_CONFIG;
+static char quagga_config_default[] = SYSCONFDIR QUAGGA_DEFAULT_CONFIG;
+char *quagga_config = quagga_config_default;
char history_file[MAXPATHLEN];
/* Flag for indicate executing child command. */
@@ -373,7 +374,7 @@ main (int argc, char **argv, char **env)
vty_init_vtysh ();
/* Read vtysh configuration file before connecting to daemons. */
- vtysh_read_config(config_default);
+ vtysh_read_config(vtysh_config_always);
if (markfile)
{
@@ -512,17 +513,17 @@ main (int argc, char **argv, char **env)
history_truncate_file(history_file,1000);
exit (0);
}
-
+
/* Boot startup configuration file. */
if (boot_flag)
{
- vtysh_flock_config (integrate_default);
- int ret = vtysh_read_config (integrate_default);
+ vtysh_flock_config (quagga_config);
+ int ret = vtysh_read_config (quagga_config);
vtysh_unflock_config ();
if (ret)
{
fprintf (stderr, "Configuration file[%s] processing failure: %d\n",
- integrate_default, ret);
+ quagga_config, ret);
if (no_error)
exit (0);
else