Lines Matching refs:path
11 # blocks[0] = ['path' = '/sys', 'children' = [A,B] ]
12 # blocks[1] = ['path' = '/proc/sys', 'children' = [ E ] ]
13 # A = [ 'path' = 'fs', children = [C] ]
14 # C = [ 'path' = 'cgroup', children = [F] ]
15 # B = [ 'path' = 'class', children = [D] ]
16 # D = [ 'path' = 'net', children = [F] ]
17 # E = [ 'path' = 'shm*' ]
18 # F = [ 'path' = '**' ]
21 def add_block(path):
23 if b['path'] == path:
26 blocks.append({'path': path.strip(), 'children': []})
28 # @prev is an array of dicts which containing 'path' and
29 # 'children'. @path is a string. We are looking for an entry
30 # in @prev which contains @path, and will return its
32 def child_get(prev, path):
34 if p['path'] == path:
39 def add_allow(path):
43 l = len(b['path'])
44 if len(path) <= l:
47 if path[0:l] == b['path']:
51 print("allow with no previous block at %s" % path)
53 p = path[l:].strip()
58 n = {'path': s.strip(), 'children': []}
59 tmp = child_get(prev, n['path'])
75 (cmd, path) = x.split(' ')
79 add_block(path)
81 add_allow(path)
92 if index >= len(c['path']):
94 if ref[0:index] != c['path'][0:index]:
96 if c['path'][index] not in r:
97 r = r + c['path'][index]
109 for char in range(len(c['path'])):
110 if char == len(c['path'])-1 and c['path'][char] == '*':
112 if char == len(c['path'])-2:
113 if c['path'][char:char+2] == '**':
115 x = collect_chars(children, c['path'], char)
117 c['path'][0:char], x)
119 if c['path'] != '**' and c['path'][len(c['path'])-1] != '*':
120 newdeny = "deny %s/%s?*{,/**}" % (pathsofar, c['path'])
122 elif c['path'] != '**':
123 newdeny = "deny %s/%s/**" % (pathsofar, c['path'])
126 newpath = "%s/%s" % (pathsofar, c['path'])
130 gen_denies(b['path'], b['children'])