aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2023-12-02 11:44:50 -0900
committerDavid M. Syzdek <david@syzdek.net>2023-12-02 11:44:50 -0900
commitebba9b019d887e35d730c6c87489316d3e08bcda (patch)
tree48542a64ce07d7fa2bd6decf53384d911987acff
parent61a3f128560179bfc6a0c171cd45bcd1216dcf59 (diff)
downloadcorset-ebba9b019d887e35d730c6c87489316d3e08bcda.tar.gz
corset-ebba9b019d887e35d730c6c87489316d3e08bcda.tar.bz2
corset-ebba9b019d887e35d730c6c87489316d3e08bcda.tar.xz
corset-ebba9b019d887e35d730c6c87489316d3e08bcda.zip
libcorset: renaming members of 'struct _corset'
-rw-r--r--include/corset.h20
-rw-r--r--lib/libcorset/largs.c8
-rw-r--r--lib/libcorset/ldebug.c14
-rw-r--r--lib/libcorset/lmemory.c48
-rw-r--r--lib/mod_dummy/mod_dummy.c101
-rw-r--r--lib/mod_dummy/mod_dummy.h111
-rw-r--r--lib/mod_dummy/mod_dummy.sym32
7 files changed, 289 insertions, 45 deletions
diff --git a/include/corset.h b/include/corset.h
index 231dab2..3d6b5ff 100644
--- a/include/corset.h
+++ b/include/corset.h
@@ -77,16 +77,16 @@
77 77
78struct _corset 78struct _corset
79{ 79{
80 int cnf_verbose; 80 int cor_verbose;
81 unsigned cnf_flags; 81 unsigned cor_flags;
82 unsigned cnf_ctx_cnt; 82 unsigned cor_ctx_cnt;
83 unsigned cnf_mods_cnt; 83 unsigned cor_mods_cnt;
84 char * cnf_conffile; 84 char * cor_conffile;
85 char * cnf_moddir; 85 char * cor_moddir;
86 char * cnf_pidfile; 86 char * cor_pidfile;
87 char * cnf_sockfile; 87 char * cor_sockfile;
88 corset_mod_t ** cnf_mods; 88 corset_mod_t ** cor_mods;
89 corset_ctx_t ** cnf_ctx; 89 corset_ctx_t ** cor_ctx;
90}; 90};
91 91
92 92
diff --git a/lib/libcorset/largs.c b/lib/libcorset/largs.c
index 5250cdf..91d54f4 100644
--- a/lib/libcorset/largs.c
+++ b/lib/libcorset/largs.c
@@ -106,7 +106,7 @@ corset_getopt(
106 break; 106 break;
107 107
108 case 'f': 108 case 'f':
109 cnf->cnf_flags |= CORSET_FLG_FOREGROUND; 109 cnf->cor_flags |= CORSET_FLG_FOREGROUND;
110 break; 110 break;
111 111
112 case 'h': 112 case 'h':
@@ -122,7 +122,7 @@ corset_getopt(
122 break; 122 break;
123 123
124 case 'q': 124 case 'q':
125 cnf->cnf_flags |= CORSET_FLG_QUIET; 125 cnf->cor_flags |= CORSET_FLG_QUIET;
126 break; 126 break;
127 127
128 case 'V': 128 case 'V':
@@ -130,7 +130,7 @@ corset_getopt(
130 return(2); 130 return(2);
131 131
132 case 'v': 132 case 'v':
133 cnf->cnf_verbose++; 133 cnf->cor_verbose++;
134 break; 134 break;
135 135
136 case '?': 136 case '?':
@@ -144,7 +144,7 @@ corset_getopt(
144 }; 144 };
145 }; 145 };
146 146
147 if ( ((cnf->cnf_flags & CORSET_FLG_QUIET)) && ((cnf->cnf_verbose)) ) 147 if ( ((cnf->cor_flags & CORSET_FLG_QUIET)) && ((cnf->cor_verbose)) )
148 { 148 {
149 fprintf(stderr, "%s: incompatible options `-q' and `-v'\n", corset_prog_name_ptr); 149 fprintf(stderr, "%s: incompatible options `-q' and `-v'\n", corset_prog_name_ptr);
150 fprintf(stderr, "Try `%s --help' for more information.\n", corset_prog_name_ptr); 150 fprintf(stderr, "Try `%s --help' for more information.\n", corset_prog_name_ptr);
diff --git a/lib/libcorset/ldebug.c b/lib/libcorset/ldebug.c
index ca531d6..db85e0e 100644
--- a/lib/libcorset/ldebug.c
+++ b/lib/libcorset/ldebug.c
@@ -90,13 +90,13 @@ corset_debug_config(
90 corset_debug_print_section(fs, 0, NULL); 90 corset_debug_print_section(fs, 0, NULL);
91 91
92 corset_debug_print_section(fs, 0, "General Options:"); 92 corset_debug_print_section(fs, 0, "General Options:");
93 corset_debug_print_str(fs, 0, "Quiet Mode:", (((cnf->cnf_flags & CORSET_FLG_QUIET)) ? "yes" : "no")); 93 corset_debug_print_str(fs, 0, "Quiet Mode:", (((cnf->cor_flags & CORSET_FLG_QUIET)) ? "yes" : "no"));
94 corset_debug_print_str(fs, 0, "Verbose Mode:", (((cnf->cnf_verbose)) ? "yes" : "no")); 94 corset_debug_print_str(fs, 0, "Verbose Mode:", (((cnf->cor_verbose)) ? "yes" : "no"));
95 corset_debug_print_str(fs, 0, "Run in Foreground:", (((cnf->cnf_flags & CORSET_FLG_FOREGROUND)) ? "yes" : "no")); 95 corset_debug_print_str(fs, 0, "Run in Foreground:", (((cnf->cor_flags & CORSET_FLG_FOREGROUND)) ? "yes" : "no"));
96 corset_debug_print_str(fs, 0, "Configuration File:", cnf->cnf_conffile); 96 corset_debug_print_str(fs, 0, "Configuration File:", cnf->cor_conffile);
97 corset_debug_print_str(fs, 0, "PID File:", cnf->cnf_pidfile); 97 corset_debug_print_str(fs, 0, "PID File:", cnf->cor_pidfile);
98 corset_debug_print_str(fs, 0, "Control Socket:", cnf->cnf_sockfile); 98 corset_debug_print_str(fs, 0, "Control Socket:", cnf->cor_sockfile);
99 corset_debug_print_str(fs, 0, "Module Directory:", cnf->cnf_moddir); 99 corset_debug_print_str(fs, 0, "Module Directory:", cnf->cor_moddir);
100 corset_debug_print_section(fs, 0, NULL); 100 corset_debug_print_section(fs, 0, NULL);
101 101
102 return; 102 return;
diff --git a/lib/libcorset/lmemory.c b/lib/libcorset/lmemory.c
index d73bbe3..b8080c3 100644
--- a/lib/libcorset/lmemory.c
+++ b/lib/libcorset/lmemory.c
@@ -123,8 +123,8 @@ corset_destroy(
123 if (!(cnf)) 123 if (!(cnf))
124 return; 124 return;
125 125
126 if ((cnf->cnf_pidfile)) 126 if ((cnf->cor_pidfile))
127 free(cnf->cnf_pidfile); 127 free(cnf->cor_pidfile);
128 free(cnf); 128 free(cnf);
129 129
130 return; 130 return;
@@ -142,39 +142,39 @@ corset_get_param(
142 switch(option) 142 switch(option)
143 { 143 {
144 case CORSET_OPT_CONFFILE: 144 case CORSET_OPT_CONFFILE:
145 if ((str = bindle_strdup(cnf->cnf_conffile)) == NULL) 145 if ((str = bindle_strdup(cnf->cor_conffile)) == NULL)
146 return(-1); 146 return(-1);
147 *((char **)outvalue) = str; 147 *((char **)outvalue) = str;
148 return(0); 148 return(0);
149 149
150 case CORSET_OPT_FOREGROUND: 150 case CORSET_OPT_FOREGROUND:
151 *((int *)outvalue) = ((cnf->cnf_flags & CORSET_FLG_FOREGROUND)) ? 1 : 0; 151 *((int *)outvalue) = ((cnf->cor_flags & CORSET_FLG_FOREGROUND)) ? 1 : 0;
152 return(0); 152 return(0);
153 153
154 case CORSET_OPT_MODDIR: 154 case CORSET_OPT_MODDIR:
155 if ((str = bindle_strdup(cnf->cnf_moddir)) == NULL) 155 if ((str = bindle_strdup(cnf->cor_moddir)) == NULL)
156 return(-1); 156 return(-1);
157 *((char **)outvalue) = str; 157 *((char **)outvalue) = str;
158 return(0); 158 return(0);
159 159
160 case CORSET_OPT_PIDFILE: 160 case CORSET_OPT_PIDFILE:
161 if ((str = bindle_strdup(cnf->cnf_pidfile)) == NULL) 161 if ((str = bindle_strdup(cnf->cor_pidfile)) == NULL)
162 return(-1); 162 return(-1);
163 *((char **)outvalue) = str; 163 *((char **)outvalue) = str;
164 return(0); 164 return(0);
165 165
166 case CORSET_OPT_QUIET: 166 case CORSET_OPT_QUIET:
167 *((int *)outvalue) = ((cnf->cnf_flags & CORSET_FLG_QUIET)) ? 1 : 0; 167 *((int *)outvalue) = ((cnf->cor_flags & CORSET_FLG_QUIET)) ? 1 : 0;
168 return(0); 168 return(0);
169 169
170 case CORSET_OPT_SOCKET: 170 case CORSET_OPT_SOCKET:
171 if ((str = bindle_strdup(cnf->cnf_sockfile)) == NULL) 171 if ((str = bindle_strdup(cnf->cor_sockfile)) == NULL)
172 return(-1); 172 return(-1);
173 *((char **)outvalue) = str; 173 *((char **)outvalue) = str;
174 return(0); 174 return(0);
175 175
176 case CORSET_OPT_VERBOSE: 176 case CORSET_OPT_VERBOSE:
177 *((int *)outvalue) = cnf->cnf_verbose; 177 *((int *)outvalue) = cnf->cor_verbose;
178 return(0); 178 return(0);
179 179
180 default: 180 default:
@@ -220,9 +220,9 @@ corset_set_param(
220 invalue = ((invalue)) ? invalue : CORSET_DFLT_CONFFILE; 220 invalue = ((invalue)) ? invalue : CORSET_DFLT_CONFFILE;
221 if ((str = bindle_strdup(invalue)) == NULL) 221 if ((str = bindle_strdup(invalue)) == NULL)
222 return(-1); 222 return(-1);
223 if ((cnf->cnf_conffile)) 223 if ((cnf->cor_conffile))
224 free(cnf->cnf_conffile); 224 free(cnf->cor_conffile);
225 cnf->cnf_conffile = str; 225 cnf->cor_conffile = str;
226 return(0); 226 return(0);
227 227
228 case CORSET_OPT_FOREGROUND: 228 case CORSET_OPT_FOREGROUND:
@@ -233,18 +233,18 @@ corset_set_param(
233 invalue = ((invalue)) ? invalue : CORSET_DFLT_MODDIR; 233 invalue = ((invalue)) ? invalue : CORSET_DFLT_MODDIR;
234 if ((str = bindle_strdup(invalue)) == NULL) 234 if ((str = bindle_strdup(invalue)) == NULL)
235 return(-1); 235 return(-1);
236 if ((cnf->cnf_moddir)) 236 if ((cnf->cor_moddir))
237 free(cnf->cnf_moddir); 237 free(cnf->cor_moddir);
238 cnf->cnf_moddir = str; 238 cnf->cor_moddir = str;
239 return(0); 239 return(0);
240 240
241 case CORSET_OPT_PIDFILE: 241 case CORSET_OPT_PIDFILE:
242 invalue = ((invalue)) ? invalue : CORSET_DFLT_PIDFILE; 242 invalue = ((invalue)) ? invalue : CORSET_DFLT_PIDFILE;
243 if ((str = bindle_strdup(invalue)) == NULL) 243 if ((str = bindle_strdup(invalue)) == NULL)
244 return(-1); 244 return(-1);
245 if ((cnf->cnf_pidfile)) 245 if ((cnf->cor_pidfile))
246 free(cnf->cnf_pidfile); 246 free(cnf->cor_pidfile);
247 cnf->cnf_pidfile = str; 247 cnf->cor_pidfile = str;
248 return(0); 248 return(0);
249 249
250 case CORSET_OPT_QUIET: 250 case CORSET_OPT_QUIET:
@@ -255,13 +255,13 @@ corset_set_param(
255 invalue = ((invalue)) ? invalue : CORSET_DFLT_SOCKET; 255 invalue = ((invalue)) ? invalue : CORSET_DFLT_SOCKET;
256 if ((str = bindle_strdup(invalue)) == NULL) 256 if ((str = bindle_strdup(invalue)) == NULL)
257 return(-1); 257 return(-1);
258 if ((cnf->cnf_sockfile)) 258 if ((cnf->cor_sockfile))
259 free(cnf->cnf_sockfile); 259 free(cnf->cor_sockfile);
260 cnf->cnf_sockfile = str; 260 cnf->cor_sockfile = str;
261 return(0); 261 return(0);
262 262
263 case CORSET_OPT_VERBOSE: 263 case CORSET_OPT_VERBOSE:
264 cnf->cnf_verbose = ((invalue)) ? *((const int *)invalue) : CORSET_DFLT_VERBOSE; 264 cnf->cor_verbose = ((invalue)) ? *((const int *)invalue) : CORSET_DFLT_VERBOSE;
265 return(0); 265 return(0);
266 266
267 default: 267 default:
@@ -290,9 +290,9 @@ corset_set_param_flag(
290 }; 290 };
291 291
292 if ((*valp)) 292 if ((*valp))
293 ch->cnf_flags |= flag; 293 ch->cor_flags |= flag;
294 else 294 else
295 ch->cnf_flags &= ~flag; 295 ch->cor_flags &= ~flag;
296 296
297 return; 297 return;
298} 298}
diff --git a/lib/mod_dummy/mod_dummy.c b/lib/mod_dummy/mod_dummy.c
new file mode 100644
index 0000000..1c92c8d
--- /dev/null
+++ b/lib/mod_dummy/mod_dummy.c
@@ -0,0 +1,101 @@
1/*
2 * Corset Firewall
3 * Copyright (C) 2023 David M. Syzdek <david@syzdek.net>.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of David M. Syzdek nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31#define _LIB_MOD_DUMMY_MOD_DUMMY_C 1
32#include "mod_dummy.h"
33
34///////////////
35// //
36// Headers //
37// //
38///////////////
39// MARK: - Headers
40
41#include <assert.h>
42#include <errno.h>
43#include <stdarg.h>
44#include <string.h>
45#include <strings.h>
46#include <stdlib.h>
47#include <stdio.h>
48#include <sys/stat.h>
49
50
51//////////////////
52// //
53// Prototypes //
54// //
55//////////////////
56// MARK: - Prototypes
57
58
59/////////////////
60// //
61// Variables //
62// //
63/////////////////
64// MARK: - Variables
65
66const corset_mod_t mod_dummy =
67{
68 .mod_api = CORSET_API,
69 .mod_usage = CORSET_USE_TRIGGER | CORSET_USE_CACHE,
70 .mod_flags = CORSET_MOD_SINGLE,
71 .mod_load = mod_dummy_load,
72 .mod_unload = mod_dummy_unload,
73};
74
75
76/////////////////
77// //
78// Functions //
79// //
80/////////////////
81// MARK: - Functions
82
83int
84mod_dummy_load(
85 corset_t * cnf )
86{
87 assert(cnf != NULL);
88 return(0);
89}
90
91
92int
93mod_dummy_unload(
94 corset_t * cnf )
95{
96 assert(cnf != NULL);
97 return(0);
98}
99
100
101/* end of source file */
diff --git a/lib/mod_dummy/mod_dummy.h b/lib/mod_dummy/mod_dummy.h
new file mode 100644
index 0000000..879f8f8
--- /dev/null
+++ b/lib/mod_dummy/mod_dummy.h
@@ -0,0 +1,111 @@
1/*
2 * Corset Firewall
3 * Copyright (C) 2023 David M. Syzdek <david@syzdek.net>.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of David M. Syzdek nor the
15 * names of its contributors may be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
19 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR
22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30/*
31 * @file lib/libcorset/libcorset.h
32 */
33#ifndef _LIB_MOD_DUMMY_MOD_DUMMY_H
34#define _LIB_MOD_DUMMY_MOD_DUMMY_H 1
35
36
37///////////////
38// //
39// Headers //
40// //
41///////////////
42// MARK: - Headers
43
44#include <corset_compat.h>
45
46#ifdef HAVE_CONFIG_H
47# include <config.h>
48#endif
49
50#include <assert.h>
51#include <time.h>
52
53#include <corset_module.h>
54
55#ifdef HAVE_BINDLE_PREFIX_H
56# include <bindle_prefix.h>
57#else
58# include <bindle.h>
59#endif
60
61
62///////////////////
63// //
64// Definitions //
65// //
66///////////////////
67// MARK: - Definitions
68
69
70/////////////////
71// //
72// Datatypes //
73// //
74/////////////////
75// MARK: - Datatypes
76
77struct corset_module_data
78{
79 int dat_num1;
80 int dat_num2;
81};
82
83
84/////////////////
85// //
86// Variables //
87// //
88/////////////////
89// MARK: - Variables
90
91extern const corset_mod_t mod_dummy;
92
93
94//////////////////
95// //
96// Prototypes //
97// //
98//////////////////
99// MARK: - Prototypes
100
101extern int
102mod_dummy_load(
103 corset_t * cnf );
104
105
106extern int
107mod_dummy_unload(
108 corset_t * cnf );
109
110
111#endif /* end of header file */
diff --git a/lib/mod_dummy/mod_dummy.sym b/lib/mod_dummy/mod_dummy.sym
new file mode 100644
index 0000000..60d6152
--- /dev/null
+++ b/lib/mod_dummy/mod_dummy.sym
@@ -0,0 +1,32 @@
1#
2# Corset Firewall
3# Copyright (C) 2023 David M. Syzdek <david@syzdek.net>.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met:
8#
9# * Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# * Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14# * Neither the name of David M. Syzdek nor the
15# names of its contributors may be used to endorse or promote products
16# derived from this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
19# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR
22# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28# SUCH DAMAGE.
29#
30# lib/libcorset/libcorset.sym - list of symbols to export
31#
32# end of symbol export file