Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37741894
en ru br
ALT Linux repos
S:1.82-alt4
5.0: 1.82-alt3
4.1: 1.82-alt2
4.0: 1.82-alt2.M40.1

Group :: System/Servers
RPM: policyd

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: policyd-1.80-alt-uid_gid.patch
Download


Allow usage of symbolic user/group names in config file
--- ./generic.c
+++ ./generic.c
@@ -1,5 +1,6 @@
 #include "policyd.h"
-
+#include <pwd.h>
+#include <grp.h>
 /*
  *
  *
@@ -79,15 +80,23 @@ read_conf(unsigned int prog)
     /* UID */
     if(strncmp(confbuf, "UID=", 4) == 0)
     { 
-      extract(0, confbuf, 3);
-      UID=atol(extract_array[0]);
+      struct passwd *pw;
+      extract_conf(0, confbuf, 3);
+      if ((pw=getpwnam(extract_array_conf[0]))!=NULL)
+         UID=pw->pw_uid;
+      else
+         UID=atol(extract_array_conf[0]);
     }
 
     /* GID */
     if(strncmp(confbuf, "GID=", 4) == 0)
-    { 
-      extract(0, confbuf, 3);
-      GID=atol(extract_array[0]);
+    {
+      struct group *gr; 
+      extract_conf(0, confbuf, 3);
+      if ((gr=getgrnam(extract_array_conf[0]))!=NULL)
+        GID=gr->gr_gid;
+      else
+        GID=atol(extract_array_conf[0]);
     }
 
     /* DEBUG MODE */
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin