X-Git-Url: https://git.sommitrealweird.co.uk/quagga-debian.git/blobdiff_plain/6d99eb2938e976229cb50d848a1bc491532b54f9..191fe7a34582876de01d3e62c2a6587baf59a283:/debian/patches/0002-80_vtysh__vtysh.c__privs.patch diff --git a/debian/patches/0002-80_vtysh__vtysh.c__privs.patch b/debian/patches/0002-80_vtysh__vtysh.c__privs.patch new file mode 100644 index 0000000..f53bfd1 --- /dev/null +++ b/debian/patches/0002-80_vtysh__vtysh.c__privs.patch @@ -0,0 +1,53 @@ +From: Debian QA Group +Date: Sat, 12 Nov 2016 01:16:08 +1100 +Subject: 80_vtysh__vtysh.c__privs + +--- + vtysh/vtysh.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c +index 9a8aedd..d182363 100644 +--- a/vtysh/vtysh.c ++++ b/vtysh/vtysh.c +@@ -26,6 +26,8 @@ + #include + #include + #include ++#include ++#include + + #include + #include +@@ -2101,6 +2103,9 @@ write_config_integrated(void) + FILE *fp; + char *integrate_sav = NULL; + ++ /* Setting file permissions */ ++ struct group *quagga_vty_group; ++ + integrate_sav = malloc (strlen (integrate_default) + + strlen (CONF_BACKUP_EXT) + 1); + strcpy (integrate_sav, integrate_default); +@@ -2128,6 +2133,21 @@ write_config_integrated(void) + vtysh_config_dump (fp); + + fclose (fp); ++ ++ errno = 0; ++ if ((quagga_vty_group = getgrnam(VTY_GROUP)) == NULL) ++ { ++ fprintf (stdout, "%% Can't get group %s: %s (%d)\n", ++ VTY_GROUP, strerror(errno), errno); ++ return CMD_WARNING; ++ } ++ ++ if ((chown(integrate_default, -1, quagga_vty_group->gr_gid)) != 0) ++ { ++ fprintf (stdout,"%% Can't chown configuration file %s: %s (%d)\n", ++ integrate_default, strerror(errno), errno); ++ return CMD_WARNING; ++ } + + if (chmod (integrate_default, CONFIGFILE_MASK) != 0) + {