ssl-init.c revision 43d32cbe60fdaef2699d99f1ca259053e9350411
/* Copyright (C) 2002-2006 Timo Sirainen */
#include "common.h"
#include "ioloop.h"
#include "env-util.h"
#include "file-copy.h"
#include "log.h"
#include "child-process.h"
#include "ssl-init.h"
#ifdef HAVE_SSL
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <utime.h>
static struct child_process ssl_param_child_process =
static char *generating_path = NULL;
static void start_generate_process(const char *fname)
{
int log_fd;
if (log_fd == -1)
pid = -1;
else {
if (pid < 0)
i_error("fork() failed: %m");
}
if (pid == -1) {
return;
}
if (pid != 0) {
/* parent */
return;
}
/* child. */
i_fatal("dup2(stderr) failed: %m");
NULL), "");
}
static void
{
if (!abnormal_exit) {
generating_path, TRUE) <= 0) {
i_error("file_copy(%s, %s) failed: %m",
}
}
}
{
const char *path;
if (set->ssl_disable)
return TRUE;
i_error("stat() failed for SSL parameters file %s: %m",
path);
return TRUE;
}
/* broken, delete it (mostly for backwards compatibility) */
}
/* permanent parameters file has changed. use it. */
/* preserve the mtime */
}
}
}
/* make sure it's new enough, it's not 0 sized, and the permissions
are correct */
i_info("Generating Diffie-Hellman parameters "
"for the first time. This may take "
"a while..");
}
return FALSE;
}
return TRUE;
}
void ssl_check_parameters_file(void)
{
struct server_settings *server;
if (generating_path != NULL)
return;
break;
}
}
{
}
void ssl_init(void)
{
/* check every 10 mins */
}
void ssl_deinit(void)
{
timeout_remove(&to);
}
#else
void ssl_check_parameters_file(void) {}
void ssl_init(void) {}
void ssl_deinit(void) {}
#endif