Allow usage of symbolic user/group names in config file --- ./generic.c +++ ./generic.c @@ -1,5 +1,6 @@ #include "policyd.h" - +#include +#include /* * * @@ -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 */