summaryrefslogtreecommitdiff
path: root/security/softether-devel/files/patch-log-db-pid-dir
blob: 8538d16572b0df17b100af80b9103e733c23532d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
--- src/Cedar/Admin.c.orig	2019-09-18 01:40:24 UTC
+++ src/Cedar/Admin.c
@@ -11482,7 +11482,7 @@ void SiReadLocalLogFile(SERVER *s, char *filepath, UIN
 
 	Zero(t, sizeof(RPC_READ_LOG_FILE));
 
-	GetExeDir(exe_dir, sizeof(exe_dir));
+	GetLogDir(exe_dir, sizeof(exe_dir));
 	Format(full_path, sizeof(full_path), "%s/%s", exe_dir, filepath);
 
 	// Read file
--- src/Cedar/Cedar.h.orig	2019-09-18 01:40:24 UTC
+++ src/Cedar/Cedar.h
@@ -502,22 +502,26 @@
 #define	LOG_ENGINE_BUFFER_CACHE_SIZE_MAX	(10 * 1024 * 1024)	// Write cache size
 
 // Constant such as a file name
-#define	SERVER_LOG_DIR_NAME			"@server_log"
+#define	SERVER_LOG_DIR				"server"
+#define	SERVER_LOG_DIR_NAME			"@"SERVER_LOG_DIR
 #define	BRIDGE_LOG_DIR_NAME			SERVER_LOG_DIR_NAME
 #define	SERVER_LOG_PERFIX			"vpn"
 
-#define	HUB_SECURITY_LOG_DIR_NAME	"@security_log"
-#define	HUB_SECURITY_LOG_FILE_NAME	"@security_log/%s"
+#define	HUB_SECURITY_LOG_DIR		"security"
+#define	HUB_SECURITY_LOG_DIR_NAME	"@"HUB_SECURITY_LOG_DIR
+#define	HUB_SECURITY_LOG_FILE_NAME	HUB_SECURITY_LOG_DIR_NAME"/%s"
 #define	HUB_SECURITY_LOG_PREFIX		"sec"
-#define	HUB_PACKET_LOG_DIR_NAME		"@packet_log"
-#define	HUB_PACKET_LOG_FILE_NAME	"@packet_log/%s"
+#define	HUB_PACKET_LOG_DIR		"packet"
+#define	HUB_PACKET_LOG_DIR_NAME		"@"HUB_PACKET_LOG_DIR
+#define	HUB_PACKET_LOG_FILE_NAME	HUB_PACKET_LOG_DIR_NAME"/%s"
 #define	HUB_PACKET_LOG_PREFIX		"pkt"
 
-#define	NAT_LOG_DIR_NAME			"@secure_nat_log"
-#define	NAT_LOG_FILE_NAME			"@secure_nat_log/%s"
+#define	NAT_LOG_DIR				"secure_nat"
+#define	NAT_LOG_DIR_NAME			"@"NAT_LOG_DIR
+#define	NAT_LOG_FILE_NAME			NAT_LOG_DIR_NAME"/%s"
 #define	NAT_LOG_PREFIX				"snat"
 
-#define	CLIENT_LOG_DIR_NAME			"@client_log"
+#define	CLIENT_LOG_DIR_NAME			"@client"
 #define	CLIENT_LOG_PREFIX			"client"
 
 // Packet log settings
@@ -583,7 +587,7 @@
 // Expiration date of random size cache
 #define	RAND_SIZE_CACHE_EXPIRE		(24 * 60 * 60 * 1000)
 // Management allowed IP address list file name
-#define	ADMINIP_TXT					"@adminip.txt"
+#define	ADMINIP_TXT					"$adminip.txt"
 
 #define NON_SSL_MIN_COUNT			60
 #define NON_SSL_ENTRY_EXPIRES		(10 * 60 * 1000)
@@ -634,9 +638,10 @@
 //////////////////////////////////////////////////////////////////////
 
 #define	EL_ADMIN_PORT			22888
-#define	EL_CONFIG_FILENAME		"@etherlogger.config"
-#define	EL_PACKET_LOG_DIR_NAME	"@etherlogger_log"
-#define	EL_PACKET_LOG_FILE_NAME	"@etherlogger_log/%s"
+#define	EL_CONFIG_FILENAME		"$etherlogger.config"
+#define	EL_PACKET_LOG_DIR	"etherlogger"
+#define	EL_PACKET_LOG_DIR_NAME	"@"EL_PACKET_LOG_DIR
+#define	EL_PACKET_LOG_FILE_NAME	EL_PACKET_LOG_DIR_NAME"/%s"
 #define	EL_PACKET_LOG_PREFIX	"pkt"
 #define	EL_LICENSE_CHECK_SPAN	(10 * 1000)
 
--- src/Cedar/Client.h.orig	2019-09-18 01:40:24 UTC
+++ src/Cedar/Client.h
@@ -116,7 +116,7 @@
 
 
 // Constants
-#define	CLIENT_CONFIG_FILE_NAME				"@vpn_client.config"
+#define	CLIENT_CONFIG_FILE_NAME				"$vpn_client.config"
 #define	CLIENT_DEFAULT_KEEPALIVE_HOST		"keepalive.softether.org"
 #define	CLIENT_DEFAULT_KEEPALIVE_PORT		80
 #define	CLIENT_DEFAULT_KEEPALIVE_INTERVAL	KEEP_INTERVAL_DEFAULT
@@ -136,7 +136,7 @@
 #define	CLIENT_WIN32_EXE_FILENAME_X64		"vpnclient_x64.exe"
 #define	CLIENT_WIN32_EXE_FILENAME_IA64		"vpnclient_ia64.exe"
 
-#define CLIENT_CUSTOM_INI_FILENAME			"@custom.ini"
+#define CLIENT_CUSTOM_INI_FILENAME			"$custom.ini"
 
 #define	CLIENT_GLOBAL_PULSE_NAME			"clientglobalpulse"
 
--- src/Cedar/Logging.c.orig	2019-09-18 01:40:24 UTC
+++ src/Cedar/Logging.c
@@ -111,11 +111,11 @@ static char *delete_targets[] =
 	"backup.vpn_server.config",
 	"backup.vpn_gate_svc.config",
 	"backup.etherlogger.config",
-	"packet_log",
-	"etherlogger_log",
+	HUB_PACKET_LOG_DIR,
+	EL_PACKET_LOG_DIR,
 	"secure_nat_log",
-	"security_log",
-	"server_log",
+	HUB_SECURITY_LOG_DIR,
+	SERVER_LOG_DIR,
 	"bridge_log",
 	"packet_log_archive",
 	"azure_log",
@@ -529,7 +529,7 @@ ERASER *NewEraser(LOG *log, UINT64 min_size)
 
 	e = ZeroMalloc(sizeof(ERASER));
 
-	GetExeDir(dir, sizeof(dir));
+	GetLogDir(dir, sizeof(dir));
 
 	e->Log = log;
 	e->MinFreeSpace = min_size;
--- src/Cedar/Nat.h.orig	2019-09-18 01:40:24 UTC
+++ src/Cedar/Nat.h
@@ -106,7 +106,7 @@
 #define	NAT_H
 
 // Constants
-#define	NAT_CONFIG_FILE_NAME			"@vpn_router.config"	// NAT configuration file
+#define	NAT_CONFIG_FILE_NAME			"$vpn_router.config"	// NAT configuration file
 #define	DEFAULT_NAT_ADMIN_PORT			2828		// Default port number for management
 #define	NAT_ADMIN_PORT_LISTEN_INTERVAL	1000		// Interval for trying to open a port for management
 #define	NAT_FILE_SAVE_INTERVAL			(30 * 1000)	// Interval to save
--- src/Cedar/Protocol.c.orig	2019-09-18 01:40:24 UTC
+++ src/Cedar/Protocol.c
@@ -874,7 +874,7 @@ bool TryGetRootCertChain(LIST *o, X *x, bool auto_save
 		wchar_t dirname[MAX_SIZE];
 		wchar_t exedir[MAX_SIZE];
 
-		GetExeDirW(exedir, sizeof(exedir));
+		GetDbDirW(exedir, sizeof(exedir));
 		CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs");
 		MakeDirExW(dirname);
 
@@ -1180,7 +1180,7 @@ void AddAllChainCertsToCertList(LIST *o)
 		return;
 	}
 
-	GetExeDirW(exedir, sizeof(exedir));
+	GetDbDirW(exedir, sizeof(exedir));
 
 	CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs");
 
--- src/Cedar/Server.c.orig	2019-09-18 01:40:24 UTC
+++ src/Cedar/Server.c
@@ -106,12 +106,12 @@
 
 static SERVER *server = NULL;
 static LOCK *server_lock = NULL;
-char *SERVER_CONFIG_FILE_NAME = "@vpn_server.config";
-char *SERVER_CONFIG_FILE_NAME_IN_CLIENT = "@vpn_gate_svc.config";
-char *SERVER_CONFIG_FILE_NAME_IN_CLIENT_RELAY = "@vpn_gate_relay.config";
-char *BRIDGE_CONFIG_FILE_NAME = "@vpn_bridge.config";
-char *SERVER_CONFIG_TEMPLATE_NAME = "@vpn_server_template.config";
-char *BRIDGE_CONFIG_TEMPLATE_NAME = "@vpn_server_template.config";
+char *SERVER_CONFIG_FILE_NAME = "$vpn_server.config";
+char *SERVER_CONFIG_FILE_NAME_IN_CLIENT = "$vpn_gate_svc.config";
+char *SERVER_CONFIG_FILE_NAME_IN_CLIENT_RELAY = "$vpn_gate_relay.config";
+char *BRIDGE_CONFIG_FILE_NAME = "$vpn_bridge.config";
+char *SERVER_CONFIG_TEMPLATE_NAME = "$vpn_server_template.config";
+char *BRIDGE_CONFIG_TEMPLATE_NAME = "$vpn_server_template.config";
 
 static bool server_reset_setting = false;
 
@@ -1105,16 +1105,16 @@ LIST *EnumLogFile(char *hubname)
 		hubname = NULL;
 	}
 
-	GetExeDir(exe_dir, sizeof(exe_dir));
+	GetLogDir(exe_dir, sizeof(exe_dir));
 
 	// Enumerate in the server_log
 	if (hubname == NULL)
 	{
-		EnumLogFileDir(o, "server_log");
+		EnumLogFileDir(o, SERVER_LOG_DIR);
 	}
 
 	// Enumerate in the packet_log
-	Format(tmp, sizeof(tmp), "%s/packet_log", exe_dir);
+	Format(tmp, sizeof(tmp), "%s/"HUB_PACKET_LOG_DIR, exe_dir);
 
 	if (hubname == NULL)
 	{
@@ -1130,7 +1130,7 @@ LIST *EnumLogFile(char *hubname)
 				{
 					char dir_name[MAX_PATH];
 
-					Format(dir_name, sizeof(dir_name), "packet_log/%s", e->FileName);
+					Format(dir_name, sizeof(dir_name), HUB_PACKET_LOG_DIR"/%s", e->FileName);
 
 					EnumLogFileDir(o, dir_name);
 				}
@@ -1143,13 +1143,13 @@ LIST *EnumLogFile(char *hubname)
 	{
 		char dir_name[MAX_PATH];
 
-		Format(dir_name, sizeof(dir_name), "packet_log/%s", hubname);
+		Format(dir_name, sizeof(dir_name), HUB_PACKET_LOG_DIR"/%s", hubname);
 
 		EnumLogFileDir(o, dir_name);
 	}
 
 	// Enumerate in the security_log
-	Format(tmp, sizeof(tmp), "%s/security_log", exe_dir);
+	Format(tmp, sizeof(tmp), "%s/"HUB_SECURITY_LOG_DIR, exe_dir);
 
 	if (hubname == NULL)
 	{
@@ -1165,7 +1165,7 @@ LIST *EnumLogFile(char *hubname)
 				{
 					char dir_name[MAX_PATH];
 
-					Format(dir_name, sizeof(dir_name), "security_log/%s", e->FileName);
+					Format(dir_name, sizeof(dir_name), HUB_SECURITY_LOG_DIR"/%s", e->FileName);
 
 					EnumLogFileDir(o, dir_name);
 				}
@@ -1178,7 +1178,7 @@ LIST *EnumLogFile(char *hubname)
 	{
 		char dir_name[MAX_PATH];
 
-		Format(dir_name, sizeof(dir_name), "security_log/%s", hubname);
+		Format(dir_name, sizeof(dir_name), HUB_SECURITY_LOG_DIR"/%s", hubname);
 
 		EnumLogFileDir(o, dir_name);
 	}
@@ -1199,7 +1199,7 @@ void EnumLogFileDir(LIST *o, char *dirname)
 		return;
 	}
 
-	GetExeDir(exe_dir, sizeof(exe_dir));
+	GetLogDir(exe_dir, sizeof(exe_dir));
 	Format(dir_full_path, sizeof(dir_full_path), "%s/%s", exe_dir, dirname);
 
 	dir = EnumDir(dir_full_path);
--- src/Cedar/Server.h.orig	2019-09-18 01:40:24 UTC
+++ src/Cedar/Server.h
@@ -143,7 +143,7 @@ extern char *SERVER_CONFIG_FILE_NAME;
 
 #define	MAX_PUBLIC_PORT_NUM				128
 
-#define	MEMBER_SELECTOR_TXT_FILENAME	"@member_selector.config"
+#define	MEMBER_SELECTOR_TXT_FILENAME	"$member_selector.config"
 #define	MEMBER_SELECTOR_CONNECT_TIMEOUT	2000
 #define	MEMBER_SELECTOR_DATA_TIMEOUT	5000
 
--- src/Mayaqua/Cfg.c.orig	2019-09-18 01:40:24 UTC
+++ src/Mayaqua/Cfg.c
@@ -130,12 +130,12 @@ void BackupCfgWEx(CFG_RW *rw, FOLDER *f, wchar_t *orig
 	}
 
 	// Determine the directory name
-	UniFormat(dirname, sizeof(dirname), L"@backup.%s", original[0] == L'@' ? original + 1 : original);
+	UniFormat(dirname, sizeof(dirname), L"$backup.%s", original[0] == L'$' ? original + 1 : original);
 
 	// Determine the file name
 	LocalTime(&st);
 	UniFormat(datestr, sizeof(datestr), L"%04u%02u%02u%02u_%s",
-		st.wYear, st.wMonth, st.wDay, st.wHour, original[0] == L'@' ? original + 1 : original);
+		st.wYear, st.wMonth, st.wDay, st.wHour, original[0] == L'$' ? original + 1 : original);
 
 	if (revision_number == INFINITE)
 	{
@@ -144,7 +144,7 @@ void BackupCfgWEx(CFG_RW *rw, FOLDER *f, wchar_t *orig
 	else
 	{
 		UniFormat(filename, sizeof(filename), L"%08u_%s",
-			revision_number, original[0] == L'@' ? original + 1 : original);
+			revision_number, original[0] == L'$' ? original + 1 : original);
 	}
 
 	// Don't save if the date and time has not been changed
--- src/Mayaqua/Cfg.h.orig	2019-09-18 01:40:24 UTC
+++ src/Mayaqua/Cfg.h
@@ -108,7 +108,7 @@
 // Macro
 //#define	CHECK_CFG_NAME_EXISTS			// Check duplication of the existing name
 
-#define	SAVE_BINARY_FILE_NAME_SWITCH	L"@save_binary"
+#define	SAVE_BINARY_FILE_NAME_SWITCH	L"$save_binary"
 
 // Constants
 #define	TAG_DECLARE			"declare"
--- src/Mayaqua/FileIO.c.orig	2019-09-18 01:40:24 UTC
+++ src/Mayaqua/FileIO.c
@@ -1460,6 +1460,36 @@ void GetExeNameW(wchar_t *name, UINT size)
 	UniStrCpy(name, size, exe_file_name_w);
 }
 
+void GetLogDir(char *name, UINT size)
+{
+	Format(name, size, "%%SE_LOGDIR%%");
+}
+
+void GetLogDirW(wchar_t *name, UINT size)
+{
+	UniFormat(name, size, L"%%SE_LOGDIR%%");
+}
+
+void GetDbDir(char *name, UINT size)
+{
+	Format(name, size, "%%SE_DBDIR%%");
+}
+
+void GetDbDirW(wchar_t *name, UINT size)
+{
+	UniFormat(name, size, L"%%SE_DBDIR%%");
+}
+
+void GetPidDir(char *name, UINT size)
+{
+	Format(name, size, "%%SE_PIDDIR%%");
+}
+
+void GetPidDirW(wchar_t *name, UINT size)
+{
+	UniFormat(name, size, L"%%SE_PIDDIR%%");
+}
+
 // Initialization of the aquisition of the EXE file name
 void InitGetExeName(char *arg)
 {
@@ -2382,14 +2412,20 @@ void InnerFilePathW(wchar_t *dst, UINT size, wchar_t *
 		return;
 	}
 
-	if (src[0] != L'@')
+	if (src[0] != L'@' && src[0] != L'$')
 	{
 		NormalizePathW(dst, size, src);
 	}
+	else if (src[0] == L'$')
+	{
+		wchar_t dir[MAX_SIZE];
+		GetDbDirW(dir, sizeof(dir));
+		ConbinePathW(dst, size, dir, &src[1]);
+	}
 	else
 	{
 		wchar_t dir[MAX_SIZE];
-		GetExeDirW(dir, sizeof(dir));
+		GetLogDirW(dir, sizeof(dir));
 		ConbinePathW(dst, size, dir, &src[1]);
 	}
 }
--- src/Mayaqua/FileIO.h.orig	2019-09-18 01:40:24 UTC
+++ src/Mayaqua/FileIO.h
@@ -340,6 +340,12 @@ void GetExeName(char *name, UINT size);
 void GetExeNameW(wchar_t *name, UINT size);
 void GetExeDir(char *name, UINT size);
 void GetExeDirW(wchar_t *name, UINT size);
+void GetLogDir(char *name, UINT size);
+void GetLogDirW(wchar_t *name, UINT size);
+void GetDbDir(char *name, UINT size);
+void GetDbDirW(wchar_t *name, UINT size);
+void GetPidDir(char *name, UINT size);
+void GetPidDirW(wchar_t *name, UINT size);
 void BuildHamcore(char *dst_filename, char *src_dir, bool unix_only);
 int CompareHamcore(void *p1, void *p2);
 void InitHamcore();
--- src/Mayaqua/Network.c.orig	2019-09-18 01:40:24 UTC
+++ src/Mayaqua/Network.c
@@ -13048,7 +13048,7 @@ void AddChainSslCertOnDirectory(struct ssl_ctx_st *ctx
 
 	o = NewListFast(NULL);
 
-	GetExeDirW(exedir, sizeof(exedir));
+	GetDbDirW(exedir, sizeof(exedir));
 
 	CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs");
 
--- src/Mayaqua/Network.h.orig	2019-09-18 01:40:24 UTC
+++ src/Mayaqua/Network.h
@@ -150,7 +150,7 @@ struct DYN_VALUE
 #define	SSL_LOGGING_DIRNAME			"@ssl_log"
 
 // Private IP list file
-#define	PRIVATE_IP_TXT_FILENAME		"@private_ip.txt"
+#define	PRIVATE_IP_TXT_FILENAME		"$private_ip.txt"
 
 // Start range of the random UDP port
 #define	RAND_UDP_PORT_START			5000
--- src/Mayaqua/Table.h.orig	2019-09-18 01:40:24 UTC
+++ src/Mayaqua/Table.h
@@ -110,7 +110,7 @@
 #define	LANGLIST_FILENAME		"|languages.txt"
 #define	LANGLIST_FILENAME_WINE	"|languages_wine.txt"
 
-#define	LANG_CONFIG_FILENAME	L"@lang.config"
+#define	LANG_CONFIG_FILENAME	L"$lang.config"
 #define	LANG_CONFIG_TEMPLETE	"|lang.config"
 
 // Language constant
--- src/Mayaqua/Unix.c.orig	2019-09-18 01:40:24 UTC
+++ src/Mayaqua/Unix.c
@@ -915,7 +915,7 @@ void *UnixNewSingleInstance(char *instance_name)
 		StrCpy(tmp, sizeof(tmp), instance_name);
 	}
 
-	GetExeDir(dir, sizeof(dir));
+	GetPidDir(dir, sizeof(dir));
 
 	// File name generation
 	Format(name, sizeof(name), "%s/.%s", dir, tmp);
@@ -2367,7 +2367,7 @@ void UnixGenPidFileName(char *name, UINT size)
 		return;
 	}
 
-	GetExeDir(dir, sizeof(dir));
+	GetPidDir(dir, sizeof(dir));
 
 	GetExeName(exe_name, sizeof(exe_name));
 	StrCat(exe_name, sizeof(exe_name), ":pid_hash");
@@ -2412,7 +2412,7 @@ void UnixGenCtlFileName(char *name, UINT size)
 		return;
 	}
 
-	GetExeDir(dir, sizeof(dir));
+	GetPidDir(dir, sizeof(dir));
 
 	GetExeName(exe_name, sizeof(exe_name));
 	StrCat(exe_name, sizeof(exe_name), ":pid_hash");