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.
6 Resolve this AppArmor error by ensuring that certificate files files are
7 written into /var/lib/softether instead of the current working directory:
9 Profile: /usr/sbin/softetherd
11 Name: /usr/sbin/chain_certs
13 Logfile: /var/log/kern.log
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
18 https://github.com/dajhorn/SoftEtherVPN/commit/d68db9f2cee975aad5e07b44485615f3d842ab45.
20 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
21 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
23 src/Cedar/Protocol.c | 12 ++++++------
24 src/Mayaqua/Network.c | 6 +++---
25 2 files changed, 9 insertions(+), 9 deletions(-)
27 Index: b/src/Cedar/Protocol.c
28 ===================================================================
29 --- a/src/Cedar/Protocol.c
30 +++ b/src/Cedar/Protocol.c
34 wchar_t dirname[MAX_SIZE];
35 - wchar_t exedir[MAX_SIZE];
36 + wchar_t statedir[MAX_SIZE];
38 - GetExeDirW(exedir, sizeof(exedir));
39 - CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs");
40 + GetStateDirW(statedir, sizeof(statedir));
41 + CombinePathW(dirname, sizeof(dirname), statedir, L"chain_certs");
46 void AddAllChainCertsToCertList(LIST *o)
48 wchar_t dirname[MAX_SIZE];
49 - wchar_t exedir[MAX_SIZE];
50 + wchar_t statedir[MAX_SIZE];
58 - GetExeDirW(exedir, sizeof(exedir));
59 + GetStateDirW(statedir, sizeof(statedir));
61 - CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs");
62 + CombinePathW(dirname, sizeof(dirname), statedir, L"chain_certs");
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)
73 wchar_t dirname[MAX_SIZE];
74 - wchar_t exedir[MAX_SIZE];
75 + wchar_t statedir[MAX_SIZE];
76 wchar_t txtname[MAX_SIZE];
79 @@ -12602,9 +12602,9 @@
81 o = NewListFast(NULL);
83 - GetExeDirW(exedir, sizeof(exedir));
84 + GetStateDirW(statedir, sizeof(statedir));
86 - CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs");
87 + CombinePathW(dirname, sizeof(dirname), statedir, L"chain_certs");