Skip to content

Commit 85334e1

Browse files
committed
daemons: drop smtp_server_ip directive
The `outgoing_smtp_url` directive did not have a (string) default, because the default (behavior) was to fallback to `smtp_server_ip` and `smtp_server_port` when outgoing_smtp_url was absent. Because `smtp_server_ip` itself defaulted to ::1, outgoing_smtp_url's default effectively was `smtp://[::1]:25/`. `smtp_server_ip` was marked deprecated in commit gromox-2.21~51 (2023-12-17), remove it now. Then we can set the default for outgoing_smtp_url in source as it was documented. Users who still have smtp_server_ip in *.cfg must replace it with gromox.cfg:outgoing_smtp_url accordingly, and immediately so. References: GXF-2020
1 parent 5119135 commit 85334e1

File tree

5 files changed

+22
-66
lines changed

5 files changed

+22
-66
lines changed

doc/exchange_emsmdb.4gx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,6 @@ all ROPs. Note the daemon log level needs to be "debug" (6), too.
123123
.br
124124
Default: \fI0\fP
125125
.TP
126-
\fBsmtp_server_ip\fP
127-
Deprecated in favor of gromox.cfg:outgoing_smtp_url.
128-
.TP
129-
\fBsmtp_server_port\fP
130-
Deprecated in favor of gromox.cfg:outgoing_smtp_url.
131-
.TP
132126
\fBsubmit_command\fP
133127
Default: \fI/usr/bin/php /usr/share/gromox/sa/submit.php
134128
.TP

exch/emsmdb/main.cpp

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ static DCERPC_ENDPOINT *ep_6001;
4444

4545
static constexpr cfg_directive emsmdb_gxcfg_dflt[] = {
4646
{"backfill_transport_headers", "0", CFG_BOOL},
47+
{"outgoing_smtp_url", "sendmail://localhost"},
4748
{"reported_server_version", "15.00.0847.4040"},
4849
CFG_TABLE_END,
4950
};
@@ -65,8 +66,6 @@ static constexpr cfg_directive emsmdb_cfg_defaults[] = {
6566
{"max_mail_num", "1000000", CFG_SIZE, "1"},
6667
{"max_rcpt_num", "256", CFG_SIZE, "1"},
6768
{"rop_debug", "0"},
68-
{"smtp_server_ip", "::1", CFG_DEPRECATED},
69-
{"smtp_server_port", "25", CFG_DEPRECATED},
7069
{"submit_command", "/usr/bin/php " PKGDATADIR "/sa/submit.php"},
7170
{"x500_org_name", "Gromox default"},
7271
CFG_TABLE_END,
@@ -174,24 +173,12 @@ BOOL PROC_exchange_emsmdb(enum plugin_op reason, const struct dlfuncs &ppdata)
174173
HX_unit_size(max_length_s, std::size(max_length_s), max_length, 1024, 0);
175174
auto str = gxcfg->get_value("outgoing_smtp_url");
176175
std::string smtp_url;
177-
if (str != nullptr) {
178-
try {
179-
smtp_url = vmime::utility::url(str);
180-
} catch (const vmime::exceptions::malformed_url &e) {
181-
mlog(LV_ERR, "Malformed URL: outgoing_smtp_url=\"%s\": %s",
182-
str, e.what());
183-
return false;
184-
}
185-
} else {
186-
str = pfile->get_value("smtp_server_ip");
187-
uint16_t port = pfile->get_ll("smtp_server_port");
188-
try {
189-
smtp_url = vmime::utility::url("smtp", str, port);
190-
} catch (const vmime::exceptions::malformed_url &e) {
191-
mlog(LV_ERR, "Malformed outgoing SMTP: [%s]:%hu: %s",
192-
str, port, e.what());
193-
return false;
194-
}
176+
try {
177+
smtp_url = vmime::utility::url(str);
178+
} catch (const vmime::exceptions::malformed_url &e) {
179+
mlog(LV_ERR, "Malformed URL: outgoing_smtp_url=\"%s\": %s",
180+
str, e.what());
181+
return false;
195182
}
196183
gx_strlcpy(submit_command, pfile->get_value("submit_command"), std::size(submit_command));
197184
async_num = pfile->get_ll("async_threads_num");

exch/ews/ews.cpp

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -458,12 +458,11 @@ static constexpr cfg_directive ews_cfg_defaults[] = {
458458
{"ews_request_logging", "0"},
459459
{"ews_response_logging", "0"},
460460
{"ews_schema_version", "V2017_07_11"},
461-
{"smtp_server_ip", "::1", CFG_DEPRECATED},
462-
{"smtp_server_port", "25", CFG_DEPRECATED},
463461
CFG_TABLE_END,
464462
};
465463

466464
static constexpr struct cfg_directive ews_gxcfg_deflt[] = {
465+
{"outgoing_smtp_url", "sendmail://localhost"},
467466
{"reported_server_version", "15.00.0847.4040"},
468467
CFG_TABLE_END,
469468
};
@@ -505,24 +504,12 @@ void EWSPlugin::loadConfig()
505504
ver.schema = cfg->get_value("ews_schema_version");
506505

507506
str = gxcfg->get_value("outgoing_smtp_url");
508-
if (str != nullptr) {
509-
try {
510-
smtp_url = vmime::utility::url(str);
511-
} catch (const vmime::exceptions::malformed_url &e) {
512-
mlog(LV_ERR, "Malformed URL: outgoing_smtp_url=\"%s\": %s",
513-
str, e.what());
514-
return;
515-
}
516-
} else {
517-
str = cfg->get_value("smtp_server_ip");
518-
uint16_t port = cfg->get_ll("smtp_server_port");
519-
try {
520-
smtp_url = vmime::utility::url("smtp", str, port);
521-
} catch (const vmime::exceptions::malformed_url &e) {
522-
mlog(LV_ERR, "Malformed outgoing SMTP: [%s]:%hu: %s",
523-
str, port, e.what());
524-
return;
525-
}
507+
try {
508+
smtp_url = vmime::utility::url(str);
509+
} catch (const vmime::exceptions::malformed_url &e) {
510+
mlog(LV_ERR, "Malformed URL: outgoing_smtp_url=\"%s\": %s",
511+
str, e.what());
512+
return;
526513
}
527514

528515
const char* logFilter = cfg->get_value("ews_log_filter");

exch/zcore/main.cpp

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ static constexpr static_module g_dfl_svc_plugins[] = {
8282
static constexpr cfg_directive zcore_gxcfg_dflt[] = {
8383
{"backfill_transport_headers", "0", CFG_BOOL},
8484
{"daemons_fd_limit", "zcore_fd_limit", CFG_ALIAS},
85+
{"outgoing_smtp_url", "sendmail://localhost"},
8586
{"zcore_fd_limit", "0", CFG_SIZE},
8687
CFG_TABLE_END,
8788
};
@@ -101,8 +102,6 @@ static constexpr cfg_directive zcore_cfg_defaults[] = {
101102
{"notify_stub_threads_num", "10", CFG_SIZE, "1", "100"},
102103
{"oxcical_allday_ymd", "1", CFG_BOOL},
103104
{"rpc_proxy_connection_num", "10", CFG_SIZE, "1", "100"},
104-
{"smtp_server_ip", "::1", CFG_DEPRECATED},
105-
{"smtp_server_port", "25", CFG_DEPRECATED},
106105
{"submit_command", "/usr/bin/php " PKGDATADIR "/sa/submit.php"},
107106
{"user_cache_interval", "1h", CFG_TIME, "1min", "1day"},
108107
{"user_table_size", "5000", CFG_SIZE, "100", "50000"},
@@ -306,24 +305,12 @@ int main(int argc, char **argv)
306305

307306
auto str = gxconfig->get_value("outgoing_smtp_url");
308307
std::string smtp_url;
309-
if (str != nullptr) {
310-
try {
311-
smtp_url = vmime::utility::url(str);
312-
} catch (const vmime::exceptions::malformed_url &e) {
313-
mlog(LV_ERR, "Malformed URL: outgoing_smtp_url=\"%s\": %s",
314-
str, e.what());
315-
return EXIT_FAILURE;
316-
}
317-
} else {
318-
str = pconfig->get_value("smtp_server_ip");
319-
uint16_t port = pconfig->get_ll("smtp_server_port");
320-
try {
321-
smtp_url = vmime::utility::url("smtp", str, port);
322-
} catch (const vmime::exceptions::malformed_url &e) {
323-
mlog(LV_ERR, "Malformed outgoing SMTP: [%s]:%hu: %s",
324-
str, port, e.what());
325-
return EXIT_FAILURE;
326-
}
308+
try {
309+
smtp_url = vmime::utility::url(str);
310+
} catch (const vmime::exceptions::malformed_url &e) {
311+
mlog(LV_ERR, "Malformed URL: outgoing_smtp_url=\"%s\": %s",
312+
str, e.what());
313+
return EXIT_FAILURE;
327314
}
328315
mlog(LV_NOTICE, "system: SMTP server is %s", smtp_url.c_str());
329316

mda/delivery_app/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ static constexpr static_module g_dfl_svc_plugins[] = {
5454
static constexpr cfg_directive gromox_cfg_defaults[] = {
5555
{"daemons_fd_limit", "lda_fd_limit", CFG_ALIAS},
5656
{"lda_fd_limit", "0", CFG_SIZE},
57+
{"outgoing_smtp_url", "sendmail://localhost"},
5758
CFG_TABLE_END,
5859
};
5960

0 commit comments

Comments
 (0)