1 From: Debian QA Group <packages@qa.debian.org>
 
   2 Date: Sat, 12 Nov 2016 01:16:08 +1100
 
   3 Subject: 80_vtysh__vtysh.c__privs
 
   6  vtysh/vtysh.c | 20 ++++++++++++++++++++
 
   7  1 file changed, 20 insertions(+)
 
   9 diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
 
  10 index 9a8aedd..d182363 100644
 
  15  #include <sys/resource.h>
 
  17 +#include <sys/types.h>
 
  20  #include <readline/readline.h>
 
  21  #include <readline/history.h>
 
  22 @@ -2101,6 +2103,9 @@ write_config_integrated(void)
 
  24    char *integrate_sav = NULL;
 
  26 +  /* Setting file permissions */
 
  27 +  struct group *quagga_vty_group;
 
  29    integrate_sav = malloc (strlen (integrate_default) +
 
  30                           strlen (CONF_BACKUP_EXT) + 1);
 
  31    strcpy (integrate_sav, integrate_default);
 
  32 @@ -2128,6 +2133,21 @@ write_config_integrated(void)
 
  33    vtysh_config_dump (fp);
 
  38 +  if ((quagga_vty_group = getgrnam(VTY_GROUP)) == NULL) 
 
  40 +      fprintf (stdout, "%% Can't get group %s: %s (%d)\n",
 
  41 +        VTY_GROUP, strerror(errno), errno);
 
  45 +  if ((chown(integrate_default, -1, quagga_vty_group->gr_gid)) != 0)
 
  47 +      fprintf (stdout,"%% Can't chown configuration file %s: %s (%d)\n", 
 
  48 +       integrate_default, strerror(errno), errno);
 
  52    if (chmod (integrate_default, CONFIGFILE_MASK) != 0)