Subject: C-client startup questions

From: Brian Sammon <[email-masked]>
Date: Tue, 03 Jul 2001 16:31:20 -0400

I'm planning to start writing an IMAP client with C-client for use with a 
Cyrus server.
I'm trying to learn the C-client usage. 
My first questions are about starting the client.
The following are some of the things that (it seems) my program would have 
to do when starting up:

1) Connect to server.
	looks like imap_open would do this, but not sure if there's a higher
	level function I should be calling.
2) send AUTHENTICATE
	I want to do kerberos authentication (and possibly support other
	methods) 
	Do I call mail_auth() or should I let this be taken care of
	automatically?
	If it's automatically, how do I specify that I want to use kerberos?
3)Create and initialize MAILSTREAM structure.
	It looks like mail_open handles this when necessary.  Is that correct?

Specific answers or just pointers to documentation that answers these 
questions would be appreciated.

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Tue, 3 Jul 2001 13:42:58 -0700 (PDT)

> 	level function I should be calling.

Do not call any imap_???() function.  The correct function is mail_open().
Most of the interfaces you need are in the mail_???() functions.

> 	Do I call mail_auth() or should I let this be taken care of

It is automatic.

> 	If it's automatically, how do I specify that I want to use kerberos?

You don't.  It'll use Kerberos unless you go to great effort to prevent it
from doing so.

> 	It looks like mail_open handles this when necessary.  Is that correct?

Yes, and mail_open() calls imap_open().  So don't ever call imap_open() or any
other imap_???() function.

---

From: Brian Sammon <[email-masked]>
Date: Thu, 05 Jul 2001 11:20:31 -0400

> Most of the interfaces you need are in the mail_???() functions.

Okay, this leads to my next question-- How do I tell C-client that I want 
to use IMAP and what the name of the server is?

Thanks for the help so far.

---

From: Mark Crispin <[email-masked]>
Date: Thu, 5 Jul 2001 11:35:54 -0700 (PDT)

> to use IMAP and what the name of the server is?

That's specified in the name that you give to mail_open(), exactly as you do
with Pine.  Refer to imap-????/docs/naming.txt

---

From: Edward Marczak <[email-masked]>
Date: Wed, 03 Jul 2002 13:19:42 -0400

Here's something that's vexing me.....

I'm running imap2001a on a RedHat 7.2 box.  IMAP (specifically, port 143) is
accessible on it's local LAN, and over the Internet.

Local users have no problem with accessing IMAP (both shell and from other
machines).  Most remote users can connect with no problem.  I have some
users that can't access mail remotely using IMAP.

Now, the thing about the sites that can't access mail from this box....they
can access other servers running UW-IMAP at other locations.

If I trace packets on the problem sites (using ethereal from the host), I
get:

  0.000000 client -> server TCP 50808 > imap [SYN] Seq=3776413896 Ack=0
Win=32768 Len=0

  0.000000 server -> client TCP imap > 50808 [SYN, ACK] Seq=2554725386
Ack=3776413897 Win=5840 Len=0

  0.040000 client -> server TCP 50808 > imap [ACK] Seq=3776413897
Ack=2554725387 Win=32768 Len=0

 30.050000 server -> client IMAP Response: * OK [CAPABILITY IMAP4REV1
LOGIN-REFERRALS STARTTLS AUTH=LOGIN] server IMAP4rev1 2001.315rh at Wed, 3
Jul 2002 12:53:58 -0400 (EDT)

 33.050000 server -> client IMAP Response: * OK [CAPABILITY IMAP4REV1
LOGIN-REFERRALS STARTTLS AUTH=LOGIN] server IMAP4rev1 2001.315rh at Wed, 3
Jul 2002 12:53:58 -0400 (EDT)

 39.050000 server -> client IMAP Response: * OK [CAPABILITY IMAP4REV1
LOGIN-REFERRALS STARTTLS AUTH=LOGIN] server IMAP4rev1 2001.315rh at Wed, 3
Jul 2002 12:53:58 -0400 (EDT)

 51.050000 server -> client IMAP Response: * OK [CAPABILITY IMAP4REV1
LOGIN-REFERRALS STARTTLS AUTH=LOGIN] server IMAP4rev1 2001.315rh at Wed, 3
Jul 2002 12:53:58 -0400 (EDT)

 75.050000 server -> client IMAP Response: * OK [CAPABILITY IMAP4REV1
LOGIN-REFERRALS STARTTLS AUTH=LOGIN] server IMAP4rev1 2001.315rh at Wed, 3
Jul 2002 12:53:58 -0400 (EDT)

123.050000 server -> client IMAP Response: * OK [CAPABILITY IMAP4REV1
LOGIN-REFERRALS STARTTLS AUTH=LOGIN] server IMAP4rev1 2001.315rh at Wed, 3
Jul 2002 12:53:58 -0400 (EDT)

210.150000 server -> client IMAP Response: * BYE Autologout; idle for too
long

Of course, names have been changed to protect the innocent.

So basically, they connect, but then the server just keeps sending out
OK....

I initially figured it was just some weird routing thing, but, from a site
that's not working, if I open a shell and connect manually, I can!  Witness:

[blah@shame blah]# telnet server 143
Trying x.x.x.x...
Connected to server.
Escape character is '^]'.

* OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS STARTTLS AUTH=LOGIN] server
IMAP4rev1 2001.315rh at Wed, 3 Jul 2002 13:00:55 -0400 (EDT)
* BAD Null command
01 login someuser somepass
01 OK [CAPABILITY IMAP4REV1 IDLE NAMESPACE MAILBOX-REFERRALS SCAN SORT
THREAD=REFERENCES THREAD=ORDEREDSUBJECT MULTIAPPEND] User someuser
authenticated

(names again changed)

Hmmmmmmmm.  So I tried changing clients.  I've tried Outlook, Netscape, and
yes, Pine.  None connect.  All exhibit the symptoms above.

Anybody know what this is indicative of, or something else I do to
troubleshoot?  Thanks!
-- 
Ed Marczak
[email-masked]

---

From: Mark Crispin <[email-masked]>
Date: Wed, 3 Jul 2002 10:31:37 -0700 (PDT)

It is good that you tried Pine.

Try getting a Pine telemetry with "pine -d imap=4".  That will tell you what
the client is seeing in the .pine-debug[1-4] file.

Try running unmodified UW imapd in case there is a bug introduced by a RedHat
modification.

Try some other network trace tools.  Is the IMAP server *really* sending the
initial OK multiple times?  Or are you seeing retransmissions from the server
TCP, and the client TCP is never acknowledging them?  If the Pine log shows
that it never got anything from the server, it suggests the latter.

If the latter (and that's what I suspect), then the problem is more low-level
than IMAP.  This means that you have a network connectivity issue, not an IMAP
issue.  Unfortunately, these sorts of problems are difficult to resolve
without a low-level packet trace and someone who can interpret the packet
trace correctly.

---

From: Edward Marczak <[email-masked]>
Date: Wed, 03 Jul 2002 14:50:10 -0400

> the client is seeing in the .pine-debug[1-4] file.

That basically tells me that, "Operation timed out."

> Try running unmodified UW imapd in case there is a bug introduced by a RedHat

That's what I have on there now....no joy.

> Try some other network trace tools.

I can ping the routers at each location (from the other).  I can even send
mail from the sites that can't access IMAP, using sendmail (with
authentication) running on that same server.  I can ssh into it, too.  Just
IMAP seems to fail.

> Is the IMAP server *really* sending the
> TCP, and the client TCP is never acknowledging them?

Hmmmmm.  Could be.

> If the Pine log shows that it never got anything from the server, it suggests
> the latter.
> 

Yeah - I'm trying all avenues here.  Initially, I wanted to rule out IMAP
because others can access it.  But now that I see the problem sites can
bounce mail across sendmail, use ssh *and* login manually, I can't figure
out a routing issue that would be so selective.

As always, thanks for your help.  If you happen to come up with anything,
let me know.  Thanks again.
-- 
Ed Marczak
[email-masked]

---

From: Mark Crispin <[email-masked]>
Date: Wed, 3 Jul 2002 11:51:08 -0700 (PDT)

On Wed, 03 Jul 2002 14:50:10 -0400, Edward Marczak wrote:
> > Try getting a Pine telemetry with "pine -d imap=4".

What are the exact messages (no paraphrasing)?

> > Try running unmodified UW imapd in case there is a bug introduced by a
> > RedHat modification.

So you replaced your RedHat-modified imapd in the example you posted with an
unmodified UW imapd?

> authentication) running on that same server.  I can ssh into it, too.  Just

Is there a NAT box in the path that may be interpreting IMAP?

If the client is Windows based, is there virus-scanning software on the client
that may be interpreting IMAP?

Not long ago, I had a strange SMTP problem that turned out to be due to Norton
Anti-Virus on the affected PC.  The perceived problem at the client was that
the SMTP server advertised STARTTLS, but then refused to do the command.  It
turned out that Norton was to blame.

---

From: Edward Marczak <[email-masked]>
Date: Fri, 05 Jul 2002 11:02:51 -0400

> What are the exact messages (no paraphrasing)?

About to open folder "INBOX"    inbox: "INBOX"
IMAP 10:54:43 7/5 mm_log babble: Trying IP address [ip.ad.dr.es]
IMAP 10:55:13 7/5 mm_log ERROR: Connection failed to 
server.example.com,143: Operation timed out

> So you replaced your RedHat-modified imapd in the example you posted with an

Yes.

> Is there a NAT box in the path that may be interpreting IMAP?

There are NAT boxes, certainly.  But I have good sites working with NAT, 
too.  Nothing that should be 'interpreting IMAP'.

> turned out that Norton was to blame.

Mark, you're too busy to be dealing with this, really.

I'm in agreement with you: I don't think uw-imap is at fault.  But to answer your question, I've tried Win with Netscape and OE, Mac (9 and OSX) and Linux with pine.  Doesn't change the scenario.

Thanks again for all of your help!
-- 
Ed Marczak
[email-masked]