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:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user