imap-proxy.c revision d7cd49f01fad7c87c5a0865ebf54a548275e9fee
/* Copyright (C) 2004 Timo Sirainen */
#include "common.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "str.h"
#include "safe-memset.h"
#include "client.h"
#include "imap-quote.h"
#include "imap-proxy.h"
{
const char *msg;
if (!client->proxy_login_sent) {
/* this is a banner */
i_error("imap-proxy(%s): "
"Remote returned invalid banner: %s",
return -1;
}
/* send LOGIN command */
return 0;
/* Login successful. Send this line to client. */
(void)client_skip_line(client);
return -1;
/* Login failed. Send our own failure reply so client can't
figure out if user exists or not just by looking at the
reply string. */
/* allow client input again */
return -1;
} else {
/* probably some untagged reply */
return 0;
}
}
struct imap_client *client)
{
const char *line;
/* remote authentication failed, we're just
freeing the proxy */
return;
}
/* we came here from client_destroy() */
return;
}
/* failed for some reason, probably server disconnected */
return;
}
switch (i_stream_read(input)) {
case -2:
/* buffer full */
i_error("imap-proxy(%s): Remote input buffer full",
return;
case -1:
/* disconnected */
return;
}
break;
}
}
{
i_error("proxy(%s): password not given",
return -1;
}
/* connection_queue_add() decided that we were the oldest
connection and killed us. */
return -1;
}
return -1;
/* disable input until authentication is finished */
return 0;
}