auth-server-connection.c revision 2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8
/* Copyright (C) 2003 Timo Sirainen */
#include "lib.h"
#include "hash.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "network.h"
#include "auth-client.h"
#include "auth-server-connection.h"
#include "auth-server-request.h"
#include <unistd.h>
/* Maximum size for an auth reply. 50kB should be more than enough. */
#define MAX_OUTBUF_SIZE \
(sizeof(struct auth_client_request_continue) + \
{
struct auth_server_connection *conn;
client->available_auth_mechs = 0;
}
struct auth_client_handshake_reply *handshake)
{
if (handshake->server_pid == 0) {
i_error("BUG: Auth server said it's PID 0");
return;
}
}
}
static void auth_client_input(void *context)
{
struct auth_client_handshake_reply handshake;
const unsigned char *data;
case 0:
return;
case -1:
/* disconnected */
return;
case -2:
/* buffer full - can't happen unless auth is buggy */
i_error("BUG: Auth server sent us more than %d bytes of data",
return;
}
if (!conn->handshake_received) {
i_error("BUG: Auth server sent us too large handshake "
sizeof(handshake));
}
return;
}
if (!conn->reply_received) {
return;
}
return;
/* we've got a full reply */
}
struct auth_server_connection *
{
struct auth_server_connection *conn;
int fd;
if (fd == -1) {
return NULL;
}
/* use blocking connection since we depend on auth server -
if it's slow, just wait */
FALSE);
FALSE);
/* send our handshake */
i_warning("Error sending handshake to auth server: %m");
return NULL;
}
return conn;
}
int reconnect)
{
struct auth_server_connection **pos;
break;
}
}
if (!conn->handshake_received)
i_error("close(auth) failed: %m");
if (reconnect)
else {
}
}
struct auth_server_connection *
{
struct auth_server_connection *conn;
return conn;
}
return NULL;
}
struct auth_server_connection *
{
struct auth_server_connection *conn;
return conn;
}
*error_r = "Unsupported authentication mechanism";
else {
*error_r = "Authentication server isn't connected, "
"try again later..";
}
return NULL;
}