about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-10 07:04:37 +0000
committerEric Wong <e@yhbt.net>2020-06-13 07:55:45 +0000
commit49175649b3e49cdd5f2ac857cb91e69a5b91a739 (patch)
tree0d79deb03f67a58c2c1e6bcb5d75e004a6004e55 /lib
parent509c2cc25c8f21b4e1685de8b475629559c9b2aa (diff)
downloadpublic-inbox-49175649b3e49cdd5f2ac857cb91e69a5b91a739.tar.gz
IMAP RFC 3501 stipulates case-insensitive comparisons, and so
does RFC 977 (NNTP).  However, INN (nnrpd) uses case-sensitive
comparisons, so we've always used case-sensitive comparisons for
NNTP to match nnrpd behavior.

Unfortunately, some IMAP clients insist on sending "INBOX" with
caps, which causes problems for us.  Since NNTP group names are
typically all lowercase anyways, just force all comparisons to
lowercase for IMAP and warn admins if uppercase-containing
newsgroups won't be accessible over IMAP.

This ensures our existing -nntpd behavior remains unchanged
while being compatible with the expectations of real-world IMAP
clients.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/IMAPD.pm7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/PublicInbox/IMAPD.pm b/lib/PublicInbox/IMAPD.pm
index a3a25986..966879d8 100644
--- a/lib/PublicInbox/IMAPD.pm
+++ b/lib/PublicInbox/IMAPD.pm
@@ -25,6 +25,13 @@ sub refresh_inboxlist ($) {
         my ($self) = @_;
         my @names = map { $_->{newsgroup} } @{delete $self->{grouplist}};
         my %ns; # "\Noselect \HasChildren"
+
+        if (my @uc = grep(/[A-Z]/, @names)) {
+                warn "Uppercase not allowed for IMAP newsgroup(s):\n",
+                        map { "\t$_\n" } @uc;
+                my %uc = map { $_ => 1 } @uc;
+                @names = grep { !$uc{$_} } @names;
+        }
         for (@names) {
                 my $up = $_;
                 while ($up =~ s/\.[^\.]+\z//) {