]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/vty.c
2003-06-04 Paul Jakma <paul@dishone.st>
[mirror_frr.git] / lib / vty.c
index 5ef364a08097f8d5d4d845f1ae88db1ac8acbbab..4d6eb3048e1fdea732a7328ab3d4fd0a3fe56455 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -33,6 +33,7 @@
 #include "log.h"
 #include "prefix.h"
 #include "filter.h"
+#include "privs.h"
 
 /* Vty events */
 enum event 
@@ -1851,7 +1852,8 @@ vty_serv_un (char *path)
   int sock, len;
   struct sockaddr_un serv;
   mode_t old_mask;
-
+  struct zprivs_ids_t ids;
+  
   /* First of all, unlink existing socket */
   unlink (path);
 
@@ -1894,6 +1896,18 @@ vty_serv_un (char *path)
 
   umask (old_mask);
 
+  zprivs_get_ids(&ids);
+  
+  if (ids.gid_vty > 0)
+    {
+      /* set group of socket */
+      if ( chown (path, -1, ids.gid_vty) )
+        {
+          zlog_err ("vty_serv_un: could chown socket, %s",
+                     strerror (errno) );
+        }
+    }
+
   vty_event (VTYSH_SERV, sock, NULL);
 }