32 |
} |
} |
33 |
|
|
34 |
|
|
35 |
|
#ifdef CRAM_MD5 |
36 |
|
/* |
37 |
|
* Send to server data: a continuation command. |
38 |
|
*/ |
39 |
|
void |
40 |
|
send_command_cont(int *sock, char *cmd) |
41 |
|
{ |
42 |
|
#ifdef DEBUG |
43 |
|
fprintf(stderr, "debug: sending command (%s):\n\n%s\r\n\n", |
44 |
|
(sock == &sockpri ? "primary" : "auxiliary"), cmd); |
45 |
|
#endif |
46 |
|
|
47 |
|
socket_write(sock, cmd); |
48 |
|
socket_write(sock, "\r\n"); |
49 |
|
} |
50 |
|
|
51 |
|
#endif |
52 |
|
|
53 |
|
|
54 |
#ifdef DEBUG |
#ifdef DEBUG |
55 |
/* |
/* |
56 |
* IMAP NOOP: does nothing always succeeds. |
* IMAP NOOP: does nothing always succeeds. |
111 |
} |
} |
112 |
|
|
113 |
|
|
114 |
|
#ifdef CRAM_MD5 |
115 |
/* |
/* |
116 |
* IMAP AUTHENTICATE: indicates authentication mechanism and performs an |
* IMAP AUTHENTICATE: indicates authentication mechanism and performs an |
117 |
* authentication protocol exchange. |
* authentication protocol exchange. |
118 |
*/ |
*/ |
119 |
int |
int |
120 |
imap_authenticate(int *sock, char *auth) |
imap_authenticate(int *sock, char *auth, int cont) |
121 |
{ |
{ |
122 |
char cmd[MEDIUM_CMD]; |
char cmd[MEDIUM_CMD]; |
123 |
|
|
124 |
snprintf(cmd, MEDIUM_CMD, "%X AUTHENTICATE %s\r\n", tag, auth); |
if (!cont) { |
125 |
|
snprintf(cmd, MEDIUM_CMD, "%X AUTHENTICATE %s\r\n", tag, auth); |
126 |
return send_command(sock, cmd); |
return send_command(sock, cmd); |
127 |
|
} else { |
128 |
|
send_command_cont(sock, auth); |
129 |
|
return 0; |
130 |
|
} |
131 |
} |
} |
132 |
|
|
133 |
|
#endif |
134 |
|
|
135 |
|
|
136 |
/* |
/* |
137 |
* IMAP LOGIN: identifies client to server. |
* IMAP LOGIN: identifies client to server. |