summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org.ua>2016-11-08 15:46:29 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2016-11-08 15:53:28 (GMT)
commit172ada3fcdeb3a2c02f905792a398567820e53c4 (patch) (side-by-side diff)
treeeec44c88d5f11510e48ac4814b2b459d2d3846d9 /src
parente62cdd725b6088b9989ded9ee036eeb8a53ebed6 (diff)
downloadmailfromd-172ada3fcdeb3a2c02f905792a398567820e53c4.tar.gz
mailfromd-172ada3fcdeb3a2c02f905792a398567820e53c4.tar.bz2
Fix mfdbtool.
* lib/db.c (mf_database_mode): New global variable. (mf_dbm_open): Remove "mode" parameter. Use mf_database_mode. (db_expire_func): Fix passing the datum size. (db_compact): Preserve mode and ownership of the database. * lib/dbcfg.c (cb_database_mode): New function. * lib/mfdb.h (mf_database_mode): New extern. (mf_dbm_open): Change signature. (cb_database_mode): New proto. * src/mfdbtool.c (mfdbtool_cfg_param): New statement "database-mode". Read configuration from /etc/mailfromd.conf * src/srvcfg.c (srv_cfg_param): Likewise. * lib/cache.c: Update calls to mf_dbm_open. * lib/rate.c: Likewise. * lib/tbf_rate.c: Likewise.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/mfdbtool.c11
-rw-r--r--src/srvcfg.c5
2 files changed, 11 insertions, 5 deletions
diff --git a/src/mfdbtool.c b/src/mfdbtool.c
index 1571526..db6bc18 100644
--- a/src/mfdbtool.c
+++ b/src/mfdbtool.c
@@ -28,6 +28,7 @@
#include "libmf.h"
#include "mfdb.h"
+#include "filenames.h"
char *state_dir = DEFAULT_STATE_DIR;
char *file_option; /* File name for DB management commands */
@@ -140,7 +141,6 @@ db_proc_enumerator(struct db_format *fmt, void *data)
void
mfdbtool_expire(int argc, char **argv)
{
- /*FIXME: priv_setup(); */
if (all_option)
db_format_enumerate(db_proc_enumerator, db_expire);
else {
@@ -155,7 +155,6 @@ mfdbtool_expire(int argc, char **argv)
void
mfdbtool_compact(int argc, char **argv)
{
- /* FIXME: priv_setup(); */
if (all_option)
db_format_enumerate(db_proc_enumerator, db_compact);
else {
@@ -306,6 +305,10 @@ struct mu_cfg_param mfdbtool_cfg_param[] = {
N_("Default database type"),
N_("type") },
{ "database", mu_cfg_section, NULL, 0, NULL, NULL },
+ { "database-mode", mu_cfg_callback,
+ &mf_database_mode, 0, cb_database_mode,
+ N_("Configure file mode for database files"),
+ N_("mode: octal") },
{ "state-directory", mu_c_string, &state_dir, 0, NULL,
N_("Set program state directory."),
N_("dir") },
@@ -359,9 +362,7 @@ main(int argc, char **argv)
db_format_setup();
database_cfg_init();
- mf_getopt(&cli, &argc, &argv, capa, 0,
- /* FIXME: Use mailfromd.conf somehow? */
- SYSCONFDIR "/mfdbtool.conf");
+ mf_getopt(&cli, &argc, &argv, capa, 0, DEFAULT_CONFIG_FILE);
if (db_type_str) {
mu_url_t dbhint;
diff --git a/src/srvcfg.c b/src/srvcfg.c
index 1f39921..5738812 100644
--- a/src/srvcfg.c
+++ b/src/srvcfg.c
@@ -30,6 +30,7 @@
#include "srvman.h"
#include "gacopyz.h"
#include "srvcfg.h"
+#include "mfdb.h"
char *mailfromd_state_dir;
int server_flags = 0;
@@ -523,6 +524,10 @@ static struct mu_cfg_param srv_cfg_param[] = {
N_("Default database type"),
N_("type") },
{ "database", mu_cfg_section, NULL, 0, NULL, NULL },
+ { "database-mode", mu_cfg_callback,
+ &mf_database_mode, 0, cb_database_mode,
+ N_("Configure file mode for database files"),
+ N_("mode: octal") },
{ "ehlo-domain", mu_c_string, &ehlo_domain, 0, NULL,
N_("Set the domain name for EHLO command.") },
{ "mail-from-address", mu_c_string, &mailfrom_address, 0, NULL,

Return to:

Send suggestions and report system problems to the System administrator.