Example #1
0
func addSnippet(snapName, uniqueName string, apps map[string]*snap.AppInfo, hooks map[string]*snap.HookInfo, snippets map[string][][]byte, snippet []byte) {
	if len(snippet) == 0 {
		return
	}
	for appName := range apps {
		securityTag := snap.AppSecurityTag(snapName, appName)
		snippets[securityTag] = append(snippets[securityTag], snippet)
	}
	for hookName := range hooks {
		securityTag := snap.HookSecurityTag(snapName, hookName)
		snippets[securityTag] = append(snippets[securityTag], snippet)
	}
	if len(apps) == 0 && len(hooks) == 0 {
		securityTag := snap.NoneSecurityTag(snapName, uniqueName)
		snippets[securityTag] = append(snippets[securityTag], snippet)
	}
}
Example #2
0
// SecurityTagGlob returns a pattern that matches all security tags belonging to
// the same snap as the given app.
func SecurityTagGlob(snapName string) string {
	return snap.AppSecurityTag(snapName, "*")
}