auth-worker-client.c revision 8eb94c5190ba09bb6f6f068eec7bf96750f08d1d
02c335c23bf5fa225a467c19f2c063fb0dc7b8c3Timo Sirainen/* Copyright (C) 2005 Timo Sirainen */
e34d170f8f0e084bd94bfbc1a7085ece67e508dfTimo Sirainen/* If no requests have come within this time, kill ourself */
ad48319996942463675b53877092ab7e13a7a75aTimo Sirainenauth_worker_client_check_throttle(struct auth_worker_client *client)
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen if (o_stream_get_buffer_used_size(client->output) >=
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen /* stop reading new requests until client has read the pending
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainenworker_auth_request_new(struct auth_worker_client *client, unsigned int id,
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen auth_request = auth_request_new_dummy(client->auth);
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen for (tmp = t_strsplit(args, "\t"); *tmp != NULL; tmp++) {
650441dd8282f8fa6ae58d231c0c34488c3bdb49Timo Sirainen (void)auth_request_import(auth_request, key, value);
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainenstatic void verify_plain_callback(enum passdb_result result,
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen struct auth_worker_client *client = request->context;
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen const char *field =
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen auth_stream_reply_export(request->extra_fields);
e169102fb38ce788b76c2a344bee7d77079dea05Timo Sirainen o_stream_send(client->output, str_data(str), str_len(str));
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainenauth_worker_handle_passv(struct auth_worker_client *client,
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen /* verify plaintext password */
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen i_error("BUG: Auth worker server sent us invalid PASSV");
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen auth_request = worker_auth_request_new(client, id, args);
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen if (auth_request->user == NULL || auth_request->service == NULL) {
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen while (auth_request->passdb->id != passdb_id) {
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen auth_request->passdb = auth_request->passdb->next;
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen verify_plain(auth_request, password, verify_plain_callback);
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainenlookup_credentials_callback(enum passdb_result result, const char *credentials,
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen struct auth_worker_client *client = request->context;
8fcf84e6b7a55049a6d407b17af50d6ae8c6386fPhil Carmody str_printfa(str, "OK\t%s\t{%s}%s\t", request->user,
46b823ac3bce2c0f9f0fc73911e48d3a77b04fbeTimo Sirainen passdb_credentials_to_str(request->credentials),
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen const char *field =
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen auth_stream_reply_export(request->extra_fields);
5550482ce58e51584f83c10a4c63d35b66431742Timo Sirainen o_stream_send(client->output, str_data(str), str_len(str));
const char *credentials_str;
unsigned int num;
args++;
unsigned int num;
unsigned int id;
if (p == NULL)
return FALSE;
return TRUE;
char *line;
bool ret;
(int)AUTH_WORKER_MAX_LINE_LENGTH);
t_push();
t_pop();
if (!ret) {
struct auth_worker_client *
return client;