Subject: Inbox - mixed case? (UW imapd-4.5)

From: "Rubinstein, Dmitry" <[email-masked]>
Date: Wed, 14 Apr 1999 12:43:07 +0300

Hi, all!

There seems to be a bug in the way either UW imapd-4.5 or exchange IMAP
5.5.2448.8 handles the mixed case of INBOX. In UW imapd you can do the
following:

a1 create inbox/a
a1 OK CREATE completed
a2 create InBoX/a
a2 OK CREATE completed

You can then select both of those folders. These are in fact different
folders.

In the exchange IMAP server the second action will fail. This behavior of UW
IMAPD seems to contradict the following paragraph from RFC2060:

5.1.    Mailbox Naming

   The interpretation of mailbox names is implementation-dependent.
   However, the case-insensitive mailbox name INBOX is a special name
   reserved to mean "the primary mailbox for this user on this server".

--
Dmitry Rubinstein  <*>

Home: (972)-8-8647229
Cell: (972)-53-428979
[email-masked]
http://www.wisdom.weizmann.ac.il/~dimrub
-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Ricardo Stella <[email-masked]>
Date: Wed, 14 Apr 1999 11:38:56 -0400

Here's the scenario...

I need to batch transfer mail from one server running PMDFs IMAP to
another one running UW or maybe Cyrus or Netscpe's.  Assuming UW, my
plan would be:

* Start
* For each user in a list, do
  Make a local $USER directory
  Connect to the PMDF server as a root equivalent user
  Retrieve all mail/folders for $USER into $USER directory
  Disconnect
  Goto Start
* End

I assume that this would store all mail/folders into $USER, but in what
format ?  I guess depending on what I use to call this.  Perl would be
ideal, or if not something with c-client I guess.

If it's stored in UNIX format (ie plain text) I could use the utilities
to convert to another format and/or do the same but PUT all mail to the
new server for each user, correct ?

Pointers/quick scripts anyone ?

Thanks in advance...

---

From: Terry Gray <[email-masked]>
Date: Wed, 14 Apr 1999 08:48:32 -0700 (Pacific Daylight Time)

Mark is on vacation this week, so I'll jump in:  for a starting point,
take a look at the "imapcopy" utility in the UW distribution.

-teg

---

From: Ricardo Stella <[email-masked]>
Date: Wed, 14 Apr 1999 12:59:04 -0400

I asked this before but never got an answer...

Has anyone been able to authenticate to LDAP ?  

I've been trying to work with a PAM approach (which would be the ideal
way to do, since I could simply switch between LDAP and shadow
passwords), but I've been having problems with wrong passwords entered
(connection is dropped instead of passing 'bad password' to the client).

Also, ideally, this 'authentication' method (either internal, or perl
based external) could have a fail-over server, and ultimately, try
shadow passwords.

Using Solaris 2.6, and Netscape's DS 3.11.  Thanks in advance...
-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Ricardo Stella <[email-masked]>
Date: Wed, 14 Apr 1999 14:15:55 -0400

Thanks Terry...

I started to look at the imap utils.  There seems to be bugs with
imapcopy, but in any case, imapxfer is more likely what I need.

Still, imapxfer has bugs.

I tested it agains two UW imap 4.5 servers.  Both are configured the
same (in  my case, Solaris 2.6, make gso).

I ran it with 'imapxfer "{hostfrom}" "{hostto}"' and what happened was
ALL folders were tried to copy over.  So I tried using the mail prefix
(like you do with some clients such as communicator)

'imapxfer "{hostfrom}mail" "{hostto}mail"

This tried to access $HOME/mailmail/* and store it into $HOME/mailmail/
failing of course.

So I tried with 'mail/' for both, but now it wanted to pull from
$HOME/mail/mail/ and store to $HOME/mail/mail/

I tried different combinations and still...

I finally tried from a PMDF server (which defaults to list mailfolders
from $HOME) and storing to 'mail/' and it worked as expected, which is
in any case what I need to do...

Still, the bugs seem to be there...

Now, the next question would be, how can I connect as a SUPERUSER but
select someone elses mailbox, assuming SUPERUSER has read priviledges on
the server.  Is this possible from the remote end (ie not touching the
server reading from ?)

Thanks in advance...

---

From: Terry Gray <[email-masked]>
Date: Wed, 14 Apr 1999 11:19:09 -0700 (Pacific Daylight Time)

Ricardo, I'll have to defer to Mark on these issues...

-teg

---

From: Mark Crispin <[email-masked]>
Date: Mon, 19 Apr 1999 17:45:51 -0700 (PDT)

> 5.5.2448.8 handles the mixed case of INBOX. In UW imapd you can do the

This is a case of Garbage In, Garbage Out; specifically a client bug and
subsequent undefined server behavior.

You did a CREATE of a name without first checking to see whether the superior
name permits inferiors via LIST.  The answer from LIST "" INBOX says
(\NoInferiors).  A CREATE of an inferior of INBOX is therefore undefined.

---

From: Mark Crispin <[email-masked]>
Date: Mon, 19 Apr 1999 23:53:26 -0700 (PDT)

> Still, imapxfer has bugs.

Could you please explain what you mean by this?

> ALL folders were tried to copy over.

Well, yes; that's what that command does.  Why do you think that it should be
different?

> This tried to access $HOME/mailmail/* and store it into $HOME/mailmail/

This reads mail* and for each resulting name $i (including the "mail" part)
stores it into mail$i which is probably not what you want.

> $HOME/mail/mail/ and store to $HOME/mail/mail/

This reads mail/* and for each resulting name $i (including the "mail/" part)
stores it into mail/$i

All of the above is "unless you made non-standard modifications to c-client
(used by either imapxfer or imapd), such as changing its idea of the home
directory."  If you made any non-standard modifications, then you're on your
own.

> Still, the bugs seem to be there...

I'm still trying to determine why you say this.  As far as I can tell, you're
confused about how to use the program.

> the server.  Is this possible from the remote end (ie not touching the

The simple answer is "no".  Superuser access isn't allowed.

---

From: Ricardo Stella <[email-masked]>
Date: Tue, 20 Apr 1999 09:33:33 -0400

Mark,

I believe I did mention that I used 'straight out of the box'
compilation, that is, no customization whatsoever...  If I'm confused
about how to use the program, I'm sorry, though point me how to then...

In any case, I would assume that imapxfer was meant to 'transfer all
mail folders', but that you should be able to specify a starting point.

In short words, how can I transfer just mail folders from an UW Imap
server to another UW Imap server, where all mail (as the default makes
it) is stored in $HOME/mail ?

Using the command straight forward (ie imapxfer "{hostfrom}" "{hostto}")
starts to copy '$HOME/mail/" but ends up copying '$HOME/" as well, which
is not what I believe you wrote imapxfer for.

Thanks in advance...

---

From: Mark Crispin <[email-masked]>
Date: Tue, 20 Apr 1999 10:55:38 -0700 (PDT)

> it) is stored in $HOME/mail ?

Assuming that you have *NOT* modified c-client in any way (both in imapxfer
and in imapd), then you probably want:
	imapxfer "{hostfrom}mail/" "{hostto}"

---

From: Ricardo Stella <[email-masked]>
Date: Tue, 20 Apr 1999 15:37:14 -0400

Here's what I did.

* Downloaded 4.5 and utils
* Compiled 'make gso' for 4.5 and 'make' for imapxfer
* imapxfer "{hostfrom}mail/" "{hostto}"
* 'test' account exists, and mail/ directory is empty on hostto

This is what I got...

[Trying IP address [x.x.x.x]]
[hostfrom IMAP4rev1 v12.250 server ready]
{hostfrom/imap} username: test
password:
[Trying IP address [y.y.y.y]]
[hostto IMAP4rev1 v12.250 server ready]
{hostto/imap} username: test
password:
Listing mailboxes...
Copying {hostfrom:143/imap/user=test}mail/mail/
  => {hostto:143/imap/user=test}mail/
[Reusing connection to hostfrom/user=test]
?EXAMINE failed: Can't open mailbox mail/mail/: no such mailbox
Mailbox {hostfrom:143/imap/user=test}<no_mailbox> has 0 message(s).
?CREATE failed: Can't create mailbox node /export/home/test/mail/: File
exists
an't create mailbox
Copying {hostfrom:143/imap/user=test}mail/mail/testfolder
  => {hostto:143/imap/user=test}mail/testfolder
[Reusing connection to hostfrom/user=test]
?EXAMINE failed: Can't open mailbox mail/mail/testfolder: no such
mailbox
Mailbox {hostfrom:143/imap/user=test}<no_mailbox> has 0 message(s).
?CREATE failed: Can't create mailbox node
/export/home/test/mail/testfolder: File
exists
an't create mailbox
[hostto IMAP4rev1 server terminating connection]
[hostfrom IMAP4rev1 server terminating connection]

---

From: Mark Crispin <[email-masked]>
Date: Tue, 20 Apr 1999 17:18:00 -0700 (PDT)

Try applying the following patch to your copy of imapxfer.c:

*** imapxfer.c.old	Wed Dec 23 12:53:27 1998
--- imapxfer.c	Tue Apr 20 16:31:46 1999
***************
*** 10,18 ****
   *		Internet: [email-masked]
   *
   * Date:	2 February 1994
!  * Last Edited:	23 December 1998
   *
!  * Copyright 1998 by the University of Washington
   *
   *  Permission to use, copy, modify, and distribute this software and its
   * documentation for any purpose and without fee is hereby granted, provided
--- 10,18 ----
   *		Internet: [email-masked]
   *
   * Date:	2 February 1994
!  * Last Edited:	20 April 1999
   *
!  * Copyright 1999 by the University of Washington
   *
   *  Permission to use, copy, modify, and distribute this software and its
   * documentation for any purpose and without fee is hereby granted, provided
***************
*** 181,187 ****
  				/* read back mailbox names */
    while (fgets (tmp,MAILTMPLEN-1,f)) {
      if (t = strchr (tmp,'\n')) *t = '\0';
!     strcat (strcpy (strchr (strcpy (src,s->mailbox),'}') + 1,sp),tmp);
      strcat (strcpy (strchr (strcpy (dst,d->mailbox),'}') + 1,dp),tmp);
      printf ("Copying %s\n  => %s\n",src,dst);
      fflush (stdout);
--- 181,187 ----
  				/* read back mailbox names */
    while (fgets (tmp,MAILTMPLEN-1,f)) {
      if (t = strchr (tmp,'\n')) *t = '\0';
!     strcpy (strchr (strcpy (src,s->mailbox),'}') + 1,tmp);
      strcat (strcpy (strchr (strcpy (dst,d->mailbox),'}') + 1,dp),tmp);
      printf ("Copying %s\n  => %s\n",src,dst);
      fflush (stdout);
***************
*** 292,299 ****
    char c,*s,tmp[MAILTMPLEN];
  				/* note destination delimiter */
    if (ddelim < 0) ddelim = delimiter;
! 				/* if got a name */
!   else if (*name && (name = strchr (name,'}')) && *++name) {
  				/* see if have to edit delimiters */
      if ((ddelim > 0) && (delimiter != ddelim) &&
  	(strchr (name,ddelim) || strchr (name,delimiter))) {
--- 292,300 ----
    char c,*s,tmp[MAILTMPLEN];
  				/* note destination delimiter */
    if (ddelim < 0) ddelim = delimiter;
! 				/* if got a selectable name */
!   else if (!(attributes & LATT_NOSELECT) &&
! 	   *name && (name = strchr (name,'}')) && *++name) {
  				/* see if have to edit delimiters */
      if ((ddelim > 0) && (delimiter != ddelim) &&
  	(strchr (name,ddelim) || strchr (name,delimiter))) {

---

From: Ricardo Stella <[email-masked]>
Date: Wed, 21 Apr 1999 13:46:57 -0400

That did the trick...

Thanks for the fix...