[dovecot-cvs] dovecot/src/master Makefile.am, 1.19,
1.20 master-settings.c, 1.129, 1.130 ssl-init.c, 1.25, 1.26
cras at dovecot.org
cras at dovecot.org
Sat Jun 17 19:27:01 EEST 2006
Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv3812/src/master
Modified Files:
Makefile.am master-settings.c ssl-init.c
Log Message:
Added --with-statedir configure option which defaults to
localstatedir/lib/dovecot. ssl-parameters.dat is permanently stored in that
directory and copied to login_dirs from there.
Index: Makefile.am
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/Makefile.am,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- Makefile.am 5 Feb 2006 18:00:15 -0000 1.19
+++ Makefile.am 17 Jun 2006 16:26:56 -0000 1.20
@@ -8,6 +8,7 @@
-I$(top_srcdir)/src/lib-settings \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DPKG_RUNDIR=\""$(rundir)"\" \
+ -DPKG_STATEDIR=\""$(statedir)"\" \
-DPKG_LIBEXECDIR=\""$(pkglibexecdir)"\" \
-DMODULEDIR=\""$(moduledir)"\" \
-DSSLDIR=\""$(ssldir)\""
Index: master-settings.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/master-settings.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -d -r1.129 -r1.130
--- master-settings.c 17 Jun 2006 12:25:08 -0000 1.129
+++ master-settings.c 17 Jun 2006 16:26:56 -0000 1.130
@@ -799,6 +799,12 @@
i_error("chmod(%s) failed: %m", set->base_dir);
}
+ /* Make sure our permanent state directory exists */
+ if (mkdir_parents(PKG_STATEDIR, 0777) < 0 && errno != EEXIST) {
+ i_error("mkdir(%s) failed: %m", PKG_STATEDIR);
+ return FALSE;
+ }
+
if (!settings_have_connect_sockets(set)) {
/* we are not using external authentication, so make sure the
login directory exists with correct permissions and it's
Index: ssl-init.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/ssl-init.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- ssl-init.c 5 Feb 2006 18:00:15 -0000 1.25
+++ ssl-init.c 17 Jun 2006 16:26:56 -0000 1.26
@@ -1,8 +1,9 @@
-/* Copyright (C) 2002 Timo Sirainen */
+/* Copyright (C) 2002-2006 Timo Sirainen */
#include "common.h"
#include "ioloop.h"
#include "env-util.h"
+#include "file-copy.h"
#include "log.h"
#include "ssl-init.h"
@@ -15,7 +16,9 @@
#include <sys/stat.h>
static struct timeout *to;
-static bool generating;
+static char *generating_path = NULL;
+
+#define SSL_PARAMETERS_PERM_PATH PKG_STATEDIR"/"SSL_PARAMETERS_FILENAME
static void start_generate_process(const char *fname)
{
@@ -40,7 +43,8 @@
log_set_prefix(log, "ssl-build-param: ");
if (pid != 0) {
/* parent */
- generating = TRUE;
+ i_assert(generating_path == NULL);
+ generating_path = i_strdup(fname);
PID_ADD_PROCESS_TYPE(pid, PROCESS_TYPE_SSL_PARAM);
return;
}
@@ -50,13 +54,18 @@
i_fatal("dup2(stderr) failed: %m");
child_process_init_env();
- client_process_exec(t_strconcat(binpath, " ", fname, NULL), "");
+ client_process_exec(t_strconcat(binpath, " "SSL_PARAMETERS_PERM_PATH,
+ NULL), "");
i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m", binpath);
}
void ssl_parameter_process_destroyed(pid_t pid __attr_unused__)
{
- generating = FALSE;
+ if (file_copy(SSL_PARAMETERS_PERM_PATH, generating_path, TRUE) <= 0) {
+ i_error("file_copy(%s, %s) failed: %m",
+ SSL_PARAMETERS_PERM_PATH, generating_path);
+ }
+ i_free_and_null(generating_path);
}
static bool check_parameters_file_set(struct settings *set)
@@ -76,7 +85,15 @@
return TRUE;
}
- st.st_mtime = 0;
+ /* try to copy the permanent parameters file here if possible */
+ if (file_copy(SSL_PARAMETERS_PERM_PATH, path, TRUE) > 0) {
+ if (stat(path, &st) < 0) {
+ i_error("stat(%s) failed: %m", path);
+ st.st_mtime = 0;
+ }
+ } else {
+ st.st_mtime = 0;
+ }
} else if (st.st_size == 0) {
/* broken, delete it (mostly for backwards compatibility) */
st.st_mtime = 0;
@@ -105,7 +122,7 @@
{
struct server_settings *server;
- if (generating)
+ if (generating_path != NULL)
return;
for (server = settings_root; server != NULL; server = server->next) {
@@ -122,7 +139,7 @@
void ssl_init(void)
{
- generating = FALSE;
+ generating_path = NULL;
/* check every 10 mins */
to = timeout_add(600 * 1000, check_parameters_file_timeout, NULL);
More information about the dovecot-cvs
mailing list