service-process.c revision 5fc02738b38ac2b0c21db0854d7a5ad452b1177f
2328a8f7726f908fa84fe082a2efd18c6965b3dfCampbell Barton/* Copyright (c) 2005-2009 Dovecot authors, see the included COPYING file */
#include "service.h"
#include "service-log.h"
#include "service-auth-server.h"
#include "service-auth-source.h"
#include "service-process-notify.h"
#include "service-process.h"
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <syslog.h>
#include <signal.h>
bool give_anvil_fd)
case SERVICE_TYPE_LOG:
i_assert(n == 0);
n += socket_listener_count;
case SERVICE_TYPE_ANVIL:
MASTER_LISTEN_FD_FIRST + n++);
MASTER_LISTEN_FD_FIRST + n++);
for (i = 0; i < count; i++) {
MASTER_LISTEN_FD_FIRST + n);
n++; socket_listener_count++;
ssl_socket_count = 0;
for (i = 0; i < count; i++) {
MASTER_LISTEN_FD_FIRST + n);
n++; socket_listener_count++;
if (!give_anvil_fd)
case SERVICE_TYPE_AUTH_SOURCE:
case SERVICE_TYPE_AUTH_SERVER:
closelog();
const char *user)
if (uid == 0) {
return FALSE;
return FALSE;
return FALSE;
return TRUE;
const char **home)
static void auth_success_write(void)
int fd;
if (auth_success_written)
const char *const *auth_args)
bool disallow_root;
env_clean();
env_put(*p);
case SERVICE_TYPE_CONFIG:
case SERVICE_TYPE_LOG:
&count);
if (limit == 0) {
struct service_process *
static unsigned int uid_counter = 0;
case SERVICE_TYPE_AUTH_SOURCE:
case SERVICE_TYPE_AUTH_SERVER:
return NULL;
if (pid < 0) {
return NULL;
if (pid == 0) {
case SERVICE_TYPE_AUTH_SERVER:
case SERVICE_TYPE_AUTH_SOURCE:
return process;
case SERVICE_TYPE_AUTH_SERVER:
case SERVICE_TYPE_AUTH_SOURCE:
return TRUE;
return FALSE;
switch (status) {
case FATAL_LOGOPEN:
case FATAL_LOGWRITE:
case FATAL_LOGERROR:
case FATAL_OUTOFMEM:
case FATAL_EXEC:
case FATAL_DEFAULT:
return NULL;
#ifdef WCOREDUMP
if (core_dumps_disabled) {
#ifdef HAVE_PR_SET_DUMPABLE
const char *msg;
if (status == 0) {
const char *data;
int status)
T_BEGIN {
bool default_fatal;
} T_END;