aboutsummaryrefslogtreecommitdiff
path: root/src/srvcfg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/srvcfg.c')
-rw-r--r--src/srvcfg.c75
1 files changed, 39 insertions, 36 deletions
diff --git a/src/srvcfg.c b/src/srvcfg.c
index 40d56b89..4b338f82 100644
--- a/src/srvcfg.c
+++ b/src/srvcfg.c
@@ -137,21 +137,22 @@ parse_milter_url(const char *str)
}
static void
-set_debug(void *value)
+set_debug(union mf_option_value *val)
{
- mu_debug_parse_spec(value);
+ mu_debug_parse_spec(val->ov_string);
+ free(val->ov_string);
}
void
-set_source_info(void *value)
+set_source_info(union mf_option_value *val)
{
- mu_debug_line_info = (int) value;
+ mu_debug_line_info = val->ov_bool;
}
static void
-set_user(void *value)
+set_user(union mf_option_value *val)
{
- mf_server_user = value;
+ mf_server_user = val->ov_string;
}
static int
@@ -185,38 +186,37 @@ mf_option_group(const char *arg)
static int
-option_group(char *opt, void **pval, char *newval)
+option_group(char const *opt, union mf_option_value *val, char const *arg)
{
- return mf_option_group(newval);
+ return mf_option_group(arg);
}
static int
-option_pidfile(char *opt, void **pval, char *newval)
+option_pidfile(char const *opt, union mf_option_value *val, char const *arg)
{
- if (newval[0] != '/') {
+ if (arg[0] != '/') {
mu_error(_("invalid pidfile name: must be absolute"));
return 1;
}
- return mf_option_string(opt, pval, newval);
+ return mf_option_string(opt, val, arg);
}
static void
-set_pidfile(void *value)
+set_pidfile(union mf_option_value *val)
{
- pidfile = value;
+ pidfile = val->ov_string;
}
static void
-set_io_timeout(void *value)
+set_io_timeout(union mf_option_value *val)
{
- io_timeout = *(time_t*) value;
- free(value);
+ io_timeout = val->ov_time;
}
static void
-set_logger_option(void *value)
+set_logger_option(union mf_option_value *val)
{
- log_stream = value;
+ log_stream = val->ov_string;
}
static int
@@ -243,15 +243,16 @@ mf_option_state_directory(const char *arg)
}
void
-set_state_directory(void *value)
+set_state_directory(union mf_option_value *val)
{
/* nothing */
}
int
-option_state_directory(char *opt, void **pval, char *newval)
+option_state_directory(char const *opt, union mf_option_value *val,
+ char const *arg)
{
- return mf_option_state_directory(newval);
+ return mf_option_state_directory(arg);
}
void
@@ -282,13 +283,14 @@ mf_srvcfg_add(const char *type, const char *urlstr)
}
static void
-set_port(void *value)
+set_port(union mf_option_value *val)
{
- mf_srvcfg_add("default", value);
+ mf_srvcfg_add("default", val->ov_string);
+ free(val->ov_string);
}
static void
-set_source_ip(void *value)
+set_source_ip(union mf_option_value *val)
{
int rc;
struct mu_sockaddr_hints hints;
@@ -297,26 +299,27 @@ set_source_ip(void *value)
hints.family = AF_INET;
hints.socktype = SOCK_STREAM;
hints.protocol = IPPROTO_TCP;
- rc = mu_sockaddr_from_node(&source_address, (char*)value, NULL,
+ rc = mu_sockaddr_from_node(&source_address, val->ov_string, NULL,
&hints);
if (rc) {
mu_error(_("cannot convert %s to sockaddr: %s"),
- (char*)value, mu_strerror(rc));
+ val->ov_string, mu_strerror(rc));
}
+ free(val->ov_string);
}
static struct mf_option_cache srv_option_cache[] = {
- { "debug", NULL, mf_option_string, set_debug },
- { "source-info", NULL, mf_option_boolean, set_source_info },
- { "user", NULL, mf_option_string, set_user },
- { "group", NULL, option_group, NULL },
- { "pidfile", NULL, option_pidfile, set_pidfile },
- { "source-ip", NULL, mf_option_string, set_source_ip },
- { "io-timeout", NULL, mf_option_time, set_io_timeout },
- { "logger", NULL, mf_option_string, set_logger_option },
- { "state-directory", NULL, option_state_directory,
+ { "debug", mf_option_string, set_debug },
+ { "source-info", mf_option_boolean, set_source_info },
+ { "user", mf_option_string, set_user },
+ { "group", option_group, NULL },
+ { "pidfile", option_pidfile, set_pidfile },
+ { "source-ip", mf_option_string, set_source_ip },
+ { "io-timeout", mf_option_timeout, set_io_timeout },
+ { "logger", mf_option_string, set_logger_option },
+ { "state-directory", option_state_directory,
set_state_directory },
- { "port", NULL, mf_option_string, set_port },
+ { "port", mf_option_string, set_port },
{ NULL }
};

Return to:

Send suggestions and report system problems to the System administrator.