I add Virtual domain support in tmail. /imap-utils/
Below is patch.
----------------------------------------------------------------
--- tmail.c.orig Tue Apr 2 16:41:42 2002
+++ tmail.c Thu May 30 16:28:15 2002
@@ -246,8 +246,9 @@
struct stat sbuf;
uid_t duid;
uid_t euid = geteuid ();
- /* get user record */
- if (!(pwd = getpwnam (getusername (user,&mailbox)))) {
+ /* get user record*/
+ /* CHANGES !! vgetpwnam */
+ if (! (pwd = vgetpwnam (getusername (user,&mailbox)))) {
sprintf (tmp,"no such user as %.80s",user);
return fail (tmp,EX_NOUSER);
}
@@ -553,7 +554,7 @@
}
-/* Get user name from username+mailbox specifier
+/* Get user name from username@domain+mailbox specifier
* Accepts: username/mailbox specifier
* pointer to return location for mailbox specifier
* Returns: user name, mailbox specifier value NIL if INBOX, patches out +
@@ -562,11 +563,16 @@
char *getusername (char *s,char **t)
{
char tmp[MAILTMPLEN];
+ char *p;
if (*t = strchr (s,'+')) { /* have a mailbox specifier? */
- *(*t)++ = '\0'; /* yes, tie off user name */
+ *(*t)++ = '\0'; /* yes, tie off user name[@domain] */
/* user+ and user+INBOX same as user */
if (!**t || !strcmp ("INBOX",ucase (strcpy (tmp,*t)))) *t = NIL;
}
+ if (p = strchr (s,'@')) { /* have a domain specified? */
+ *p = '\0'; p++; /* yes, tie off user name */
+ env_parameters(SET_DOMAINNAME,p);
+ }
return s; /* return user name */
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For the folks who don't know what tmail is, it's a mail delivery program (sendmail calls it to stuff mail into mailboxes). It comes from the folks who created uw-imap, which is the imap that vimap is based on.
It can be found inside this file:
ftp://ftp.cac.washington.edu/mail/imap-utils.tar.Z
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sigh... and to actually make it *compile*, you have to:
1) unpack imap-2001a.tar.Z
2) unpack imap-utils.tar.Z
3) replace the Makefile in the tmail directory with this one:
-------
# Program: tmail Makefile
#
# Author: Mark Crispin
# Networks and Distributed Computing
# Computing & Communications
# University of Washington
# Administration Building, AG-44
# Seattle, WA 98195
# Internet: MRC@CAC.Washington.EDU
#
# Date: 28 October 1990
# Last Edited: 24 October 2000
#
# The IMAP toolkit provided in this Distribution is
# Copyright 2000 University of Washington.
#
# The full text of our legal notices is contained in the file called
# CPYRIGHT, included with this Distribution.
C = ../c-client
CCLIENTLIB = $C/c-client.a
SHELL = /bin/sh
I add Virtual domain support in tmail. /imap-utils/
Below is patch.
----------------------------------------------------------------
--- tmail.c.orig Tue Apr 2 16:41:42 2002
+++ tmail.c Thu May 30 16:28:15 2002
@@ -246,8 +246,9 @@
struct stat sbuf;
uid_t duid;
uid_t euid = geteuid ();
- /* get user record */
- if (!(pwd = getpwnam (getusername (user,&mailbox)))) {
+ /* get user record*/
+ /* CHANGES !! vgetpwnam */
+ if (! (pwd = vgetpwnam (getusername (user,&mailbox)))) {
sprintf (tmp,"no such user as %.80s",user);
return fail (tmp,EX_NOUSER);
}
@@ -553,7 +554,7 @@
}
-/* Get user name from username+mailbox specifier
+/* Get user name from username@domain+mailbox specifier
* Accepts: username/mailbox specifier
* pointer to return location for mailbox specifier
* Returns: user name, mailbox specifier value NIL if INBOX, patches out +
@@ -562,11 +563,16 @@
char *getusername (char *s,char **t)
{
char tmp[MAILTMPLEN];
+ char *p;
if (*t = strchr (s,'+')) { /* have a mailbox specifier? */
- *(*t)++ = '\0'; /* yes, tie off user name */
+ *(*t)++ = '\0'; /* yes, tie off user name[@domain] */
/* user+ and user+INBOX same as user */
if (!**t || !strcmp ("INBOX",ucase (strcpy (tmp,*t)))) *t = NIL;
}
+ if (p = strchr (s,'@')) { /* have a domain specified? */
+ *p = '\0'; p++; /* yes, tie off user name */
+ env_parameters(SET_DOMAINNAME,p);
+ }
return s; /* return user name */
}
For the folks who don't know what tmail is, it's a mail delivery program (sendmail calls it to stuff mail into mailboxes). It comes from the folks who created uw-imap, which is the imap that vimap is based on.
It can be found inside this file:
ftp://ftp.cac.washington.edu/mail/imap-utils.tar.Z
Sigh... and to actually make it *compile*, you have to:
1) unpack imap-2001a.tar.Z
2) unpack imap-utils.tar.Z
3) replace the Makefile in the tmail directory with this one:
-------
# Program: tmail Makefile
#
# Author: Mark Crispin
# Networks and Distributed Computing
# Computing & Communications
# University of Washington
# Administration Building, AG-44
# Seattle, WA 98195
# Internet: MRC@CAC.Washington.EDU
#
# Date: 28 October 1990
# Last Edited: 24 October 2000
#
# The IMAP toolkit provided in this Distribution is
# Copyright 2000 University of Washington.
#
# The full text of our legal notices is contained in the file called
# CPYRIGHT, included with this Distribution.
C = ../c-client
CCLIENTLIB = $C/c-client.a
SHELL = /bin/sh
# Get local definitions from c-client directory
CC = `cat $C/CCTYPE`
CFLAGS = -I$C `cat $C/CFLAGS`
LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
tmail: $(CCLIENTLIB) tmail.o
$(CC) $(CFLAGS) -o tmail tmail.o $(LDFLAGS)
tmail.o: $C/mail.h $C/misc.h $C/osdep.h
$(CCLIENTLIB):
cd $C;make
clean:
rm -f *.o tmail || true
# A monument to a hack of long ago and far away...
love:
@echo 'not war?'
Now, how do I get sendmail to ignore the password file?
It rejects my test email messages before it even calls tmail.
vimap usually relies on the mail delivery module that comes with linuxconf and the mailconf module.
http://www.solucorp.qc.ca/linuxconf/
Maybe by looking at this module you can figure out how the mailer "virtual" handles this.