/* Copyright (c) 2014-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "connection.h"
#include "istream.h"
#include "istream-unix.h"
#include "ostream.h"
#include "buffer.h"
#include "base64.h"
#include "strescape.h"
#include "master-service.h"
#include "imap-client.h"
#include "imap-hibernate-client.h"
struct imap_hibernate_client {
bool imap_client_created;
bool finished;
bool debug;
};
struct imap_hibernate_input {
/* input we've already read from the IMAP client. */
/* IMAP connection state */
};
{
if (!client->imap_client_created)
}
static int
struct imap_client_state *state_r,
const char **error_r)
{
*error_r = "Missing username in input";
return -1;
}
*error_r = "Missing mail_log_prefix in input";
return -1;
}
else {
value = "";
}
"Invalid lip value: %s", value);
return -1;
}
"Invalid rip value: %s", value);
return -1;
}
"Invalid peer_dev_major value: %s", value);
return -1;
}
"Invalid peer_dev_minor value: %s", value);
return -1;
}
"Invalid peer_ino value: %s", value);
return -1;
}
"Invalid uid value: %s", value);
return -1;
}
"Invalid gid value: %s", value);
return -1;
}
"Invalid session_created value: %s", value);
return -1;
}
"Invalid idle_notify_interval value: %s", value);
return -1;
}
state_buf) < 0) {
"Invalid state base64 value: %s", value);
return -1;
}
}
}
*error_r = "Missing tag";
return -1;
}
if (peer_dev_major != 0 || peer_dev_minor != 0)
return 0;
}
static int
{
(struct imap_hibernate_client *)conn;
const char *error;
"-Failed to parse client input: %s\n", error));
return -1;
}
/* the transferred imap client fd is now counted as the client. */
}
static int
{
(struct imap_hibernate_client *)conn;
if (!conn->version_received) {
return -1;
return 1;
}
return -1;
}
char *const *args;
if (fd == -1) {
i_error("IMAP client fd not received");
return -1;
}
pool_unref(&pool);
} else {
if (fd == -1) {
ret = -1;
} else if (line[0] != '\0') {
"Expected empty notify fd line");
ret = -1;
} else {
ret = 1;
}
}
if (ret < 0) {
i_close_fd(&fd);
return -1;
} else if (ret == 0) {
/* still need to read another fd */
} else {
/* finished - wait for disconnection from imap before finishing.
this way the old imap process will have time to destroy
itself before we have a chance to create another one. */
}
return 1;
}
{
}
.service_name_in = "imap-hibernate",
.service_name_out = "imap-hibernate",
.major_version = 1,
.minor_version = 0,
};
};
void imap_hibernate_clients_init(void)
{
}
void imap_hibernate_clients_deinit(void)
{
}