comparison src/lib-master/master-login-auth.c @ 12367:9f179255b796

lib-master: Stop accepting new connections after auth-master gets disconnected.
author Timo Sirainen <tss@iki.fi>
date Tue, 02 Nov 2010 18:21:05 +0000
parents f38e4e1465c8
children e72ab743b8df
comparison
equal deleted inserted replaced
12366:0b77044fbdd4 12367:9f179255b796
8 #include "llist.h" 8 #include "llist.h"
9 #include "hex-binary.h" 9 #include "hex-binary.h"
10 #include "hash.h" 10 #include "hash.h"
11 #include "str.h" 11 #include "str.h"
12 #include "master-interface.h" 12 #include "master-interface.h"
13 #include "master-service.h"
13 #include "master-auth.h" 14 #include "master-auth.h"
14 #include "master-login-auth.h" 15 #include "master-login-auth.h"
15 16
16 #include <stdlib.h> 17 #include <stdlib.h>
17 18
280 281
281 switch (i_stream_read(auth->input)) { 282 switch (i_stream_read(auth->input)) {
282 case 0: 283 case 0:
283 return; 284 return;
284 case -1: 285 case -1:
285 /* disconnected */ 286 /* disconnected. stop accepting new connections, because in
287 default configuration we no longer have permissions to
288 connect back to auth-master */
289 master_service_stop_new_connections(master_service);
286 master_login_auth_disconnect(auth); 290 master_login_auth_disconnect(auth);
287 return; 291 return;
288 case -2: 292 case -2:
289 /* buffer full */ 293 /* buffer full */
290 i_error("Auth server sent us too long line"); 294 i_error("Auth server sent us too long line");
409 struct master_login_auth_request *login_req; 413 struct master_login_auth_request *login_req;
410 unsigned int id; 414 unsigned int id;
411 415
412 if (auth->fd == -1) { 416 if (auth->fd == -1) {
413 if (master_login_auth_connect(auth) < 0) { 417 if (master_login_auth_connect(auth) < 0) {
418 /* we couldn't connect to auth now,
419 so we probably can't in future either. */
420 master_service_stop_new_connections(master_service);
414 callback(NULL, MASTER_AUTH_ERRMSG_INTERNAL_FAILURE, 421 callback(NULL, MASTER_AUTH_ERRMSG_INTERNAL_FAILURE,
415 context); 422 context);
416 return; 423 return;
417 } 424 }
418 o_stream_send_str(auth->output, 425 o_stream_send_str(auth->output,