• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/postfix-252/postfix/src/xsasl/

Lines Matching refs:server

5 /*	Dovecot SASL server-side plug-in
11 /* This module implements the Dovecot SASL server-side authentication
19 /* The location of the Dovecot authentication server's UNIX-domain
184 /* xsasl_dovecot_server_mech_append - append server mechanism entry */
202 /* xsasl_dovecot_server_mech_free - destroy server mechanism list */
216 /* xsasl_dovecot_server_mech_filter - filter server mechanism list */
229 * Match Postfix properties against Dovecot server properties.
248 /* xsasl_dovecot_server_connect - initial auth server handshake */
353 /* xsasl_dovecot_server_disconnect - dispose of server connection state */
395 /* xsasl_dovecot_server_create - create server instance */
401 XSASL_DOVECOT_SERVER *server;
417 server = (XSASL_DOVECOT_SERVER *) mymalloc(sizeof(*server));
418 server->xsasl.free = xsasl_dovecot_server_free;
419 server->xsasl.first = xsasl_dovecot_server_first;
420 server->xsasl.next = xsasl_dovecot_server_next;
421 server->xsasl.get_mechanism_list = xsasl_dovecot_server_get_mechanism_list;
422 server->xsasl.get_username = xsasl_dovecot_server_get_username;
423 server->impl = (XSASL_DOVECOT_SERVER_IMPL *) impl;
424 server->sasl_line = vstring_alloc(256);
425 server->username = 0;
426 server->service = mystrdup(args->service);
427 server->last_request_id = 0;
428 server->mechanism_list = 0;
429 server->mechanism_argv = 0;
430 server->tls_flag = args->tls_flag;
431 server->sec_props =
435 server->client_addr = mystrdup(args->client_addr);
441 server->server_addr = mystrdup(args->server_addr);
447 server->server_addr = mystrdup(server_addr.buf);
450 return (&server->xsasl);
457 XSASL_DOVECOT_SERVER *server = (XSASL_DOVECOT_SERVER *) xp;
459 if (!server->impl->sasl_stream) {
460 if (xsasl_dovecot_server_connect(server->impl) < 0)
463 if (server->mechanism_list == 0) {
464 server->mechanism_argv = argv_alloc(2);
465 server->mechanism_list =
466 xsasl_dovecot_server_mech_filter(server->mechanism_argv,
467 server->impl->mechanism_list,
468 server->sec_props);
470 return (server->mechanism_list[0] ? server->mechanism_list : 0);
473 /* xsasl_dovecot_server_free - destroy server instance */
477 XSASL_DOVECOT_SERVER *server = (XSASL_DOVECOT_SERVER *) xp;
479 vstring_free(server->sasl_line);
480 if (server->username)
481 myfree(server->username);
482 if (server->mechanism_list) {
483 myfree(server->mechanism_list);
484 argv_free(server->mechanism_argv);
486 myfree(server->service);
487 myfree(server->server_addr);
488 myfree(server->client_addr);
489 myfree((char *) server);
492 /* xsasl_dovecot_server_auth_response - encode server first/next response */
494 static int xsasl_dovecot_parse_reply(XSASL_DOVECOT_SERVER *server, char **line)
505 if (strtoul(id, NULL, 0) != server->last_request_id) {
512 static void xsasl_dovecot_parse_reply_args(XSASL_DOVECOT_SERVER *server,
518 if (server->username) {
519 myfree(server->username);
520 server->username = 0;
530 server->username = mystrdup(line + 5);
531 printable(server->username, '?');
543 static int xsasl_dovecot_handle_reply(XSASL_DOVECOT_SERVER *server,
550 while (vstring_get_nonl(server->sasl_line,
551 server->impl->sasl_stream) != VSTREAM_EOF) {
552 line = vstring_str(server->sasl_line);
561 if (xsasl_dovecot_parse_reply(server, &line) == 0) {
563 xsasl_dovecot_parse_reply_args(server, line, reply, 1);
567 if (xsasl_dovecot_parse_reply(server, &line) == 0) {
572 if (xsasl_dovecot_parse_reply(server, &line) == 0) {
574 xsasl_dovecot_parse_reply_args(server, line, reply, 0);
582 vstring_strcpy(reply, "Connection lost to authentication server");
610 XSASL_DOVECOT_SERVER *server = (XSASL_DOVECOT_SERVER *) xp;
621 if (server->mechanism_argv == 0)
624 for (cpp = server->mechanism_argv->argv; /* see below */ ; cpp++) {
638 if (!server->impl->sasl_stream) {
639 if (xsasl_dovecot_server_connect(server->impl) < 0)
643 server->last_request_id = ++server->impl->request_id_counter;
645 vstream_fprintf(server->impl->sasl_stream,
647 server->last_request_id, sasl_method,
648 server->service, server->server_addr,
649 server->client_addr);
650 if (server->tls_flag)
652 vstream_fputs("\tsecured", server->impl->sasl_stream);
660 vstream_fprintf(server->impl->sasl_stream,
664 VSTREAM_PUTC('\n', server->impl->sasl_stream);
666 if (vstream_fflush(server->impl->sasl_stream) != VSTREAM_EOF)
670 vstring_strcpy(reply, "Can't connect to authentication server");
677 xsasl_dovecot_server_disconnect(server->impl);
680 return xsasl_dovecot_handle_reply(server, reply);
688 XSASL_DOVECOT_SERVER *server = (XSASL_DOVECOT_SERVER *) xp;
695 vstream_fprintf(server->impl->sasl_stream,
696 "CONT\t%u\t%s\n", server->last_request_id, request);
697 if (vstream_fflush(server->impl->sasl_stream) == VSTREAM_EOF) {
698 vstring_strcpy(reply, "Connection lost to authentication server");
701 return xsasl_dovecot_handle_reply(server, reply);
708 XSASL_DOVECOT_SERVER *server = (XSASL_DOVECOT_SERVER *) xp;
710 return (server->username);