auth-client-connection.c revision 5cda7e699876c1de203c30777924c899d2a20221
/* Copyright (C) 2002-2005 Timo Sirainen */
#include "common.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "network.h"
#include "array.h"
#include "str.h"
#include "str-sanitize.h"
#include "safe-memset.h"
#include "auth-request-handler.h"
#include "auth-client-interface.h"
#include "auth-client-connection.h"
#include "auth-master-listener.h"
#include "auth-master-connection.h"
#include <stdlib.h>
static const char *reply_line_hide_pass(const char *line)
{
const char *p, *p2;
/* hide proxy reply password */
if (p == NULL)
return line;
p += 6;
}
const char *cmd)
{
t_push();
}
/* stop reading new requests until client has read the pending
replies. */
}
t_pop();
}
static void auth_callback(const char *reply,
struct auth_client_connection *conn)
{
/* handler destroyed */
return;
}
}
static bool
{
struct auth_client_connection *old;
unsigned int pid;
if (pid == 0) {
i_error("BUG: Authentication client said it's PID 0");
return FALSE;
}
/* already exists. it's possible that it just reconnected,
see if the old connection is still there. */
}
}
i_error("BUG: Authentication client gave a PID "
"%u of existing connection", pid);
return FALSE;
}
/* handshake complete, we can now actually start serving requests */
return TRUE;
}
{
return 1;
}
/* allow input again */
}
return 1;
}
static const char *auth_line_hide_pass(const char *line)
{
const char *p, *p2;
if (p == NULL)
return line;
p += 6;
}
static const char *cont_line_hide_pass(const char *line)
{
const char *p;
if (p == NULL)
return line;
}
static bool
{
i_info("client in: %s",
}
line + 5);
}
i_info("client in: %s",
}
line + 5);
}
i_error("BUG: Authentication client sent unknown command: %s",
return FALSE;
}
{
char *line;
bool ret;
case 0:
return;
case -1:
/* disconnected */
return;
case -2:
/* buffer full */
i_error("BUG: Auth client %u sent us more than %d bytes",
return;
}
/* still handshaking */
return;
if (!conn->version_received) {
/* make sure the major version matches */
i_error("Authentication client "
"not compatible with this server "
"(mixed old and new binaries?)");
return;
}
continue;
}
return;
}
} else {
i_error("BUG: Authentication client sent "
"unknown handshake command: %s",
return;
}
}
t_push();
t_pop();
if (!ret) {
break;
}
}
}
struct auth_client_connection *
{
static unsigned int connect_uid_counter = 0;
struct auth_client_connection *conn;
return conn;
}
{
struct auth_client_connection *const *clients;
unsigned int i, count;
return;
for (i = 0; i < count; i++) {
break;
}
}
}
{
return;
}
struct auth_client_connection *
unsigned int pid)
{
struct auth_client_connection *const *clients;
unsigned int i, count;
for (i = 0; i < count; i++) {
return clients[i];
}
return NULL;
}
{
struct auth_client_connection *const *clients;
unsigned int i, count;
for (i = 0; i < count; i++) {
clients[i]->request_handler);
}
}
}
{
}
{
}