You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Blas Rodriguez Somoza <bl...@puertareal.com> on 2002/03/06 16:37:34 UTC

Patch for multiple domains

Hello

    I'm testing james to use it as my mail server. I see that presently
there is no real support for domains, so I get the code from CVS and try to
make the changes to allow domains.

    I try changing username into a serializable class with user and server
names, after some hours of work I suceed and now I have a version that
supports multiple domains. I have test it with remotemanager, SMTP and POP3
and it works OK for what I test.

    The usernames has the form user@server everywhere there is used
including the mail inboxes.

    Changing the username String into a serializable Class allows to use it
as a key in the repositories, keep the changes minimum and allow easy debug.

    The changes affects 22 classes (excluding the new UserName class).
        James - 6 lines (2 executable)
        AuthService - 2 lines (0 executable)
        AuthServiceImpl - 4 lines (1 executable)
        NNTPHandler - 2 lines (1 executable)
        POP3Handler - 4 lines (2 executable)
        RemoteManagerHandler - 8 lines (8 executable)
        JamesUser - 2 lines (0 executable)
        MailServer - 2 lines (0 executable)
        User - 1 line (0 executable)
        UsersRepository - 11 lines (1 executable)
        SMTPHandler - 12 lines (7 executable)
        AvalonListservManager - 4 lines (3 executable)
        RecipientIsLocal - 2 lines (1 executable)
        AbstractJdbcUsersRepository - 6 lines (4 executable)
        AbstractUsersRepository - 12 lines (2 executable)
        DefaultJamesUser - 7 lines (1 executable)
        DefaultUser - 5 lines (0 executable)
        DefaultUsersJdbcRepository - 4 lines (3 executable) (excluding two
dummy methods needed)
        JamesUsersJdbcRepository - 5 lines (4 executable) (excluding two
dummy methods needed)
        ListUsersJdbcRepository - 3 lines (2 executable) (excluding two
dummy methods needed)
        UsersFileRepository - 23 lines (12 executable)
        UsersLDAPRepository - 14 lines (1 executable)
        MailetContext - 2 lines (0 executable)

        Total = 139 lines (55 executable)

    The change needs to be tested with mailing lists, imap and nntp.

    I want to contribute the changes, it there are accepted.

Regards
Blas Rodriguez Somoza


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Patch for multiple domains

Posted by Alexander Zhukov <al...@ukrpost.net>.
Hi all!

I have recently posted to this mailing list with just the same patches but i was ignored(?). Mail failure?


Can any one explain?

--- here i add the message i've posted ---



I'd like to add imap support back to the James.

I cvsed the code looked it thru and saw that james lacks the features i 
need in the following "modules":
1. imap
2. ldapuserstore
3. support for multiple domains

A question:
Does james support multiple domains?
i tried to create user@domain1.com and user@domain2.com but mail is 
delievered to one and the same folder - so i conclude james has 
_partial_ multi-domain support or did i miss something?

Few things i did:

I have rewritten from scratch the UsersLDAPRepository.java to add some 
multidomain support, i also hacked a bit the James.java. One more thing 
- i added the imap support to the James.java (from proposals/).
mime encoder in DigestUtil.digestString doesnt pad the encoded string 
that's why when you add the user to ldaprepository you cant bind to ldap 
with that user - i made (rather ugly) work around on this bug(?).

You can download the modifications from http://may.priocom.com:8080/james/

some comments:
UsersLDAPRepository.java
i dont use the config right know all the settings are compiled in :( i'm 
going to fix it ASAP

DigestUtil.java
i guess util.Base64 is better because it _tries_ to pad the output 
however it adds "A" instead of "=" at the end of encoded string :(

James.java
wont work out of the box because i'm working on imap support


Regards
Alexander Zhukov


-- 
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Patch for multiple domains

Posted by Blas Rodriguez Somoza <bl...@puertareal.com>.
Hello

    I find a better solution to the different user name systems that the one
I mention in the last mail.

    The mail server uses two different concepts, MailAdresses and
LocalUsers, between the two must exist a mapping method. Now the only
mapping is that the user in the address must be one of the LocalUsers.

    The easiest mapping method to allow multiple domains is to add an
attribute in the configuration file (james-config.xml)  for each servername
that gives the domain name that a local user must have. Let me give an
example
    <servername>localhost</servername>
    <servername userDomain="">domain1</servername>
    <servername userDomain="domain2.com">domain2.com</servername>
    <servername userDomain="domain2.com">domain3.com</servername>

    A mail to "user" of the first and second servernames (user@localhost
user@domain1) maps to a LocalUser "user" without domain name. The
name of the mail box will be "user"

    A mail to "user" of the third and fourth servernames
(user@domain2.com user@domain3.com) maps to a LocalUser
user@domain2.com. The name of the mail box will be "user@domain2.com" but it
is very easy to change that, for example to "/domain2.com/user".

    This way the two user naming method can work simultaneously. If the
attribute userDomain don't exists, then the systems works as it do now.

    The great mayority of changes are only method declaration or cast
changes.

    To allow the mapping between LocalUsers and MailAddress there are 1 more
method in the MailServer interface and 2 more in the MailetContext
interface.

    Also the serverNames collection must be changed to a Hashtable to store
the userDomain for each server name.

    There are three places where getAttributes and test methods was addded
to satisfy the implemented interface requirements.
        ListUsersJdbcRepository.java
        JamesUsersJdbcRepository.java
        DefaultUsersJdbcRepository.java

    I test the patches with remoteManager, STMP and POP3 using authorized
SMTP.

    I send the patch file and the org.apache.james.services.LocalUser class
in the mail.

Regards
Blas Rodriguez Somoza.

----- Original Message -----
From: "Danny Angus" <da...@thought.co.uk>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Thursday, March 07, 2002 3:07 PM
Subject: RE: Patch for multiple domains


> certainly worth trying I think.
>
> > -----Original Message-----
> > From: Blas Rodriguez Somoza [mailto:blas@puertareal.com]
> > Sent: Thursday, March 07, 2002 2:10 PM
> > To: James Developers List
> > Subject: Re: Patch for multiple domains
> >
> >
> > Hello
> >
> > In the present form this system invalidate the present identification
> > system. I prefer to give an acceptable solution to everyone if it is
> > possible, and make the complete work.
> >
> > There is very simple to give alternate user naming system if the
> > systems has
> > not to work simultaneously.
> >
> > The solution I propose is adding one attribute more to the
> > james-config.xml:
> >     <servernames multidomain="true/false">
> >
> > With this parameter each administrator can select one of the two
> > user naming
> > systems. For each naming system the only difference is how the UserName
> > class works, mainly the equal, equalsIgnoreCase and toString methods.
> >
> > Is this system acceptable?. If it is I will do the modifications and
then
> > send the diffs.
> >
> > Regards
> > Blas Rodriguez Somoza
> >
> > ----- Original Message -----
> > From: "Danny Angus" <da...@thought.co.uk>
> > To: "James Developers List" <ja...@jakarta.apache.org>
> > Sent: Thursday, March 07, 2002 12:11 PM
> > Subject: RE: Patch for multiple domains
> >
> >
> > > we'd be happy to consider your changes, send them to this list as
diffs
> > > (either in seperate files or one big file)
> > > if your not sure how to do this read this:
> > > http://jakarta.apache.org/site/source.html section marked "Patches"
> > >
> > > Do your diff from the src directory and ensure that you include
> > the whole
> > > ouput from cvs diff including the lines that look like this:
> > >
> > > cvs diff -u
java/org/apache/james/transport/mailets/RemoteDelivery.java
> > > Index: java/org/apache/james/transport/mailets/RemoteDelivery.java
> > > ===================================================================
> > > RCS file:
> > >
> > /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailet
> > s/RemoteDe
> > > livery.java,v
> > > retrieving revision 1.14
> > > diff -u -r1.14 RemoteDelivery.java
> > > --- java/org/apache/james/transport/mailets/RemoteDelivery.java
> > 1 Mar 2002
> > > 15:58:40 -0000 1.14
> > > +++ java/org/apache/james/transport/mailets/RemoteDelivery.java
> > 7 Mar 2002
> > > 11:04:12 -0000
> > >
> > > This makes it easier for us to use "Patch" 'cos it allows it to find
the
> > > files it needs to patch
> > >
> > > We've been talking around this subject for some while now, and
> > have always
> > > stuck on the issue of user identification.
> > > I suspect that your scheme using mailaddresses as usernames may
> > not be to
> > > everyones tastes, and therefore we ought to make sure that by
> > making your
> > > scheme operational it doesn't preclude any other naming
> > schemes, including
> > > the current one.
> > >
> > > d.
> > >
> > >
> > > > -----Original Message-----
> > > > From: Blas Rodriguez Somoza [mailto:blas@puertareal.com]
> > > > Sent: Wednesday, March 06, 2002 3:38 PM
> > > > To: james-dev@jakarta.apache.org
> > > > Subject: Patch for multiple domains
> > > >
> > > >
> > > > Hello
> > > >
> > > >     I'm testing james to use it as my mail server. I see that
> > presently
> > > > there is no real support for domains, so I get the code from CVS
> > > > and try to
> > > > make the changes to allow domains.
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>









RE: Patch for multiple domains

Posted by Danny Angus <da...@thought.co.uk>.
certainly worth trying I think.

> -----Original Message-----
> From: Blas Rodriguez Somoza [mailto:blas@puertareal.com]
> Sent: Thursday, March 07, 2002 2:10 PM
> To: James Developers List
> Subject: Re: Patch for multiple domains
>
>
> Hello
>
> In the present form this system invalidate the present identification
> system. I prefer to give an acceptable solution to everyone if it is
> possible, and make the complete work.
>
> There is very simple to give alternate user naming system if the
> systems has
> not to work simultaneously.
>
> The solution I propose is adding one attribute more to the
> james-config.xml:
>     <servernames multidomain="true/false">
>
> With this parameter each administrator can select one of the two
> user naming
> systems. For each naming system the only difference is how the UserName
> class works, mainly the equal, equalsIgnoreCase and toString methods.
>
> Is this system acceptable?. If it is I will do the modifications and then
> send the diffs.
>
> Regards
> Blas Rodriguez Somoza
>
> ----- Original Message -----
> From: "Danny Angus" <da...@thought.co.uk>
> To: "James Developers List" <ja...@jakarta.apache.org>
> Sent: Thursday, March 07, 2002 12:11 PM
> Subject: RE: Patch for multiple domains
>
>
> > we'd be happy to consider your changes, send them to this list as diffs
> > (either in seperate files or one big file)
> > if your not sure how to do this read this:
> > http://jakarta.apache.org/site/source.html section marked "Patches"
> >
> > Do your diff from the src directory and ensure that you include
> the whole
> > ouput from cvs diff including the lines that look like this:
> >
> > cvs diff -u java/org/apache/james/transport/mailets/RemoteDelivery.java
> > Index: java/org/apache/james/transport/mailets/RemoteDelivery.java
> > ===================================================================
> > RCS file:
> >
> /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailet
> s/RemoteDe
> > livery.java,v
> > retrieving revision 1.14
> > diff -u -r1.14 RemoteDelivery.java
> > --- java/org/apache/james/transport/mailets/RemoteDelivery.java
> 1 Mar 2002
> > 15:58:40 -0000 1.14
> > +++ java/org/apache/james/transport/mailets/RemoteDelivery.java
> 7 Mar 2002
> > 11:04:12 -0000
> >
> > This makes it easier for us to use "Patch" 'cos it allows it to find the
> > files it needs to patch
> >
> > We've been talking around this subject for some while now, and
> have always
> > stuck on the issue of user identification.
> > I suspect that your scheme using mailaddresses as usernames may
> not be to
> > everyones tastes, and therefore we ought to make sure that by
> making your
> > scheme operational it doesn't preclude any other naming
> schemes, including
> > the current one.
> >
> > d.
> >
> >
> > > -----Original Message-----
> > > From: Blas Rodriguez Somoza [mailto:blas@puertareal.com]
> > > Sent: Wednesday, March 06, 2002 3:38 PM
> > > To: james-dev@jakarta.apache.org
> > > Subject: Patch for multiple domains
> > >
> > >
> > > Hello
> > >
> > >     I'm testing james to use it as my mail server. I see that
> presently
> > > there is no real support for domains, so I get the code from CVS
> > > and try to
> > > make the changes to allow domains.
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Patch for multiple domains

Posted by Blas Rodriguez Somoza <bl...@puertareal.com>.
Hello

In the present form this system invalidate the present identification
system. I prefer to give an acceptable solution to everyone if it is
possible, and make the complete work.

There is very simple to give alternate user naming system if the systems has
not to work simultaneously.

The solution I propose is adding one attribute more to the james-config.xml:
    <servernames multidomain="true/false">

With this parameter each administrator can select one of the two user naming
systems. For each naming system the only difference is how the UserName
class works, mainly the equal, equalsIgnoreCase and toString methods.

Is this system acceptable?. If it is I will do the modifications and then
send the diffs.

Regards
Blas Rodriguez Somoza

----- Original Message -----
From: "Danny Angus" <da...@thought.co.uk>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Thursday, March 07, 2002 12:11 PM
Subject: RE: Patch for multiple domains


> we'd be happy to consider your changes, send them to this list as diffs
> (either in seperate files or one big file)
> if your not sure how to do this read this:
> http://jakarta.apache.org/site/source.html section marked "Patches"
>
> Do your diff from the src directory and ensure that you include the whole
> ouput from cvs diff including the lines that look like this:
>
> cvs diff -u java/org/apache/james/transport/mailets/RemoteDelivery.java
> Index: java/org/apache/james/transport/mailets/RemoteDelivery.java
> ===================================================================
> RCS file:
>
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/RemoteDe
> livery.java,v
> retrieving revision 1.14
> diff -u -r1.14 RemoteDelivery.java
> --- java/org/apache/james/transport/mailets/RemoteDelivery.java 1 Mar 2002
> 15:58:40 -0000 1.14
> +++ java/org/apache/james/transport/mailets/RemoteDelivery.java 7 Mar 2002
> 11:04:12 -0000
>
> This makes it easier for us to use "Patch" 'cos it allows it to find the
> files it needs to patch
>
> We've been talking around this subject for some while now, and have always
> stuck on the issue of user identification.
> I suspect that your scheme using mailaddresses as usernames may not be to
> everyones tastes, and therefore we ought to make sure that by making your
> scheme operational it doesn't preclude any other naming schemes, including
> the current one.
>
> d.
>
>
> > -----Original Message-----
> > From: Blas Rodriguez Somoza [mailto:blas@puertareal.com]
> > Sent: Wednesday, March 06, 2002 3:38 PM
> > To: james-dev@jakarta.apache.org
> > Subject: Patch for multiple domains
> >
> >
> > Hello
> >
> >     I'm testing james to use it as my mail server. I see that presently
> > there is no real support for domains, so I get the code from CVS
> > and try to
> > make the changes to allow domains.
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Patch for multiple domains

Posted by Serge Knystautas <se...@lokitech.com>.
What about instead of patches if we just take the files that have changed,
and put this in the proposal directory?  Then people can evaluate it before
we add it into the main tree.

Serge Knystautas
Loki Technologies - Unstoppable Websites
http://www.lokitech.com/
----- Original Message -----
From: "Danny Angus" <da...@thought.co.uk>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Thursday, March 07, 2002 6:11 AM
Subject: RE: Patch for multiple domains


> we'd be happy to consider your changes, send them to this list as diffs
> (either in seperate files or one big file)
> if your not sure how to do this read this:
> http://jakarta.apache.org/site/source.html section marked "Patches"
>
> Do your diff from the src directory and ensure that you include the whole
> ouput from cvs diff including the lines that look like this:
>
> cvs diff -u java/org/apache/james/transport/mailets/RemoteDelivery.java
> Index: java/org/apache/james/transport/mailets/RemoteDelivery.java
> ===================================================================
> RCS file:
>
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/RemoteDe
> livery.java,v
> retrieving revision 1.14
> diff -u -r1.14 RemoteDelivery.java
> --- java/org/apache/james/transport/mailets/RemoteDelivery.java 1 Mar 2002
> 15:58:40 -0000 1.14
> +++ java/org/apache/james/transport/mailets/RemoteDelivery.java 7 Mar 2002
> 11:04:12 -0000
>
> This makes it easier for us to use "Patch" 'cos it allows it to find the
> files it needs to patch
>
> We've been talking around this subject for some while now, and have always
> stuck on the issue of user identification.
> I suspect that your scheme using mailaddresses as usernames may not be to
> everyones tastes, and therefore we ought to make sure that by making your
> scheme operational it doesn't preclude any other naming schemes, including
> the current one.
>
> d.
>
>
> > -----Original Message-----
> > From: Blas Rodriguez Somoza [mailto:blas@puertareal.com]
> > Sent: Wednesday, March 06, 2002 3:38 PM
> > To: james-dev@jakarta.apache.org
> > Subject: Patch for multiple domains
> >
> >
> > Hello
> >
> >     I'm testing james to use it as my mail server. I see that presently
> > there is no real support for domains, so I get the code from CVS
> > and try to
> > make the changes to allow domains.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Patch for multiple domains

Posted by Danny Angus <da...@thought.co.uk>.
we'd be happy to consider your changes, send them to this list as diffs
(either in seperate files or one big file)
if your not sure how to do this read this:
http://jakarta.apache.org/site/source.html section marked "Patches"

Do your diff from the src directory and ensure that you include the whole
ouput from cvs diff including the lines that look like this:

	cvs diff -u java/org/apache/james/transport/mailets/RemoteDelivery.java
	Index: java/org/apache/james/transport/mailets/RemoteDelivery.java
	===================================================================
	RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/RemoteDe
livery.java,v
	retrieving revision 1.14
	diff -u -r1.14 RemoteDelivery.java
	--- java/org/apache/james/transport/mailets/RemoteDelivery.java	1 Mar 2002
15:58:40 -0000	1.14
	+++ java/org/apache/james/transport/mailets/RemoteDelivery.java	7 Mar 2002
11:04:12 -0000

This makes it easier for us to use "Patch" 'cos it allows it to find the
files it needs to patch

We've been talking around this subject for some while now, and have always
stuck on the issue of user identification.
I suspect that your scheme using mailaddresses as usernames may not be to
everyones tastes, and therefore we ought to make sure that by making your
scheme operational it doesn't preclude any other naming schemes, including
the current one.

d.


> -----Original Message-----
> From: Blas Rodriguez Somoza [mailto:blas@puertareal.com]
> Sent: Wednesday, March 06, 2002 3:38 PM
> To: james-dev@jakarta.apache.org
> Subject: Patch for multiple domains
>
>
> Hello
>
>     I'm testing james to use it as my mail server. I see that presently
> there is no real support for domains, so I get the code from CVS
> and try to
> make the changes to allow domains.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>