[1425] in Moira
Re: user changed pobox
daemon@ATHENA.MIT.EDU (Garry Zacheiss)
Sun Mar 12 18:21:29 2000
Message-Id: <200003122321.SAA08182@mary-kay-commandos.mit.edu>
To: "Tom Coppeto" <tom@MIT.EDU>
cc: "Ron Hoffmann" <hoffmann@MIT.EDU>, bug-moira@MIT.EDU
In-Reply-To: Your message of "Sat, 11 Mar 2000 20:45:23 EST."
<NDBBKHCHPJDKBDPHJLDAIEFKCHAA.tom@mit.edu>
Date: Sun, 12 Mar 2000 18:21:25 -0500
From: Garry Zacheiss <zacheiss@MIT.EDU>
>> I set gsattler's mail manually with mrtest (qy spob gsattler IMAP
>> gsattler.po). I don't know of an easier way to do this.
A "moira" built from current sources will let you set this; I've been
waiting on deploying those clients because they also contain support for
SPLIT poboxes.
>> However it looks like the "safety" patch to not allow post office
>> servers to appear in smtp strings isn't taking effect. Probably because
>> the service type is "postoffice" and not "pop".
Here's a patch to fix this.
Index: pobox.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository//moira/clients/lib/pobox.c,v
retrieving revision 1.3
diff -c -r1.3 pobox.c
*** pobox.c 2000/02/22 17:45:50 1.3
--- pobox.c 2000/03/12 23:07:52
***************
*** 19,25 ****
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository//moira/clients/lib/pobox.c,v 1.3 2000/02/22 17:45:50 rbasch Exp $");
! enum { POTYPE_ERROR, POTYPE_POP, POTYPE_LOCAL, POTYPE_MAILHUB, POTYPE_SMTP };
static int potype(char *machine);
static int save_sloc_machine(int argc, char **argv, void *sq);
static int save_alias_value(int argc, char **argv, void *sq);
--- 19,25 ----
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository//moira/clients/lib/pobox.c,v 1.3 2000/02/22 17:45:50 rbasch Exp $");
! enum { POTYPE_ERROR, POTYPE_POP, POTYPE_LOCAL, POTYPE_MAILHUB, POTYPE_SMTP, POTYPE_IMAP };
static int potype(char *machine);
static int save_sloc_machine(int argc, char **argv, void *sq);
static int save_alias_value(int argc, char **argv, void *sq);
***************
*** 69,74 ****
--- 69,80 ----
switch (potype(machine))
{
+ case POTYPE_IMAP:
+ com_err(whoami, 0, "Cannot forward mail to IMAP server %s\n",
+ machine);
+ status = MRCL_REJECT;
+ goto cleanup;
+
case POTYPE_POP:
if (strcmp(p, user))
{
***************
*** 146,151 ****
--- 152,182 ----
int status, match = 0;
static struct save_queue *pop = NULL, *local = NULL;
static struct save_queue *mailhub = NULL, *mailhub_name = NULL;
+ static struct save_queue *imap = NULL;
+
+ /* 0. Check if the machine is an IMAP server. */
+ if (!imap)
+ {
+ char *service = "POSTOFFICE";
+ imap = sq_create();
+ status = mr_query("get_server_locations", 1, &service,
+ save_sloc_machine, imap);
+ if (status && (status != MR_NO_MATCH))
+ {
+ com_err(whoami, status, "while reading list of IMAP servers");
+ return POTYPE_ERROR;
+ }
+ }
+
+ while (sq_get_data(imap, &name))
+ {
+ if (!match && !strcasecmp(name, machine))
+ match = 1;
+ }
+
+ if (match)
+ return POTYPE_IMAP;
+
/* 1. Check if the machine is a POP server. */
if (!pop)