doveadm-dsync.c revision 11566139fe3dbe44404f5be8f2bfa0f3f97da69e
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen/* Copyright (c) 2009-2016 Dovecot authors, see the included COPYING file */
#include "dsync/dsync-ibc.h"
#include "doveadm-dsync.h"
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
vname/storage_name and would otherwise be mixed up with a normal "mailbox
enum dsync_run_type {
struct dsync_cmd_context {
const char *mailbox;
const char *sync_flags;
const char *virtual_all_box;
unsigned int io_timeout_secs;
const char *remote_name;
const char *local_location;
const char *const *remote_cmd_args;
int exit_status;
const char *error;
unsigned int lock_timeout;
const unsigned char *data;
const char *line;
const char *prefix =
const char *const **cmd_args_r)
p = argv[i];
if (legacy_dsync) {
const char *user,
const char *const **cmd_args_r)
return TRUE;
if (!i_isalnum(*p)) {
return FALSE;
return TRUE;
return TRUE;
int ret;
*mail_error_r = 0;
i_unreached();
if (ret < 0) {
if (doveadm_is_killed()) {
const char *const *remote_cmd_args)
static struct dsync_ibc *
const char *state_str)
const char *path;
int fd;
const char *const *strp;
int ret = 0;
if (doveadm_debug)
case DSYNC_RUN_TYPE_LOCAL:
case DSYNC_RUN_TYPE_CMD:
case DSYNC_RUN_TYPE_STREAM:
if (ret < 0) {
if (mail_error2 != 0 &&
return ret;
void *context)
switch (exit_code) {
case EX_NOUSER:
const char **error_r)
const char *error;
if (ssl) {
if (doveadm_debug)
const char *location,
const char **error_r)
const char *const args[])
str++;
return FALSE;
return TRUE;
return _ctx;
return FALSE;
return TRUE;
"[-1fPRU] [-l <secs>] [-r <rawlog path>] [-m <mailbox>] [-g <mailbox_guid>] [-n <namespace> | -N] [-x <exclude>] [-s <state>] -d|<dest>"
"[-fPRU] [-l <secs>] [-r <rawlog path>] [-m <mailbox>] [-g <mailbox_guid>] [-n <namespace> | -N] [-x <exclude>] [-s <state>] -d|<dest>"
const char *getopt_str;
if (flag_m) {
if (flag_u) {
if (flag_C) {
if (!dsync_server) {
if (flag_f)
if (flag_R)