~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to src/lib-auth/auth-client-request.c

  • Committer: Package Import Robot
  • Author(s): Jaldhar H. Vyas
  • Date: 2013-09-09 00:57:32 UTC
  • mfrom: (1.13.11)
  • mto: (4.8.5 experimental) (1.16.1)
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: package-import@ubuntu.com-20130909005732-dn1eell8srqbhh0e
Tags: upstream-2.2.5
ImportĀ upstreamĀ versionĀ 2.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2003-2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2003-2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "str.h"
31
31
 
32
32
        str = t_str_new(512);
33
33
        str_printfa(str, "AUTH\t%u\t", request->id);
34
 
        str_tabescape_write(str, info->mech);
 
34
        str_append_tabescaped(str, info->mech);
35
35
        str_append(str, "\tservice=");
36
 
        str_tabescape_write(str, info->service);
 
36
        str_append_tabescaped(str, info->service);
37
37
 
38
38
        if ((info->flags & AUTH_REQUEST_FLAG_SUPPORT_FINAL_RESP) != 0)
39
39
                str_append(str, "\tfinal-resp-ok");
46
46
 
47
47
        if (info->session_id != NULL) {
48
48
                str_append(str, "\tsession=");
49
 
                str_tabescape_write(str, info->session_id);
 
49
                str_append_tabescaped(str, info->session_id);
50
50
        }
51
51
        if (info->cert_username != NULL) {
52
52
                str_append(str, "\tcert_username=");
53
 
                str_tabescape_write(str, info->cert_username);
 
53
                str_append_tabescaped(str, info->cert_username);
54
54
        }
55
55
        if (info->local_ip.family != 0)
56
56
                str_printfa(str, "\tlip=%s", net_ip2addr(&info->local_ip));
60
60
                str_printfa(str, "\tlport=%u", info->local_port);
61
61
        if (info->remote_port != 0)
62
62
                str_printfa(str, "\trport=%u", info->remote_port);
 
63
 
 
64
        /* send the real_* variants only when they differ from the unreal
 
65
           ones */
 
66
        if (info->real_local_ip.family != 0 &&
 
67
            !net_ip_compare(&info->real_local_ip, &info->local_ip)) {
 
68
                str_printfa(str, "\treal_lip=%s",
 
69
                            net_ip2addr(&info->real_local_ip));
 
70
        }
 
71
        if (info->real_remote_ip.family != 0 &&
 
72
            !net_ip_compare(&info->real_remote_ip, &info->remote_ip)) {
 
73
                str_printfa(str, "\treal_rip=%s",
 
74
                            net_ip2addr(&info->real_remote_ip));
 
75
        }
 
76
        if (info->real_local_port != 0 &&
 
77
            info->real_local_port != info->local_port)
 
78
                str_printfa(str, "\treal_lport=%u", info->real_local_port);
 
79
        if (info->real_remote_port != 0 &&
 
80
            info->real_remote_port != info->remote_port)
 
81
                str_printfa(str, "\treal_rport=%u", info->real_remote_port);
 
82
 
63
83
        if (info->initial_resp_base64 != NULL) {
64
84
                str_append(str, "\tresp=");
65
 
                str_tabescape_write(str, info->initial_resp_base64);
 
85
                str_append_tabescaped(str, info->initial_resp_base64);
66
86
        }
67
87
        str_append_c(str, '\n');
68
88
 
124
144
                i_error("Error sending continue request to auth server: %m");
125
145
}
126
146
 
127
 
static void call_callback(struct auth_client_request *request,
128
 
                          enum auth_request_status status,
129
 
                          const char *data_base64,
130
 
                          const char *const *args)
 
147
static void ATTR_NULL(3, 4)
 
148
call_callback(struct auth_client_request *request,
 
149
              enum auth_request_status status,
 
150
              const char *data_base64,
 
151
              const char *const *args)
131
152
{
132
153
        auth_request_callback_t *callback = request->callback;
133
154