dict-connection.c revision e2a88d59c0d47d63ce1ad5b1fd95e487124a3fd4
/* Copyright (c) 2005-2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "llist.h"
#include "master-service.h"
#include "dict-client.h"
#include "dict-settings.h"
#include "dict-commands.h"
#include "dict-connection.h"
#include <stdlib.h>
#include <unistd.h>
static struct dict_connection *dict_connections;
const char *line)
{
if (*line++ != DICT_PROTOCOL_CMD_HELLO)
return -1;
/* check major version */
*line++ != '\t')
return -1;
/* skip minor version */
if (*line++ != '\t')
return -1;
/* get value type */
value_type = line;
if (*line++ != '\t')
return -1;
/* get username */
if (*line++ != '\t')
return -1;
/* the rest is dict name. since we're looking it with getenv(),
disallow all funny characters that might confuse it, just in case. */
if (*line != '\0')
return -1;
return 0;
}
{
const char *const *strlist;
unsigned int i, count;
const char *uri;
for (i = 0; i < count; i += 2) {
break;
}
if (i == count) {
i_error("dict client: Unconfigured dictionary name '%s'",
return -1;
}
/* dictionary initialization failed */
return -1;
}
return 0;
}
{
const char *line;
int ret;
case 0:
return;
case -1:
/* disconnected */
return;
case -2:
/* buffer full */
i_error("dict client: Sent us more than %d bytes",
(int)DICT_CLIENT_MAX_LINE_LENGTH);
return;
}
/* handshake not received yet */
return;
i_error("dict client: Broken handshake");
return;
}
if (dict_connection_dict_init(conn)) {
return;
}
}
T_BEGIN {
} T_END;
if (ret < 0) {
break;
}
}
}
{
struct dict_connection *conn;
FALSE);
return conn;
}
{
struct dict_connection_transaction *transaction;
}
i_error("close(dict client) failed: %m");
}
void dict_connections_destroy_all(void)
{
while (dict_connections != NULL)
}