dovecot-2.2: dsync: Added "remoteprefix:" destination, which is ...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jan 10 14:20:17 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/b468c30c4522
changeset: 15635:b468c30c4522
user: Timo Sirainen <tss at iki.fi>
date: Thu Jan 10 14:20:07 2013 +0200
description:
dsync: Added "remoteprefix:" destination, which is same as "remote:" except sends "username\n" prefix.
diffstat:
src/doveadm/dsync/doveadm-dsync.c | 28 ++++++++++++++++++++++------
1 files changed, 22 insertions(+), 6 deletions(-)
diffs (59 lines):
diff -r 68b7c9ce713b -r b468c30c4522 src/doveadm/dsync/doveadm-dsync.c
--- a/src/doveadm/dsync/doveadm-dsync.c Thu Jan 10 14:00:10 2013 +0200
+++ b/src/doveadm/dsync/doveadm-dsync.c Thu Jan 10 14:20:07 2013 +0200
@@ -8,6 +8,7 @@
#include "istream.h"
#include "ostream.h"
#include "iostream-rawlog.h"
+#include "write-full.h"
#include "str.h"
#include "var-expand.h"
#include "settings-parser.h"
@@ -53,6 +54,7 @@
unsigned int backup:1;
unsigned int reverse_backup:1;
unsigned int remote:1;
+ unsigned int remote_user_prefix:1;
};
static bool legacy_dsync = FALSE;
@@ -107,6 +109,13 @@
ctx->fd_out = fd_in[1];
ctx->fd_err = fd_err[0];
+ if (ctx->remote_user_prefix) {
+ const char *prefix =
+ t_strdup_printf("%s\n", ctx->ctx.cur_username);
+ if (write_full(ctx->fd_out, prefix, strlen(prefix)) < 0)
+ i_fatal("write(remote out) failed: %m");
+ }
+
fd_set_nonblock(ctx->fd_err, TRUE);
ctx->err_stream = i_stream_create_fd(ctx->fd_err, IO_BLOCK_SIZE, FALSE);
i_stream_set_return_partial_line(ctx->err_stream, TRUE);
@@ -534,12 +543,19 @@
}
}
- if (remote_cmd_args == NULL && ctx->local_location != NULL &&
- strncmp(ctx->local_location, "remote:", 7) == 0) {
- /* this is a remote (ssh) command */
- ctx->remote_name = ctx->local_location+7;
- remote_cmd_args = parse_ssh_location(ctx, ctx->remote_name,
- _ctx->cur_username);
+ if (remote_cmd_args == NULL && ctx->local_location != NULL) {
+ if (strncmp(ctx->local_location, "remote:", 7) == 0) {
+ /* this is a remote (ssh) command */
+ ctx->remote_name = ctx->local_location+7;
+ } else if (strncmp(ctx->local_location, "remoteprefix:", 13) == 0) {
+ /* this is a remote (ssh) command with a "user\n"
+ prefix sent before dsync actually starts */
+ ctx->remote_name = ctx->local_location+13;
+ ctx->remote_user_prefix = TRUE;
+ }
+ remote_cmd_args = ctx->remote_name == NULL ? NULL :
+ parse_ssh_location(ctx, ctx->remote_name,
+ _ctx->cur_username);
}
if (remote_cmd_args != NULL) {
More information about the dovecot-cvs
mailing list