~ubuntu-branches/ubuntu/trusty/apparmor/trusty-updates

« back to all changes in this revision

Viewing changes to debian/patches/change-ptrace-syntax.patch

  • Committer: Package Import Robot
  • Author(s): Jamie Strandboge
  • Date: 2014-04-04 01:07:24 UTC
  • Revision ID: package-import@ubuntu.com-20140404010724-n7pyk2cd5er3gi6m
Tags: 2.8.95~2430-0ubuntu5
debian/control: add versioned Breaks to apparmor for lxc, libvirt-bin,
lightdm and apparmor-easyprof-ubuntu

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Author: John Johansen <john.johansen@canonical.com>
 
2
Origin: https://lists.ubuntu.com/archives/apparmor/2014-March/005558.html
 
3
Subject: change syntax of ptrace target
 
4
 
 
5
change from
 
6
  ptrace /foo,
 
7
 
 
8
to
 
9
  ptrace peer=/foo,
 
10
 
 
11
Signed-off-by: John Johansen <john.johansen@canonical.com>
 
12
 
 
13
 
 
14
---
 
15
 parser/parser_yacc.y |    7 +------
 
16
 parser/ptrace.c      |   13 ++++++++-----
 
17
 parser/ptrace.h      |    2 +-
 
18
 3 files changed, 10 insertions(+), 12 deletions(-)
 
19
 
 
20
--- 2.9-test.orig/parser/parser_yacc.y
 
21
+++ 2.9-test/parser/parser_yacc.y
 
22
@@ -1349,12 +1349,7 @@
 
23
 
 
24
 ptrace_rule: TOK_PTRACE opt_ptrace_perm opt_conds TOK_END_OF_RULE
 
25
        {
 
26
-               ptrace_rule *ent = new ptrace_rule($2, $3, NULL);
 
27
-               $$ = ent;
 
28
-       }
 
29
-       |  TOK_PTRACE opt_ptrace_perm opt_conds TOK_ID TOK_END_OF_RULE
 
30
-       {
 
31
-               ptrace_rule *ent = new ptrace_rule($2, $3, $4);
 
32
+               ptrace_rule *ent = new ptrace_rule($2, $3);
 
33
                $$ = ent;
 
34
        }
 
35
 
 
36
--- 2.9-test.orig/parser/ptrace.c
 
37
+++ 2.9-test/parser/ptrace.c
 
38
@@ -39,14 +39,17 @@
 
39
                if (!cond_ent->eq)
 
40
                        yyerror("keyword \"in\" is not allowed in ptrace rules\n");
 
41
 
 
42
-               /* no valid conditionals atm */
 
43
-               yyerror("invalid ptrace rule conditional \"%s\"\n",
 
44
-                       cond_ent->name);
 
45
+               if (strcmp(cond_ent->name, "peer") == 0) {
 
46
+                       move_conditional_value("ptrace", &peer_label, cond_ent);
 
47
+               } else {
 
48
+                       yyerror("invalid ptrace rule conditional \"%s\"\n",
 
49
+                               cond_ent->name);
 
50
+               }
 
51
        }
 
52
 }
 
53
 
 
54
-ptrace_rule::ptrace_rule(int mode_p, struct cond_entry *conds, char *peer):
 
55
-       peer_label(peer), audit(0), deny(0)
 
56
+ptrace_rule::ptrace_rule(int mode_p, struct cond_entry *conds):
 
57
+       peer_label(NULL), audit(0), deny(0)
 
58
 {
 
59
        if (mode_p) {
 
60
                if (mode_p & ~AA_VALID_PTRACE_PERMS)
 
61
--- 2.9-test.orig/parser/ptrace.h
 
62
+++ 2.9-test/parser/ptrace.h
 
63
@@ -37,7 +37,7 @@
 
64
        int audit;
 
65
        int deny;
 
66
 
 
67
-       ptrace_rule(int mode, struct cond_entry *conds, char *peer);
 
68
+       ptrace_rule(int mode, struct cond_entry *conds);
 
69
        virtual ~ptrace_rule()
 
70
        {
 
71
                free(peer_label);