auth-client-connection.c revision eb7b8855cc45292334056f425645215e348ec493
/* Copyright (c) 2002-2012 Dovecot authors, see the included COPYING file */
#include "auth-common.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "net.h"
#include "hex-binary.h"
#include "hostpid.h"
#include "llist.h"
#include "str.h"
#include "str-sanitize.h"
#include "randgen.h"
#include "safe-memset.h"
#include "master-service.h"
#include "mech.h"
#include "auth-stream.h"
#include "auth-request-handler.h"
#include "auth-client-interface.h"
#include "auth-client-connection.h"
#include "auth-master-connection.h"
#include <stdlib.h>
static struct auth_client_connection *auth_client_connections;
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)
{
/* stop reading new requests until client has read the pending
replies. */
}
i_debug("client passdb out: %s",
}
}
static void auth_callback(const char *reply,
struct auth_client_connection *conn)
{
/* handler destroyed */
} else {
}
}
static bool
{
struct auth_client_connection *old;
unsigned int pid;
i_error("BUG: Authentication client said it's PID 0");
return FALSE;
}
if (conn->login_requests)
else {
/* the client is only authenticating, not logging in.
the PID isn't necessary, and since we allow authentication
via TCP sockets the PIDs may conflict, so ignore them. */
pid = 0;
}
/* 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
{
unsigned int client_id;
i_error("BUG: Authentication client sent broken CANCEL");
return FALSE;
}
return TRUE;
}
static bool
{
i_debug("client in: %s",
}
line + 5);
}
i_debug("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_BEGIN {
} T_END;
if (!ret) {
break;
}
}
}
bool login_requests, bool token_auth)
{
static unsigned int connect_uid_counter = 0;
struct auth_client_connection *conn;
const char *mechanisms;
FALSE);
if (token_auth) {
} else {
}
}
{
return;
}
}
{
unsigned int request_count;
int err;
else
err = 0;
if (request_count > 0) {
i_warning("auth client %u disconnected with %u "
}
}
{
return;
}
struct auth_client_connection *
auth_client_connection_lookup(unsigned int pid)
{
struct auth_client_connection *conn;
return conn;
}
return NULL;
}
void auth_client_connections_destroy_all(void)
{
struct auth_client_connection *conn;
while (auth_client_connections != NULL) {
}
}