6cb4e728b406620e48f135542ecf6af9d344957d
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / softether / 0003-change-GetExeDir-to-GetStateDir-in-Cedar-and-Mayaqua.patch
1 From d68db9f2cee975aad5e07b44485615f3d842ab45 Mon Sep 17 00:00:00 2001
2 From: Darik Horn <dajhorn@vanadac.com>
3 Date: Fri, 11 Jul 2014 16:17:18 -0400
4 Subject: [PATCH] Change GetExeDir to GetStateDir in Cedar and Mayaqua.
5
6 Resolve this AppArmor error by ensuring that certificate files files are
7 written into /var/lib/softether instead of the current working directory:
8
9         Profile: /usr/sbin/softetherd
10         Operation: mkdir
11         Name: /usr/sbin/chain_certs
12         Denied: c
13         Logfile: /var/log/kern.log
14
15         type=1400 audit: apparmor="DENIED" operation="mkdir" profile="/usr/sbin/softetherd" name="/usr/sbin/chain_certs/" pid=36448 comm="softetherd" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
16
17 Taken from Github
18 https://github.com/dajhorn/SoftEtherVPN/commit/d68db9f2cee975aad5e07b44485615f3d842ab45.
19
20 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
21 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
22 ---
23  src/Cedar/Protocol.c  | 12 ++++++------
24  src/Mayaqua/Network.c |  6 +++---
25  2 files changed, 9 insertions(+), 9 deletions(-)
26
27 Index: b/src/Cedar/Protocol.c
28 ===================================================================
29 --- a/src/Cedar/Protocol.c
30 +++ b/src/Cedar/Protocol.c
31 @@ -161,10 +161,10 @@
32                 UINT i;\r
33                 DIRLIST *dir;\r
34                 wchar_t dirname[MAX_SIZE];\r
35 -               wchar_t exedir[MAX_SIZE];\r
36 +               wchar_t statedir[MAX_SIZE];\r
37  \r
38 -               GetExeDirW(exedir, sizeof(exedir));\r
39 -               CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs");\r
40 +               GetStateDirW(statedir, sizeof(statedir));\r
41 +               CombinePathW(dirname, sizeof(dirname), statedir, L"chain_certs");\r
42                 MakeDirExW(dirname);\r
43  \r
44                 if (auto_save)\r
45 @@ -461,7 +461,7 @@
46  void AddAllChainCertsToCertList(LIST *o)\r
47  {\r
48         wchar_t dirname[MAX_SIZE];\r
49 -       wchar_t exedir[MAX_SIZE];\r
50 +       wchar_t statedir[MAX_SIZE];\r
51         DIRLIST *dir;\r
52         // Validate arguments\r
53         if (o == NULL)\r
54 @@ -469,9 +469,9 @@
55                 return;\r
56         }\r
57  \r
58 -       GetExeDirW(exedir, sizeof(exedir));\r
59 +       GetStateDirW(statedir, sizeof(statedir));\r
60  \r
61 -       CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs");\r
62 +       CombinePathW(dirname, sizeof(dirname), statedir, L"chain_certs");\r
63  \r
64         MakeDirExW(dirname);\r
65  \r
66 Index: b/src/Mayaqua/Network.c
67 ===================================================================
68 --- a/src/Mayaqua/Network.c
69 +++ b/src/Mayaqua/Network.c
70 @@ -12588,7 +12588,7 @@
71  void AddChainSslCertOnDirectory(struct ssl_ctx_st *ctx)\r
72  {\r
73         wchar_t dirname[MAX_SIZE];\r
74 -       wchar_t exedir[MAX_SIZE];\r
75 +       wchar_t statedir[MAX_SIZE];\r
76         wchar_t txtname[MAX_SIZE];\r
77         DIRLIST *dir;\r
78         LIST *o;\r
79 @@ -12602,9 +12602,9 @@
80  \r
81         o = NewListFast(NULL);\r
82  \r
83 -       GetExeDirW(exedir, sizeof(exedir));\r
84 +       GetStateDirW(statedir, sizeof(statedir));\r
85  \r
86 -       CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs");\r
87 +       CombinePathW(dirname, sizeof(dirname), statedir, L"chain_certs");\r
88  \r
89         MakeDirExW(dirname);\r
90  \r