Browse Source

backport: compat wrapper: don't crash if neither host nor tunnel are

specified.
wip/ssl-fprint
Oswald Buddenhagen 17 years ago
parent
commit
dff2f6a9f5
  1. 5
      src/compat/config.c

5
src/compat/config.c

@ -252,7 +252,7 @@ write_imap_server( FILE *fp, config_t *cfg )
if (sscanf( cfg->host, "%d.%d.%d.%d", &a1, &a2, &a3, &a4 ) == 4) if (sscanf( cfg->host, "%d.%d.%d.%d", &a1, &a2, &a3, &a4 ) == 4)
/* XXX this does not avoid clashes. add port? */ /* XXX this does not avoid clashes. add port? */
cfg->server_name = nfstrdup( cfg->host ); cfg->server_name = nfstrdup( cfg->host );
else { else if (cfg->host) {
p = strrchr( cfg->host, '.' ); p = strrchr( cfg->host, '.' );
if (!p) if (!p)
hl = nfsnprintf( buf, sizeof(buf), "%s", cfg->host ); hl = nfsnprintf( buf, sizeof(buf), "%s", cfg->host );
@ -271,6 +271,9 @@ write_imap_server( FILE *fp, config_t *cfg )
cfg->server_name = nfstrdup( buf ); cfg->server_name = nfstrdup( buf );
cfg->servers = 1; cfg->servers = 1;
gotsrv: ; gotsrv: ;
} else {
fprintf( stderr, "ERROR: Neither host nor tunnel specified for mailbox %s.\n", cfg->path );
exit( 1 );
} }
fprintf( fp, "IMAPAccount %s\n", cfg->server_name ); fprintf( fp, "IMAPAccount %s\n", cfg->server_name );
if (cfg->use_imaps) if (cfg->use_imaps)

Loading…
Cancel
Save