e system main - fix system.conf parsing to parse all of it

forgot my for loop.. :)

fixes T8675
This commit is contained in:
Carsten Haitzler 2020-04-22 13:42:32 +01:00
parent 2e75a9410e
commit fc6c423a9f
1 changed files with 49 additions and 33 deletions

View File

@ -25,7 +25,7 @@ _etc_enlightenment_system_conf(void)
#define MAXGROUPS 1024
int gn, i;
gid_t gl[MAXGROUPS];
char type[32], usergroup[256], cmd[32], glob[256];
char type[32], usergroup[256], cmd[32], glob[256], buf[1024];
Eina_Bool in_usergroup;
FILE *f = fopen("/etc/enlightenment/system.conf", "r");
if (!f) return;
@ -36,7 +36,14 @@ _etc_enlightenment_system_conf(void)
ERR("User %i member of too many groups\n", uid);
exit(9);
}
if (fscanf(f, "%31s %255s %31s %255s\n", type, usergroup, cmd, glob) == 4)
while (fgets(buf, sizeof(buf), f))
{
int num;
if (buf[0] == '#') continue;
num = sscanf(buf, "%31s %255s %31s %255s\n",
type, usergroup, cmd, glob);
if (num == 4)
{
if (!strcmp(type, "user:"))
{
@ -52,7 +59,11 @@ _etc_enlightenment_system_conf(void)
{
int ok = _conf_allow_deny(cmd, glob);
if (ok == 1) goto allow;
else if (ok == -1) goto deny;
else if (ok == -1)
{
ERR("Denied by rule:\n%s\n", buf);
goto deny;
}
}
}
else if (!strcmp(type, "group:"))
@ -77,7 +88,12 @@ _etc_enlightenment_system_conf(void)
{
int ok = _conf_allow_deny(cmd, glob);
if (ok == 1) goto allow;
else if (ok == -1) goto deny;
else if (ok == -1)
{
ERR("Denied by rule:\n%s\n", buf);
goto deny;
}
}
}
}
}