summaryrefslogtreecommitdiff
blob: a03dd72dfea7c750f5fe6477d5003154c1b0ec28 (plain)
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
From 61ea167f9b4ab34a1437736cbda20d21efd06e30 Mon Sep 17 00:00:00 2001
From: Jaco Kroon <jaco@uls.co.za>
Date: Tue, 11 May 2021 16:44:55 +0200
Subject: [PATCH] Minimum set of changes to make gcc10 compatible.

This does not fix any of the other bugs I spotted along the way
(module_path being assigned a static string and then later free()d for
example).
---
 .gitignore                            |  2 ++
 include/captagent/api.h               | 10 ++++++++--
 include/captagent/modules.h           |  2 +-
 src/captagent.c                       |  2 --
 src/conf_function.c                   |  3 +++
 src/conf_function.h                   |  2 --
 src/modules.c                         |  3 +++
 src/modules/protocol/tls/decryption.h |  6 +-----
 src/modules/protocol/tls/parser_tls.h | 12 ++++++------
 9 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/.gitignore b/.gitignore
index d2ed328..a7cd5a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@ INSTALL
 Makefile
 Makefile.in
 aclocal.m4
+compile
 config.guess
 src/config.h
 src/config.h.in
@@ -45,5 +46,6 @@ pkg/debian/files
 pkg/debian/captagent/
 pkg/debian/captagent.init
 src/captagent
+src/capplan.tab.c
 *.dh-orig
 
diff --git a/include/captagent/api.h b/include/captagent/api.h
index 4ec62de..d550875 100644
--- a/include/captagent/api.h
+++ b/include/captagent/api.h
@@ -43,6 +43,13 @@
 
 #include "config.h"
 
+#ifdef __GNUC__
+/* GNU C */
+#define PACK_OFF __attribute__ ((__packed__));
+#else
+#define PACK_OFF
+#endif
+
 #ifndef AGENT_CONFIG_DIR
 #define AGENT_CONFIG_DIR "/usr/local/etc/captagent/"
 #endif //DEF_CONF
@@ -120,9 +127,8 @@ typedef struct stats_object {
 
 extern struct stats_object stats_obj;
 
-struct hep_module *hepmod;
 extern int get_basestat(char *module, char *stats, size_t len);
-struct module *module_list;
+extern struct module *module_list;
 
 #ifndef TRUE
 #define TRUE  1
diff --git a/include/captagent/modules.h b/include/captagent/modules.h
index 1eedabe..ec0676b 100644
--- a/include/captagent/modules.h
+++ b/include/captagent/modules.h
@@ -27,7 +27,7 @@
 #ifndef MODULES_H_
 #define MODULES_H_
 
-char *module_path;
+extern char *module_path;
 
 #define VAR_PARAM_NO  -128
 
diff --git a/src/captagent.c b/src/captagent.c
index b5c3081..6f5f533 100644
--- a/src/captagent.c
+++ b/src/captagent.c
@@ -321,8 +321,6 @@ int main(int argc, char *argv[]) {
 	/* PATH */
 	module_path = MODULE_DIR;
 
-	hepmod = malloc(sizeof(hep_module_t));
-
 	load_xml_config();
 
 	/*CORE CONFIG */
diff --git a/src/conf_function.c b/src/conf_function.c
index 478ce73..9f4648f 100644
--- a/src/conf_function.c
+++ b/src/conf_function.c
@@ -57,6 +57,9 @@
 #define ROUTE_MAX_REC_LEV 10 /* maximum number of recursive calls
                                                            for capture()*/
 
+struct sr_module* modules; /* global module list */
+
+
 /* ret= 0! if action -> end of list(e.g DROP),
       > 0 to continue processing next actions
    and <0 on error */
diff --git a/src/conf_function.h b/src/conf_function.h
index 3ee82ba..ff532d9 100644
--- a/src/conf_function.h
+++ b/src/conf_function.h
@@ -79,8 +79,6 @@ struct sr_module{
         struct sr_module* next;
 };
 
-struct sr_module* modules; /* global module list */
-
 int register_builtin_modules();
 int load_module(char* path);
 cmd_function find_export2(char* name, int param_no);
diff --git a/src/modules.c b/src/modules.c
index 0ad00b5..c0397e1 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -40,6 +40,9 @@
 #include <captagent/modules_api.h>
 #include <captagent/modules.h>
 
+struct module *module_list;
+char *module_path;
+
 int register_module(char *resource_name, xml_node *config, bool global) {
 	const char *error;
 	module_exports_t *exp;
diff --git a/src/modules/protocol/tls/decryption.h b/src/modules/protocol/tls/decryption.h
index fd5e0d7..b553195 100644
--- a/src/modules/protocol/tls/decryption.h
+++ b/src/modules/protocol/tls/decryption.h
@@ -35,6 +35,7 @@
 #include <gcrypt.h>
 #include "define.h"
 #include "uthash.h"
+#include "captagent/api.h"
 
 #define SHA384 0x009d
 #define SHA256 0x009c
@@ -68,11 +69,6 @@ int private_decrypt(unsigned char * enc_data, int data_len, unsigned char * key,
 
 /* **************************** */
 
-#ifdef __GNUC__
-/* GNU C */
-#define PACK_OFF __attribute__ ((__packed__));
-#endif
-
 
 /* ++++++++++++++++++++++++ CISCO HDLC +++++++++++++++++++++++++ */
 struct chdlc_hdr
diff --git a/src/modules/protocol/tls/parser_tls.h b/src/modules/protocol/tls/parser_tls.h
index e6d6aec..c24076b 100644
--- a/src/modules/protocol/tls/parser_tls.h
+++ b/src/modules/protocol/tls/parser_tls.h
@@ -45,15 +45,15 @@
 #define TLS12   0x0303
 
 // Record Type values
-enum {
+enum Record_Type {
   CHANGE_CIPHER_SPEC = 20,
   ALERT              = 21,
   HANDSHAKE          = 22,
   APPLICATION_DATA   = 23
-} Record_Type;
+};
 
 // Handshake Type values
-enum {
+enum Handshake_Type {
   HELLO_REQUEST       = 0,
   CLIENT_HELLO        = 1,
   SERVER_HELLO        = 2,
@@ -66,10 +66,10 @@ enum {
   CERTIFICATE_VERIFY  = 15,
   CLIENT_KEY_EXCHANGE = 16,
   FINISHED            = 20
-} Handshake_Type;
+};
 
 // Client Certificate types for Certificate Request
-enum {
+enum Client_Certificate_Type {
   RSA_SIGN                  = 1,
   DSS_SIGN                  = 2,
   RSA_FIXED_DH              = 3,
@@ -77,7 +77,7 @@ enum {
   RSA_EPHEMERAL_DH_RESERVED = 5,
   DSS_EPHEMERAL_DH_RESERVED = 6,
   FORTEZZA_DMS_RESERVED     = 20
-} Client_Certificate_Type;
+};
 
 
 // Chipher Suite availlable for decription
-- 
2.26.3