login-connection.c revision c8ffea67272a9893d7d03860746371eb2490c255
/* Copyright (C) 2002 Timo Sirainen */
#include "common.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "network.h"
#include "safe-memset.h"
#include "cookie.h"
#include "login-connection.h"
#include <stdlib.h>
#include <syslog.h>
#define MAX_INBUF_SIZE \
(sizeof(AuthContinuedRequestData) + AUTH_MAX_REQUEST_DATA_SIZE)
#define MAX_OUTBUF_SIZE \
struct _LoginConnection {
int fd;
unsigned int pid;
};
static AuthInitData auth_init_data;
static LoginConnection *connections;
void *context)
{
}
}
{
return conn;
}
return NULL;
}
{
unsigned char *data;
if (size < sizeof(ClientAuthInitData))
return;
/* Don't just cast because of alignment issues. */
i_error("BUG: imap-login said it's PID 0");
/* well, it might have just reconnected very fast .. although
there's not much reason for it. */
i_error("BUG: imap-login gave a PID of existing connection");
} else {
}
}
{
unsigned char *data;
if (size < sizeof(AuthRequestType))
return;
/* note that we can't directly cast the received data pointer into
structures, as it may not be aligned properly. */
/* get the request type */
}
return;
/* we have a full init request */
return;
return;
/* we have a full continued request */
/* clear any sensitive data from memory */
} else {
/* unknown request */
i_error("BUG: imap-login sent us unknown request %u",
}
}
{
case 0:
return;
case -1:
/* disconnected */
return;
case -2:
/* buffer full */
i_error("BUG: imap-login sent us more than %d bytes of data",
(int)MAX_INBUF_SIZE);
return;
}
else
}
{
FALSE);
connections = conn;
sizeof(auth_init_data)) < 0) {
}
return conn;
}
{
break;
}
}
}
void login_connections_init(void)
{
const char *env;
i_fatal("AUTH_PROCESS environment is unset");
connections = NULL;
}
void login_connections_deinit(void)
{
while (connections != NULL) {
connections = next;
}
}