Quellcode durchsuchen

add DisableExtension option to work around (server) bugs

Oswald Buddenhagen vor 10 Jahren
Ursprung
Commit
b8d6d833c6
2 geänderte Dateien mit 27 neuen und 0 gelöschten Zeilen
  1. 17 0
      src/drv_imap.c
  2. 10 0
      src/mbsync.1

+ 17 - 0
src/drv_imap.c

@@ -53,6 +53,7 @@ typedef struct imap_server_conf {
 	char *pass;
 	char *pass_cmd;
 	int max_in_progress;
+	int cap_mask;
 	string_list_t *auth_mechs;
 #ifdef HAVE_LIBSSL
 	char ssl_type;
@@ -1043,6 +1044,7 @@ parse_capability( imap_store_t *ctx, char *cmd )
 					ctx->caps |= 1 << i;
 		}
 	}
+	ctx->caps &= ~((imap_store_conf_t *)ctx->gen.conf)->server->cap_mask;
 	if (!CAP(NOLOGIN))
 		add_string_list( &ctx->auth_mechs, "LOGIN" );
 }
@@ -2687,6 +2689,7 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep )
 	imap_store_conf_t *store;
 	imap_server_conf_t *server, *srv, sserver;
 	const char *type, *name, *arg;
+	unsigned u;
 	int acc_opt = 0;
 #ifdef HAVE_LIBSSL
 	/* Legacy SSL options */
@@ -2756,6 +2759,20 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep )
 				error( "%s:%d: PipelineDepth must be at least 1\n", cfg->file, cfg->line );
 				cfg->err = 1;
 			}
+		} else if (!strcasecmp( "DisableExtension", cfg->cmd ) ||
+		           !strcasecmp( "DisableExtensions", cfg->cmd )) {
+			arg = cfg->val;
+			do {
+				for (u = 0; u < as(cap_list); u++) {
+					if (!strcasecmp( cap_list[u], arg )) {
+						server->cap_mask |= 1 << u;
+						goto gotcap;
+					}
+				}
+				error( "%s:%d: Unrecognized IMAP extension '%s'\n", cfg->file, cfg->line, arg );
+				cfg->err = 1;
+			  gotcap: ;
+			} while ((arg = get_arg( cfg, ARG_OPTIONAL, 0 )));
 		}
 #ifdef HAVE_LIBSSL
 		else if (!strcasecmp( "CertificateFile", cfg->cmd )) {

+ 10 - 0
src/mbsync.1

@@ -384,6 +384,13 @@ Setting this to \fI1\fR disables pipelining.
 This is mostly a debugging only option.
 (Default: \fIunlimited\fR)
 ..
+.TP
+\fBDisableExtension\fR[\fBs\fR] \fIextension\fR ...
+Disable the use of specific IMAP extensions.
+This can be used to work around bugs in servers
+(and possibly \fBmbsync\fR itself).
+(Default: empty)
+..
 .SS IMAP Stores
 The reference point for relative \fBPath\fRs is whatever the server likes it
 to be; probably the user's $HOME or $HOME/Mail on that server. The location
@@ -679,6 +686,9 @@ If your server supports auto-trashing (as Gmail does), it is probably a
 good idea to rely on that instead of \fBmbsync\fR's trash functionality.
 If you do that, and intend to synchronize the trash like other mailboxes,
 you should not use \fBmbsync\fR's \fBTrash\fR option at all.
+.P
+Use of the \fBTrash\fR option with M$ Exchange 2013 requires the use of
+\fBDisableExtension MOVE\fR due to a server bug.
 ..
 .SH INHERENT PROBLEMS
 Changes done after \fBmbsync\fR has retrieved the message list will not be