This documentation is for Dovecot v1.x, see wiki2 for v2.x documentation.

Attachment 'dovecot-xexec-1.1.v2.patch'

Download

   1 Updated module to dovecot-1.1
   2 
   3 diff -r 7cafabf38524 cmd-xexec.c
   4 --- a/cmd-xexec.c	Wed Mar 19 00:58:24 2008 +0100
   5 +++ b/cmd-xexec.c	Fri Mar 21 18:12:26 2008 +0100
   6 @@ -128,10 +128,10 @@ static void cmd_xexec_stderr(void *conte
   7  
   8  bool cmd_xexec(struct client_command_context *cmd)
   9  {
  10 -	struct imap_arg * imap_args;
  11 +	const struct imap_arg *imap_args;
  12  	const char *imap_command;
  13  	char **backend_command;
  14 -	array_t ARRAY_DEFINE(command, char *);
  15 +	ARRAY_DEFINE(command, char *);
  16  	pid_t pid;
  17  	int status;
  18  	int pipe_in[2];
  19 @@ -177,12 +177,13 @@ bool cmd_xexec(struct client_command_con
  20  		return FALSE;
  21  	}
  22  
  23 -	ARRAY_CREATE(&command, unsafe_data_stack_pool, char *, 8);
  24 +	t_array_init(&command, 8);
  25  
  26 -	array_append(&command, backend_command, strarray_length((char const * const *)backend_command));
  27 +	array_append(&command, backend_command, 
  28 +		str_array_length((char const * const *)backend_command));
  29  
  30  	for (i = 1; imap_args[i].type != IMAP_ARG_EOL; i++) {
  31 -		const char *str = imap_arg_string(&imap_args[i]);
  32 +		char *str = p_strdup(cmd->pool, imap_arg_string(&imap_args[i]));
  33  		if (str == NULL) {
  34  			client_send_command_error(cmd, "Invalid arguments.");
  35  			t_pop();
  36 @@ -236,7 +237,7 @@ bool cmd_xexec(struct client_command_con
  37  		}
  38  		close(pipe_err[1]);
  39  
  40 -		execvp(*(char **)array_idx(&command, 0), array_get(&command, NULL));
  41 +		execvp(*(char **)array_idx(&command, 0), array_idx(&command, 0));
  42  		exit(1);
  43  	}
  44  
  45 @@ -246,11 +247,11 @@ bool cmd_xexec(struct client_command_con
  46  	close(pipe_out[1]);
  47  	close(pipe_err[1]);
  48  
  49 -	ctx->in = o_stream_create_file(pipe_in[1], default_pool, 0, TRUE);
  50 -	ctx->out = i_stream_create_file(pipe_out[0], default_pool, 1024, TRUE);
  51 -	ctx->err = i_stream_create_file(pipe_err[0], default_pool, 1024, TRUE);
  52 +	ctx->in = o_stream_create_fd(pipe_in[1], 0, TRUE);
  53 +	ctx->out = i_stream_create_fd(pipe_out[0], 1024, TRUE);
  54 +	ctx->err = i_stream_create_fd(pipe_err[0], 1024, TRUE);
  55  
  56 -	ctx->loop = io_loop_create(default_pool);
  57 +	ctx->loop = io_loop_create();
  58  	ctx->io_out = io_add(i_stream_get_fd(ctx->out), IO_READ,
  59  			     cmd_xexec_stdout, ctx);
  60  	ctx->io_err = io_add(i_stream_get_fd(ctx->err), IO_READ,
  61 diff -r 7cafabf38524 xexec.h
  62 --- a/xexec.h	Wed Mar 19 00:58:24 2008 +0100
  63 +++ b/xexec.h	Fri Mar 21 18:12:26 2008 +0100
  64 @@ -5,7 +5,7 @@
  65  
  66  
  67  struct xexec {
  68 -	array_t ARRAY_DEFINE(setups, struct xexec_setups *);
  69 +	ARRAY_DEFINE(setups, struct xexec_setup *);
  70  };
  71  
  72  struct xexec_setup {
  73 diff -r 7cafabf38524 xexec_plugin.c
  74 --- a/xexec_plugin.c	Wed Mar 19 00:58:24 2008 +0100
  75 +++ b/xexec_plugin.c	Fri Mar 21 18:12:26 2008 +0100
  76 @@ -75,7 +75,7 @@ static struct xexec *xexec_init(void)
  77  	struct xexec *xexec;
  78  
  79  	xexec = i_new(struct xexec, 1);
  80 -	ARRAY_CREATE(&xexec->setups, default_pool, struct xexec_setup *, 4);
  81 +	i_array_init(&xexec->setups, 4);
  82  	return xexec;
  83  }
  84  
  85 @@ -122,7 +122,7 @@ void xexec_plugin_init(void)
  86  	}
  87  	t_pop();
  88  
  89 -	command_register("XEXEC", cmd_xexec);
  90 +	command_register("XEXEC", cmd_xexec, 0);
  91  	str_append(capability_string, " XEXEC");
  92  }
  93  

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2017-03-28 09:31:14, 2.9 KB) [[attachment:dovecot-xexec-1.1.v2.patch]]
  • [get | view] (2017-03-28 09:31:14, 16.9 KB) [[attachment:xexec.dovecot.v1.1.tar.gz]]
  • [get | view] (2017-03-28 09:31:14, 16.7 KB) [[attachment:xexec.tar.gz]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.