pop3-proxy.c revision ab1236617440e654d5c5a043b677512714b788dd
/* Copyright (C) 2004 Timo Sirainen */
#include "common.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "base64.h"
#include "safe-memset.h"
#include "str.h"
#include "client.h"
#include "pop3-proxy.h"
void *context)
{
const char *line;
/* remote authentication failed, we're just
freeing the proxy */
return;
}
/* failed for some reason */
return;
}
switch (i_stream_read(input)) {
case -2:
/* buffer full */
i_error("pop-proxy(%s): Remote input buffer full",
return;
case -1:
/* disconnected */
return;
}
return;
switch (client->proxy_state) {
case 0:
/* this is a banner */
i_error("pop3-proxy(%s): "
"Remote returned invalid banner: %s",
return;
}
/* send USER command */
client->proxy_state++;
return;
case 1:
break;
/* USER successful, send PASS */
client->proxy_state++;
return;
case 2:
/* Login successful. Send this line to client. */
t_strdup_printf("proxy(%s): started",
return;
}
/* 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 */
}
}
{
i_error("proxy(%s): password not given",
return -1;
}
return -1;
client->proxy_state = 0;
/* disable input until authentication is finished */
}
return 0;
}