2 * imap.c -- IMAP2bis/IMAP4 protocol methods
4 * Copyright 1997 by Eric S. Raymond
5 * For license terms, see the file COPYING in this directory.
12 #if defined(STDC_HEADERS)
15 #include "fetchmail.h"
19 #if defined (__bsdi__)
21 #define krb_get_err_text(e) (krb_err_txt[e])
23 #if defined (__FreeBSD__) || defined(__linux__)
24 #define krb_get_err_text(e) (krb_err_txt[e])
27 #endif /* KERBEROS_V4 */
30 #include <gssapi/gssapi.h>
31 #include <gssapi/gssapi_generic.h>
34 #ifndef strstr /* glibc-2.1 declares this as a macro */
35 extern char *strstr(); /* needed on sysV68 R3V7.1. */
38 /* imap_version values */
39 #define IMAP2 -1 /* IMAP2 or IMAP2BIS, RFC1176 */
40 #define IMAP4 0 /* IMAP4 rev 0, RFC1730 */
41 #define IMAP4rev1 1 /* IMAP4 rev 1, RFC2060 */
43 static int count, seen, recent, unseen, deletions,expunged, imap_version;
44 static char capabilities[POPBUFSIZE+1];
46 int imap_ok(int sock, char *argbuf)
47 /* parse command response */
49 char buf [POPBUFSIZE+1];
55 if ((ok = gen_recv(sock, buf, sizeof(buf))))
58 /* interpret untagged status responses */
59 if (strstr(buf, "CAPABILITIES"))
60 strncpy(capabilities, buf + 12, sizeof(capabilities));
61 if (strstr(buf, "EXISTS"))
63 if (strstr(buf, "RECENT"))
65 if (strstr(buf, "UNSEEN"))
70 * Handle both "* 42 UNSEEN" (if tha ever happens) and
71 * "* OK [UNSEEN 42] 42". Note that what this gets us is
72 * a minimum index, not a count.
75 for (cp = buf; *cp && !isdigit(*cp); cp++)
79 if (strstr(buf, "FLAGS"))
80 seen = (strstr(buf, "Seen") != (char *)NULL);
82 (tag[0] != '\0' && strncmp(buf, tag, strlen(tag)));
95 for (cp = buf; !isspace(*cp); cp++)
100 if (strncmp(cp, "OK", 2) == 0)
106 else if (strncmp(cp, "BAD", 2) == 0)
116 #elif SIZEOF_SHORT == 4
118 #elif SIZEOF_LONG == 4
121 #error Cannot deduce a 32-bit-type
124 static int do_rfc1731(int sock, char *truename)
125 /* authenticate as per RFC1731 -- note 32-bit integer requirement here */
128 char buf1[4096], buf2[4096];
132 } challenge1, challenge2;
133 char srvinst[INST_SZ];
135 char srvrealm[REALM_SZ];
136 KTEXT_ST authenticator;
137 CREDENTIALS credentials;
138 char tktuser[MAX_K_NAME_SZ+1+INST_SZ+1+REALM_SZ+1];
139 char tktinst[INST_SZ];
140 char tktrealm[REALM_SZ];
142 des_key_schedule schedule;
144 gen_send(sock, "AUTHENTICATE KERBEROS_V4");
146 /* The data encoded in the first ready response contains a random
147 * 32-bit number in network byte order. The client should respond
148 * with a Kerberos ticket and an authenticator for the principal
149 * "imap.hostname@realm", where "hostname" is the first component
150 * of the host name of the server with all letters in lower case
151 * and where "realm" is the Kerberos realm of the server. The
152 * encrypted checksum field included within the Kerberos
153 * authenticator should contain the server provided 32-bit number
154 * in network byte order.
157 if (result = gen_recv(sock, buf1, sizeof buf1)) {
161 len = from64tobits(challenge1.cstr, buf1);
163 error(0, -1, "could not decode initial BASE64 challenge");
167 /* Client responds with a Kerberos ticket and an authenticator for
168 * the principal "imap.hostname@realm" where "hostname" is the
169 * first component of the host name of the server with all letters
170 * in lower case and where "realm" is the Kerberos realm of the
171 * server. The encrypted checksum field included within the
172 * Kerberos authenticator should contain the server-provided
173 * 32-bit number in network byte order.
176 strncpy(srvinst, truename, (sizeof srvinst)-1);
177 srvinst[(sizeof srvinst)-1] = '\0';
178 for (p = srvinst; *p; p++) {
184 strncpy(srvrealm, (char *)krb_realmofhost(srvinst), (sizeof srvrealm)-1);
185 srvrealm[(sizeof srvrealm)-1] = '\0';
186 if (p = strchr(srvinst, '.')) {
190 result = krb_mk_req(&authenticator, "imap", srvinst, srvrealm, 0);
192 error(0, -1, "krb_mq_req: %s", krb_get_err_text(result));
196 result = krb_get_cred("imap", srvinst, srvrealm, &credentials);
198 error(0, -1, "krb_get_cred: %s", krb_get_err_text(result));
202 memcpy(session, credentials.session, sizeof session);
203 memset(&credentials, 0, sizeof credentials);
204 des_key_sched(session, schedule);
206 result = krb_get_tf_fullname(TKT_FILE, tktuser, tktinst, tktrealm);
208 error(0, -1, "krb_get_tf_fullname: %s", krb_get_err_text(result));
212 if (strcmp(tktuser, user) != 0) {
213 error(0, -1, "principal %s in ticket does not match -u %s", tktuser,
219 error(0, 0, "non-null instance (%s) might cause strange behavior",
221 strcat(tktuser, ".");
222 strcat(tktuser, tktinst);
225 if (strcmp(tktrealm, srvrealm) != 0) {
226 strcat(tktuser, "@");
227 strcat(tktuser, tktrealm);
230 result = krb_mk_req(&authenticator, "imap", srvinst, srvrealm,
233 error(0, -1, "krb_mq_req: %s", krb_get_err_text(result));
237 to64frombits(buf1, authenticator.dat, authenticator.length);
238 if (outlevel == O_VERBOSE) {
239 error(0, 0, "IMAP> %s", buf1);
241 SockWrite(sock, buf1, strlen(buf1));
242 SockWrite(sock, "\r\n", 2);
244 /* Upon decrypting and verifying the ticket and authenticator, the
245 * server should verify that the contained checksum field equals
246 * the original server provided random 32-bit number. Should the
247 * verification be successful, the server must add one to the
248 * checksum and construct 8 octets of data, with the first four
249 * octets containing the incremented checksum in network byte
250 * order, the fifth octet containing a bit-mask specifying the
251 * protection mechanisms supported by the server, and the sixth
252 * through eighth octets containing, in network byte order, the
253 * maximum cipher-text buffer size the server is able to receive.
254 * The server must encrypt the 8 octets of data in the session key
255 * and issue that encrypted data in a second ready response. The
256 * client should consider the server authenticated if the first
257 * four octets the un-encrypted data is equal to one plus the
258 * checksum it previously sent.
261 if (result = gen_recv(sock, buf1, sizeof buf1))
264 /* The client must construct data with the first four octets
265 * containing the original server-issued checksum in network byte
266 * order, the fifth octet containing the bit-mask specifying the
267 * selected protection mechanism, the sixth through eighth octets
268 * containing in network byte order the maximum cipher-text buffer
269 * size the client is able to receive, and the following octets
270 * containing a user name string. The client must then append
271 * from one to eight octets so that the length of the data is a
272 * multiple of eight octets. The client must then PCBC encrypt the
273 * data with the session key and respond to the second ready
274 * response with the encrypted data. The server decrypts the data
275 * and verifies the contained checksum. The username field
276 * identifies the user for whom subsequent IMAP operations are to
277 * be performed; the server must verify that the principal
278 * identified in the Kerberos ticket is authorized to connect as
279 * that user. After these verifications, the authentication
280 * process is complete.
283 len = from64tobits(buf2, buf1);
285 error(0, -1, "could not decode BASE64 ready response");
289 des_ecb_encrypt((des_cblock *)buf2, (des_cblock *)buf2, schedule, 0);
290 memcpy(challenge2.cstr, buf2, 4);
291 if (ntohl(challenge2.cint) != challenge1.cint + 1) {
292 error(0, -1, "challenge mismatch");
296 memset(authenticator.dat, 0, sizeof authenticator.dat);
298 result = htonl(challenge1.cint);
299 memcpy(authenticator.dat, &result, sizeof result);
301 /* The protection mechanisms and their corresponding bit-masks are as
304 * 1 No protection mechanism
305 * 2 Integrity (krb_mk_safe) protection
306 * 4 Privacy (krb_mk_priv) protection
308 authenticator.dat[4] = 1;
310 len = strlen(tktuser);
311 strncpy(authenticator.dat+8, tktuser, len);
312 authenticator.length = len + 8 + 1;
313 while (authenticator.length & 7) {
314 authenticator.length++;
316 des_pcbc_encrypt((des_cblock *)authenticator.dat,
317 (des_cblock *)authenticator.dat, authenticator.length, schedule,
320 to64frombits(buf1, authenticator.dat, authenticator.length);
321 if (outlevel == O_VERBOSE) {
322 error(0, 0, "IMAP> %s", buf1);
324 SockWrite(sock, buf1, strlen(buf1));
325 SockWrite(sock, "\r\n", 2);
327 if (result = gen_recv(sock, buf1, sizeof buf1))
330 if (strstr(buf1, "OK")) {
337 #endif /* KERBEROS_V4 */
340 #define GSSAUTH_P_NONE 1
341 #define GSSAUTH_P_INTEGRITY 2
342 #define GSSAUTH_P_PRIVACY 4
344 static int do_gssauth(int sock, char *hostname, char *username)
346 gss_buffer_desc request_buf, send_token;
347 gss_buffer_t sec_token;
348 gss_name_t target_name;
349 gss_ctx_id_t context;
353 OM_uint32 maj_stat, min_stat;
354 char buf1[8192], buf2[8192], server_conf_flags;
355 unsigned long buf_size;
358 /* first things first: get an imap ticket for host */
359 sprintf(buf1, "imap@%s", hostname);
360 request_buf.value = buf1;
361 request_buf.length = strlen(buf1) + 1;
362 maj_stat = gss_import_name(&min_stat, &request_buf, gss_nt_service_name,
364 if (maj_stat != GSS_S_COMPLETE) {
365 error(0, -1, "Couldn't get service name for [%s]", buf1);
368 else if (outlevel == O_VERBOSE) {
369 maj_stat = gss_display_name(&min_stat, target_name, &request_buf,
371 error(0, 0, "Using service name [%s]",request_buf.value);
372 maj_stat = gss_release_buffer(&min_stat, &request_buf);
375 gen_send(sock, "AUTHENTICATE GSSAPI");
377 /* upon receipt of the GSSAPI authentication request, server returns
378 * null data ready response. */
379 if (result = gen_recv(sock, buf1, sizeof buf1)) {
383 /* now start the security context initialisation loop... */
384 sec_token = GSS_C_NO_BUFFER;
385 context = GSS_C_NO_CONTEXT;
386 if (outlevel == O_VERBOSE)
387 error(0,0,"Sending credentials");
389 maj_stat = gss_init_sec_context(&min_stat, GSS_C_NO_CREDENTIAL,
390 &context, target_name, NULL, 0, 0, NULL, sec_token, NULL,
391 &send_token, &cflags, NULL);
392 if (maj_stat!=GSS_S_COMPLETE && maj_stat!=GSS_S_CONTINUE_NEEDED) {
393 error(0, -1,"Error exchanging credentials");
394 gss_release_name(&min_stat, &target_name);
395 /* wake up server and await NO response */
396 SockWrite(sock, "\r\n", 2);
397 if (result = gen_recv(sock, buf1, sizeof buf1))
401 to64frombits(buf1, send_token.value, send_token.length);
402 gss_release_buffer(&min_stat, &send_token);
403 SockWrite(sock, buf1, strlen(buf1));
404 SockWrite(sock, "\r\n", 2);
405 if (outlevel == O_VERBOSE)
406 error(0,0,"IMAP> %s", buf1);
407 if (maj_stat == GSS_S_CONTINUE_NEEDED) {
408 if (result = gen_recv(sock, buf1, sizeof buf1)) {
409 gss_release_name(&min_stat, &target_name);
412 request_buf.length = from64tobits(buf2, buf1 + 2);
413 request_buf.value = buf2;
414 sec_token = &request_buf;
416 } while (maj_stat == GSS_S_CONTINUE_NEEDED);
417 gss_release_name(&min_stat, &target_name);
419 /* get security flags and buffer size */
420 if (result = gen_recv(sock, buf1, sizeof buf1)) {
423 request_buf.length = from64tobits(buf2, buf1 + 2);
424 request_buf.value = buf2;
426 maj_stat = gss_unwrap(&min_stat, context, &request_buf, &send_token,
428 if (maj_stat != GSS_S_COMPLETE) {
429 error(0,-1,"Couldn't unwrap security level data");
430 gss_release_buffer(&min_stat, &send_token);
433 if (outlevel == O_VERBOSE)
434 error(0,0,"Credential exchange complete");
435 /* first octet is security levels supported. We want none, for now */
436 server_conf_flags = ((char *)send_token.value)[0];
437 if ( !(((char *)send_token.value)[0] & GSSAUTH_P_NONE) ) {
438 error(0,-1,"Server requires integrity and/or privacy");
439 gss_release_buffer(&min_stat, &send_token);
442 ((char *)send_token.value)[0] = 0;
443 buf_size = ntohl(*((long *)send_token.value));
444 /* we don't care about buffer size if we don't wrap data */
445 gss_release_buffer(&min_stat, &send_token);
446 if (outlevel == O_VERBOSE) {
447 error(0,0,"Unwrapped security level flags: %s%s%s",
448 server_conf_flags & GSSAUTH_P_NONE ? "N" : "-",
449 server_conf_flags & GSSAUTH_P_INTEGRITY ? "I" : "-",
450 server_conf_flags & GSSAUTH_P_PRIVACY ? "C" : "-");
451 error(0,0,"Maximum GSS token size is %ld",buf_size);
454 /* now respond in kind (hack!!!) */
455 buf_size = htonl(buf_size); /* do as they do... only matters if we do enc */
456 memcpy(buf1, &buf_size, 4);
457 buf1[0] = GSSAUTH_P_NONE;
458 strcpy(buf1+4, username); /* server decides if princ is user */
459 request_buf.length = 4 + strlen(username) + 1;
460 request_buf.value = buf1;
461 maj_stat = gss_wrap(&min_stat, context, 0, GSS_C_QOP_DEFAULT, &request_buf,
462 &cflags, &send_token);
463 if (maj_stat != GSS_S_COMPLETE) {
464 error(0,-1,"Error creating security level request");
467 to64frombits(buf1, send_token.value, send_token.length);
468 if (outlevel == O_VERBOSE) {
469 error(0,0,"Requesting authorisation as %s", username);
470 error(0,0,"IMAP> %s",buf1);
472 SockWrite(sock, buf1, strlen(buf1));
473 SockWrite(sock, "\r\n", 2);
475 /* we should be done. Get status and finish up */
476 if (result = gen_recv(sock, buf1, sizeof buf1))
478 if (strstr(buf1, "OK")) {
479 /* flush security context */
480 if (outlevel == O_VERBOSE)
481 error(0, 0, "Releasing GSS credentials");
482 maj_stat = gss_delete_sec_context(&min_stat, &context, &send_token);
483 if (maj_stat != GSS_S_COMPLETE) {
484 error(0, -1, "Error releasing credentials");
487 /* send_token may contain a notification to the server to flush
488 * credentials. RFC 1731 doesn't specify what to do, and since this
489 * support is only for authentication, we'll assume the server
490 * knows enough to flush its own credentials */
498 int imap_getauth(int sock, struct query *ctl, char *greeting)
499 /* apply for connection authorization */
503 /* probe to see if we're running IMAP4 and can use RFC822.PEEK */
504 capabilities[0] = '\0';
505 if ((ok = gen_transact(sock, "CAPABILITY")) == PS_SUCCESS)
507 /* UW-IMAP server 10.173 notifies in all caps */
508 if (strstr(capabilities, "IMAP4rev1") || strstr(capabilities, "IMAP4REV1"))
510 imap_version = IMAP4rev1;
511 if (outlevel == O_VERBOSE)
512 error(0, 0, "Protocol identified as IMAP4 rev 1");
516 imap_version = IMAP4;
517 if (outlevel == O_VERBOSE)
518 error(0, 0, "Protocol identified as IMAP4 rev 0");
521 else if (ok == PS_ERROR)
523 imap_version = IMAP2;
524 if (outlevel == O_VERBOSE)
525 error(0, 0, "Protocol identified as IMAP2 or IMAP2BIS");
530 peek_capable = (imap_version >= IMAP4);
533 if (strstr(capabilities, "AUTH=GSSAPI"))
535 if (ctl->server.protocol == P_IMAP_GSS)
537 if (outlevel == O_VERBOSE)
538 error(0, 0, "GSS authentication is supported");
539 return do_gssauth(sock, ctl->server.truename, ctl->remotename);
542 else if (ctl->server.protocol == P_IMAP_GSS)
544 error(0,-1, "Required GSS capability not supported by server");
550 if (strstr(capabilities, "AUTH=KERBEROS_V4"))
552 if (outlevel == O_VERBOSE)
553 error(0, 0, "KERBEROS_V4 authentication is supported");
555 if (ctl->server.protocol == P_IMAP_K4)
557 if ((ok = do_rfc1731(sock, ctl->server.truename)))
559 if (outlevel == O_VERBOSE)
560 error(0, 0, "IMAP> *");
561 SockWrite(sock, "*\r\n", 3);
566 /* else fall through to ourdinary AUTH=LOGIN case */
568 else if (ctl->server.protocol == P_IMAP_K4)
570 error(0,-1, "Required KERBEROS_V4 capability not supported by server");
573 #endif /* KERBEROS_V4 */
575 /* try to get authorized in the ordinary (AUTH=LOGIN) way */
576 ok = gen_transact(sock, "LOGIN %s \"%s\"", ctl->remotename, ctl->password);
583 static int internal_expunge(int sock)
584 /* ship an expunge, resetting associated counters */
588 if ((ok = gen_transact(sock, "EXPUNGE")))
591 expunged += deletions;
594 #ifdef IMAP_UID /* not used */
596 #endif /* IMAP_UID */
599 static int imap_getrange(int sock,
602 int *countp, int *newp)
603 /* get range of messages to be fetched */
607 /* find out how many messages are waiting */
608 recent = unseen = -1;
613 * We have to have an expunge here, otherwise the re-poll will
614 * infinite-loop picking up un-expunged message.
617 if (deletions && ctl->expunge > 1)
618 internal_expunge(sock);
620 if (ok || gen_transact(sock, "NOOP"))
622 error(0, 0, "re-poll failed");
625 else if (count == -1) /* no EXISTS response to NOOP */
634 ok = gen_transact(sock, "SELECT %s", folder ? folder : "INBOX");
636 ok = gen_transact(sock, "EXAMINE %s", folder ? folder : "INBOX");
639 error(0, 0, "mailbox selection failed");
647 * Note: because IMAP has an is_old method, this number is used
648 * only for the "X messages (Y unseen)" notification. Accordingly
649 * it doesn't matter much that it can be wrong (e.g. if we see an
650 * UNSEEN response but not all messages above the first UNSEEN one
653 if (unseen >= 0) /* optional, but better if we see it */
654 *newp = count - unseen + 1;
655 else if (recent >= 0) /* mandatory */
658 *newp = -1; /* should never happen, RECENT is mandatory */
665 static int imap_getsizes(int sock, int count, int *sizes)
666 /* capture the sizes of all messages */
668 char buf [POPBUFSIZE+1];
671 * Some servers (as in, PMDF5.1-9.1 under OpenVMS 6.1)
672 * won't accept 1:1 as valid set syntax. Some implementors
673 * should be taken out and shot for excessive anality.
676 gen_send(sock, "FETCH 1 RFC822.SIZE", count);
678 gen_send(sock, "FETCH 1:%d RFC822.SIZE", count);
683 if ((ok = gen_recv(sock, buf, sizeof(buf))))
685 if (strstr(buf, "OK"))
687 else if (sscanf(buf, "* %d FETCH (RFC822.SIZE %d)", &num, &size) == 2)
688 sizes[num - 1] = size;
694 static int imap_is_old(int sock, struct query *ctl, int number)
695 /* is the given message old? */
699 /* expunges change the fetch numbers */
702 if ((ok = gen_transact(sock, "FETCH %d FLAGS", number)) != 0)
708 static int imap_fetch_headers(int sock, struct query *ctl,int number,int *lenp)
709 /* request headers of nth message */
711 char buf [POPBUFSIZE+1];
714 /* expunges change the fetch numbers */
718 * This is blessed by RFC 1176, RFC1730, RFC2060.
719 * According to the RFCs, it should *not* set the \Seen flag.
721 gen_send(sock, "FETCH %d RFC822.HEADER", number);
723 /* looking for FETCH response */
727 if ((ok = gen_recv(sock, buf, sizeof(buf))))
730 (sscanf(buf+2, "%d FETCH (%*s {%d}", &num, lenp) != 2);
738 static int imap_fetch_body(int sock, struct query *ctl, int number, int *lenp)
739 /* request body of nth message */
741 char buf [POPBUFSIZE+1], *cp;
744 /* expunges change the fetch numbers */
748 * If we're using IMAP4, we can fetch the message without setting its
749 * seen flag. This is good! It means that if the protocol exchange
750 * craps out during the message, it will still be marked `unseen' on
753 * However...*don't* do this if we're using keep to suppress deletion!
754 * In that case, marking the seen flag is the only way to prevent the
755 * message from being re-fetched on subsequent runs.
757 switch (imap_version)
759 case IMAP4rev1: /* RFC 2060 */
761 gen_send(sock, "FETCH %d BODY.PEEK[TEXT]", number);
763 gen_send(sock, "FETCH %d BODY[TEXT]", number);
766 case IMAP4: /* RFC 1730 */
768 gen_send(sock, "FETCH %d RFC822.TEXT.PEEK", number);
770 gen_send(sock, "FETCH %d RFC822.TEXT", number);
773 default: /* RFC 1176 */
774 gen_send(sock, "FETCH %d RFC822.TEXT", number);
778 /* looking for FETCH response */
782 if ((ok = gen_recv(sock, buf, sizeof(buf))))
785 (sscanf(buf+2, "%d FETCH", &num) != 1);
790 /* try to extract a length */
791 if ((cp = strchr(buf, '{')))
792 *lenp = atoi(cp + 1);
799 static int imap_trail(int sock, struct query *ctl, int number)
800 /* discard tail of FETCH response after reading message text */
802 /* expunges change the fetch numbers */
803 /* number -= expunged; */
807 char buf[POPBUFSIZE+1];
810 if ((ok = gen_recv(sock, buf, sizeof(buf))))
813 /* UW IMAP returns "OK FETCH", Cyrus returns "OK Completed" */
814 if (strstr(buf, "OK"))
821 static int imap_delete(int sock, struct query *ctl, int number)
822 /* set delete flag for given message */
826 /* expunges change the fetch numbers */
830 * Use SILENT if possible as a minor throughput optimization.
831 * Note: this has been dropped from IMAP4rev1.
833 if ((ok = gen_transact(sock,
834 imap_version == IMAP4
835 ? "STORE %d +FLAGS.SILENT (\\Deleted)"
836 : "STORE %d +FLAGS (\\Deleted)",
843 * We do an expunge after ctl->expunge messages, rather than
844 * just before quit, so that a line hit during a long session
845 * won't result in lots of messages being fetched again during
848 if (NUM_NONZERO(ctl->expunge) && (deletions % ctl->expunge) == 0)
849 internal_expunge(sock);
854 static int imap_logout(int sock, struct query *ctl)
855 /* send logout command */
857 /* if expunges after deletion have been suppressed, ship one now */
858 if (NUM_SPECIFIED(ctl->expunge) && NUM_ZERO(ctl->expunge) && deletions)
859 internal_expunge(sock);
861 return(gen_transact(sock, "LOGOUT"));
864 const static struct method imap =
866 "IMAP", /* Internet Message Access Protocol */
867 143, /* standard IMAP2bis/IMAP4 port */
868 TRUE, /* this is a tagged protocol */
869 FALSE, /* no message delimiter */
870 imap_ok, /* parse command response */
871 imap_getauth, /* get authorization */
872 imap_getrange, /* query range of messages */
873 imap_getsizes, /* get sizes of messages (used for --limit option */
874 imap_is_old, /* no UID check */
875 imap_fetch_headers, /* request given message headers */
876 imap_fetch_body, /* request given message body */
877 imap_trail, /* eat message trailer */
878 imap_delete, /* delete the message */
879 imap_logout, /* expunge and exit */
880 TRUE, /* yes, we can re-poll */
883 int doIMAP(struct query *ctl)
884 /* retrieve messages using IMAP Version 2bis or Version 4 */
886 return(do_protocol(ctl, &imap));
889 /* imap.c ends here */