PREAUTH support from Oswald Buddenhagen <ossi@kde.org>

Added Tunnel directive to allow the user to specify a shell command to run
to set up an IMAP connection in place of a TCP socket (eg., to run over
an SSH session).
This commit is contained in:
Michael Elkins 2002-04-19 19:43:00 +00:00
parent 6267139b71
commit fe438026b0
7 changed files with 630 additions and 532 deletions

View File

@ -230,6 +230,13 @@ load_config (const char *where)
else else
global.copy_deleted_to = strdup (val); global.copy_deleted_to = strdup (val);
} }
else if (!strcasecmp ("Tunnel", cmd))
{
if (*cur)
(*cur)->tunnel = strdup (val);
else
global.tunnel = strdup (val);
}
else if (!strcasecmp ("Expunge", cmd)) else if (!strcasecmp ("Expunge", cmd))
{ {
if (*cur) if (*cur)

View File

@ -1,5 +1,5 @@
AC_INIT(isync.h) AC_INIT(isync.h)
AM_INIT_AUTOMAKE(isync,0.8) AM_INIT_AUTOMAKE(isync,0.9)
AM_PROG_CC_STDC AM_PROG_CC_STDC
AC_ARG_WITH(ssl-dir, [ --with-ssl-dir=DIR location where openssl is insalled], AC_ARG_WITH(ssl-dir, [ --with-ssl-dir=DIR location where openssl is insalled],
[if test -d $withval/lib; then [if test -d $withval/lib; then

1125
imap.c

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@
\" along with this program; if not, write to the Free Software \" along with this program; if not, write to the Free Software
\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
.. ..
.TH isync 1 "2002 Jan 16" .TH isync 1 "2002 Apr 19"
.. ..
.SH NAME .SH NAME
isync - synchronize IMAP4 and maildir mailboxes isync - synchronize IMAP4 and maildir mailboxes
@ -224,6 +224,11 @@ is 0, the maximum file size is
.B unlimited. .B unlimited.
.. ..
.TP .TP
\fBTunnel\fR \fIcommand\fR
Specify a command to run to establish a connection rather than opening a TCP
socket. This allows you to run an IMAP session over an SSH tunnel, for
example.
.TP
\fBUseNamespace\fR \fIyes|no\fR \fBUseNamespace\fR \fIyes|no\fR
Selects whether Selects whether
.B isync .B isync

View File

@ -30,7 +30,8 @@
typedef struct typedef struct
{ {
int fd; int rdfd; /* read filedes */
int wrfd; /* write filedes */
#if HAVE_LIBSSL #if HAVE_LIBSSL
SSL *ssl; SSL *ssl;
unsigned int use_ssl:1; unsigned int use_ssl:1;
@ -61,6 +62,7 @@ struct config
char *box; char *box;
char *alias; char *alias;
char *copy_deleted_to; char *copy_deleted_to;
char *tunnel;
unsigned int max_messages; unsigned int max_messages;
off_t max_size; off_t max_size;
config_t *next; config_t *next;
@ -119,7 +121,8 @@ typedef struct _list list_t;
#define NIL (void*)0x1 #define NIL (void*)0x1
#define LIST (void*)0x2 #define LIST (void*)0x2
struct _list { struct _list
{
char *val; char *val;
list_t *next; list_t *next;
list_t *child; list_t *child;
@ -187,7 +190,7 @@ int imap_copy_message (imap_t * imap, unsigned int uid, const char *mailbox);
int imap_fetch_message (imap_t *, unsigned int, int); int imap_fetch_message (imap_t *, unsigned int, int);
int imap_set_flags (imap_t *, unsigned int, unsigned int); int imap_set_flags (imap_t *, unsigned int, unsigned int);
int imap_expunge (imap_t *); int imap_expunge (imap_t *);
imap_t *imap_open (config_t *, unsigned int, imap_t *); imap_t *imap_open (config_t *, unsigned int, imap_t *, int);
int imap_append_message (imap_t *, int, message_t *); int imap_append_message (imap_t *, int, message_t *);
mailbox_t *maildir_open (const char *, int flags); mailbox_t *maildir_open (const char *, int flags);

View File

@ -40,3 +40,13 @@ Host host.play.com
# use a non-default port for this connection # use a non-default port for this connection
Port 6789 Port 6789
Alias personal Alias personal
###
### Remote mailbox over a SSH tunnel
###
Mailbox /home/me/Mail/remote
Host host.remote.com
Tunnel "ssh -q host.remote.com /usr/sbin/imapd"
Alias remote

2
main.c
View File

@ -292,7 +292,7 @@ main (int argc, char **argv)
break; break;
} }
imap = imap_open (box, fast ? mail->maxuid + 1 : 1, imap); imap = imap_open (box, fast ? mail->maxuid + 1 : 1, imap, 0);
if (!imap) if (!imap)
{ {
fprintf (stderr, "%s: skipping mailbox due to IMAP error\n", fprintf (stderr, "%s: skipping mailbox due to IMAP error\n",