main.c revision eec75bde5b8de6667483b48e5f4a41df495d84b0
/* Copyright (c) 2002-2014 Dovecot authors, see the included COPYING file */
#include "imap-common.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "abspath.h"
#include "str.h"
#include "base64.h"
#include "process-title.h"
#include "randgen.h"
#include "restrict-access.h"
#include "fd-close-on-exec.h"
#include "settings-parser.h"
#include "master-interface.h"
#include "master-service.h"
#include "master-login.h"
#include "mail-user.h"
#include "mail-storage-service.h"
#include "imap-resp-code.h"
#include "imap-commands.h"
#include "imap-fetch.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define IS_STANDALONE() \
#define IMAP_DIE_IDLE_SECS 10
static bool verbose_proctitle = FALSE;
static struct mail_storage_service_ctx *storage_service;
{
return old_hook;
}
void imap_refresh_proctitle(void)
{
#define IMAP_PROCTITLE_PREFERRED_LEN 80
struct client_command_context *cmd;
bool wait_output;
if (!verbose_proctitle)
return;
switch (imap_client_count) {
case 0:
break;
case 1:
}
wait_output = FALSE;
continue;
}
wait_output = TRUE;
}
if (wait_output) {
}
break;
default:
break;
}
}
{
return;
}
static void imap_die(void)
{
unsigned int stop_msecs;
if (last_io <= stop_timestamp)
else {
}
}
}
struct client_input {
const char *tag;
const unsigned char *input;
unsigned int input_size;
bool send_untagged_capability;
};
static void
struct client_input *input_r)
{
unsigned int taglen;
if (data[0] == '1')
}
}
{
struct client_input input;
if (input.input_size > 0 &&
i_panic("Couldn't add client input to stream");
} else {
/* IMAPLOGINTAG environment is compatible with mailfront */
}
"* PREAUTH [CAPABILITY ",
} else if (input.send_untagged_capability) {
/* client doesn't seem to understand tagged capabilities. send
untagged instead and hope that it works. */
} else {
}
(void)client_handle_input(client);
}
static int
const struct master_login_client *login_client,
const char **error_r)
{
struct mail_storage_service_user *user;
struct imap_settings *set;
enum mail_auth_request_flags flags;
return -1;
if (set->verbose_proctitle)
T_BEGIN {
} T_END;
if ((flags & MAIL_AUTH_REQUEST_FLAG_TLS_COMPRESSION) != 0)
return 0;
}
static void main_stdio_run(const char *username)
{
struct master_login_client login_client;
struct mail_storage_service_input input;
i_fatal("USER environment missing");
}
static void
const char *username, const char *const *extra_fields)
{
struct mail_storage_service_input input;
const char *error;
strlen(MSG_BYE_INTERNAL_ERROR)) < 0) {
i_error("write(client) failed: %m");
}
i_close_fd(&fd);
}
}
const char *errormsg)
{
struct client_input input;
const char *msg;
/* ignored */
}
}
{
/* when running standalone, we shouldn't even get here */
}
{
static const struct setting_parser_info *set_roots[] = {
};
struct master_login_settings login_set;
enum master_service_flags service_flags = 0;
int c;
if (IS_STANDALONE() && getuid() == 0 &&
printf("* BAD [ALERT] imap binary must not be started from "
"inetd, use imap-login instead.\n");
return 1;
}
if (IS_STANDALONE()) {
} else {
}
while ((c = master_getopt(master_service)) > 0) {
switch (c) {
case 't':
break;
case 'u':
break;
default:
return FATAL_DEFAULT;
}
}
/* plugins may want to add commands, so this needs to be called early */
random_init();
/* fake that we're running, so we know if client was destroyed
while handling its initial input */
if (IS_STANDALONE()) {
T_BEGIN {
} T_END;
} else T_BEGIN {
}
} T_END;
if (master_login != NULL)
return 0;
}