2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-30 22:05:27 +00:00

parser: refactor variables and symbols table into their own class

While symtab for now has only static members, it will allow for a
change in the future for each profile to have their own symbols like
profile_name, etc.
This commit is contained in:
Georgia Garcia
2025-06-03 18:34:08 -03:00
parent 0ea74cd19d
commit dfbd2dc4b1
12 changed files with 978 additions and 1168 deletions

View File

@@ -532,35 +532,6 @@ char *processid(const char *string, int len)
return processunquoted(string, len);
}
/* strip off surrounding delimiters around variables */
char *process_var(const char *var)
{
const char *orig = var;
int len = strlen(var);
if (*orig == '@' || *orig == '$') {
orig++;
len--;
} else {
PERROR("ASSERT: Found var '%s' without variable prefix\n",
var);
return NULL;
}
if (*orig == '{') {
orig++;
len--;
if (orig[len - 1] != '}') {
PERROR("ASSERT: No matching '}' in variable '%s'\n",
var);
return NULL;
} else
len--;
}
return strndup(orig, len);
}
/* returns -1 if value != true or false, otherwise 0 == false, 1 == true */
int str_to_boolean(const char *value)
{